[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 09/36] xen/arch: add default colors selection function
On 04.03.2022 18:46, Marco Solieri wrote: > From: Luca Miccio <lucmiccio@xxxxxxxxx> > > When cache coloring support is enabled, a color assignment is needed for > every domain. Introduce a function computing a default configuration > with a safe and common value -- the dom0 color selection. > > Do not access directly the array of color indices of dom0. Instead make > use of the dom0 color configuration as a bitmask. > Add a helper function that converts the color configuration bitmask into > the indices array. > > Signed-off-by: Luca Miccio <lucmiccio@xxxxxxxxx> > Signed-off-by: Marco Solieri <marco.solieri@xxxxxxxxxxxxxxx> Nit (but relevant because it might be misguiding people just glancing over the series): Did you mean "xen/arm:" rather than "xen/arch:" in the title here as well as in that of the next patch? Jan > --- > xen/arch/arm/coloring.c | 36 +++++++++++++++++++++++++++++ > xen/arch/arm/include/asm/coloring.h | 7 ++++++ > 2 files changed, 43 insertions(+) > > diff --git a/xen/arch/arm/coloring.c b/xen/arch/arm/coloring.c > index af75b536a7..f6e6d09477 100644 > --- a/xen/arch/arm/coloring.c > +++ b/xen/arch/arm/coloring.c > @@ -143,6 +143,42 @@ static __init uint64_t calculate_addr_col_mask(uint64_t > llc_way_size) > return addr_col_mask; > } > > +static int copy_mask_to_list( > + uint32_t *col_mask, uint32_t *col_list, uint64_t col_num) > +{ > + unsigned int i, k, c; > + > + if ( !col_list ) > + return -EINVAL; > + > + for ( i = 0, k = 0; i < MAX_COLORS_CELLS; i++ ) > + for ( c = 0; k < col_num && c < 32; c++ ) > + if ( col_mask[i] & (1 << (c + (i*32))) ) > + col_list[k++] = c + (i * 32); > + > + return 0; > +} > + > +uint32_t *setup_default_colors(uint32_t *col_num) > +{ > + uint32_t *col_list; > + > + if ( dom0_col_num ) > + { > + *col_num = dom0_col_num; > + col_list = xzalloc_array(uint32_t, dom0_col_num); > + if ( !col_list ) > + { > + printk(XENLOG_ERR "setup_default_colors: Alloc failed\n"); > + return NULL; > + } > + copy_mask_to_list(dom0_col_mask, col_list, dom0_col_num); > + return col_list; > + } > + > + return NULL; > +} > + > bool __init coloring_init(void) > { > int i; > diff --git a/xen/arch/arm/include/asm/coloring.h > b/xen/arch/arm/include/asm/coloring.h > index 70e1dbd09b..8f24acf082 100644 > --- a/xen/arch/arm/include/asm/coloring.h > +++ b/xen/arch/arm/include/asm/coloring.h > @@ -27,6 +27,13 @@ > > #ifdef CONFIG_COLORING > bool __init coloring_init(void); > + > +/* > + * Return an array with default colors selection and store the number of > + * colors in @param col_num. The array selection will be equal to the dom0 > + * color configuration. > + */ > +uint32_t *setup_default_colors(uint32_t *col_num); > #else /* !CONFIG_COLORING */ > static inline bool __init coloring_init(void) > {
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |