|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 4/4] xen/arm: its: pre-initialize ITS quirks before LPI setup
On 3/25/26 12:38, Mykola Kvach wrote: Hello Mykola From: Mykola Kvach <mykola_kvach@xxxxxxxx> In the current initialization flow, gicv3_init() calls gicv3_dist_init() before gicv3_its_init(). When LPIs are supported, gicv3_dist_init() calls gicv3_lpi_init_host_lpis(), which initializes host LPI state and allocates the boot CPU pending table before ITS quirk flags are computed. Non-boot CPUs allocate their pending tables later from the CPU_UP_PREPARE notifier, while redistributor LPI programming happens separately in gicv3_lpi_init_rdist(). This means the boot CPU LPI setup can observe default ITS memory attributes before dma-noncoherent and other ITS quirks are applied. Introduce gicv3_its_preinit() and call it before gicv3_dist_init(). This keeps the actual ITS hardware initialization in gicv3_its_init(), but moves ITS discovery, quirk validation and quirk flag setup early enough for the subsequent LPI initialization to use the correct attributes. Have you considered an alternative approach that might be less invasive? I am thinking of something the other way around: perhaps we could allocate the LPI pending table for the boot CPU later. Would a diff below work? --- xen/arch/arm/gic-v3-lpi.c | 9 +++++++++ xen/arch/arm/gic-v3.c | 2 ++ xen/arch/arm/include/asm/gic_v3_its.h | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c index 9ee338edc2..61cc45d347 100644 --- a/xen/arch/arm/gic-v3-lpi.c +++ b/xen/arch/arm/gic-v3-lpi.c@@ -450,6 +450,15 @@ int gicv3_lpi_init_host_lpis(unsigned int host_lpi_bits) printk("GICv3: using at most %lu LPIs on the host.\n", MAX_NR_HOST_LPIS);
+ return rc;
+}
+
+int gicv3_lpi_post_init_host_lpis(void)
+{
+ int rc;
+
+ ASSERT(smp_processor_id() == 0);
+
/* Register the CPU notifier and allocate memory for the boot CPU */
register_cpu_notifier(&cpu_nfb);
rc = gicv3_lpi_allocate_pendtable(smp_processor_id());
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 7f365cdbe9..8b9059c5c9 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1981,6 +1981,8 @@ static int __init gicv3_init(void)
res = gicv3_its_init();
if ( res )
panic("GICv3: ITS: initialization failed: %d\n", res);
+
+ gicv3_lpi_post_init_host_lpis();
}
res = gicv3_cpu_init();
diff --git a/xen/arch/arm/include/asm/gic_v3_its.h
b/xen/arch/arm/include/asm/gic_v3_its.h
index fc5a84892c..288cc1d42f 100644 --- a/xen/arch/arm/include/asm/gic_v3_its.h +++ b/xen/arch/arm/include/asm/gic_v3_its.h @@ -156,6 +156,7 @@ 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 host_lpi_bits); +int gicv3_lpi_post_init_host_lpis(void); int gicv3_its_init(void);/* Store the physical address and ID for each redistributor as read from DT. */ @@ -245,6 +246,11 @@ static inline int gicv3_lpi_init_host_lpis(unsigned int host_lpi_bits)
return 0;
}
+static inline int gicv3_lpi_post_init_host_lpis(void)
+{
+ return 0;
+}
+
static inline int gicv3_its_init(void)
{
return 0;
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |