|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 03/27] ARM: GICv3: allocate LPI pending and property table
Hi Andre, Yeah... another round repeating the same things. On 04/03/2017 09:28 PM, Andre Przywara wrote: diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c new file mode 100644 index 0000000..a003a72 --- /dev/null +++ b/xen/arch/arm/gic-v3-lpi.c [...] +#include <xen/lib.h> +#include <xen/mm.h> +#include <xen/sizes.h> +#include <asm/gic.h> +#include <asm/gic_v3_defs.h> +#include <asm/gic_v3_its.h> +#include <asm/io.h> +#include <asm/page.h> + +#define LPI_PROPTABLE_NEEDS_FLUSHING (1U << 0) Newline here. On v2, you said you will rename this variable to max_host_lpi_ids and ... ... this one to MAX_NR_PHYS_LPIS or even MAX_NR_HOST_LPIS to stay consistent. So please do it. The middle ( ... ) are not necessary. [...] [...] + /* Encode the number of bits needed, minus one */ + reg |= (fls(lpi_data.nr_host_lpis - 1) - 1); The outer ( ... ) are not necessary. [...] Coding style: if ( ... ) Again, this should be sanitize. A user could pass max_lpi_bits=10, and I don't think this code will behave well. + lpi_data.nr_host_lpis = BIT_ULL(min(hw_lpi_bits, max_lpi_bits)); Again, nr_host_lpis is "unsigned long" so why are you using BIT_ULL? Looking at the introduction of GENMASK_ULL, it likely means nr_host_lpis should be unsigned long long. + + if ( lpi_data.nr_host_lpis > 16 * 1024 * 1024 ) Hmmm? 16 * 1024 * 1024? Where does it come from? Please add a comment and explain in the commit message. Also, you could make the code more readable and using "16 << 20". + printk(XENLOG_WARNING "Allocating %lu host LPIs, please limit with --max_lpi_bits\n", The command line options on xen does not start with "--". Also the user may have purposefully chosen a value higher than 16 << 20. So this comment seem a big weird. How about: "%lu host LPIs will allocated, to limit memory usage please restrict it with max_lpi_bits.\n". + lpi_data.nr_host_lpis); Please use warning_add, it will gather at the end of the boot. diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h index b2edf95..1f730ce 100644 --- a/xen/include/asm-arm/config.h +++ b/xen/include/asm-arm/config.h @@ -19,6 +19,8 @@ #define BITS_PER_LONG (BYTES_PER_LONG << 3) #define POINTER_ALIGN BYTES_PER_LONG +#define BITS_PER_LONG_LONG (sizeof (long long) * BITS_PER_BYTE) + /* xen_ulong_t is always 64 bits */ #define BITS_PER_XEN_ULONG 64 diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h index 6bd25a5..7cdebc5 100644 --- a/xen/include/asm-arm/gic_v3_defs.h +++ b/xen/include/asm-arm/gic_v3_defs.h @@ -44,7 +44,10 @@ #define GICC_SRE_EL2_ENEL1 (1UL << 3) /* Additional bits in GICD_TYPER defined by GICv3 */ -#define GICD_TYPE_ID_BITS_SHIFT 19 +#define GICD_TYPE_ID_BITS_SHIFT 19 +#define GICD_TYPE_ID_BITS(r) ((((r) >> GICD_TYPE_ID_BITS_SHIFT) & 0x1f) + 1) Please align with the rest. [...] diff --git a/xen/include/asm-arm/gic_v3_its.h b/xen/include/asm-arm/gic_v3_its.h index 7d88987..7c5a2fa 100644 --- a/xen/include/asm-arm/gic_v3_its.h +++ b/xen/include/asm-arm/gic_v3_its.h @@ -76,7 +76,10 @@ void gicv3_its_dt_init(const struct dt_device_node *node); bool gicv3_its_host_has_its(void); -/* Initialize the host structures for the host ITSes. */ +int gicv3_lpi_init_rdist(void __iomem * rdist_base); + +/* Initialize the host structures for LPIs and the host ITSes. */ +int gicv3_lpi_init_host_lpis(unsigned int nr_lpis); Again, in the implementation, the parameter is called "hw_lpi_bits". Please stay consistent. Ditto. You said, you will fix it tomorrow. But for record, this is a new addition in this series and should really be a separate patch with the appropriate maintainers CCed. This should also be a separate patch with BITS_PER_LONG_LONG too. Please take a look at https://patchwork.kernel.org/patch/8824091/ for some suggestion about this. + /* * ffs: find first bit set. This is defined the same way as * the libc and compiler builtin ffs routines, therefore Cheers, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |