xen/arm: gicv3: initialize eSPI unconditionally

Since the firmware may initialize eSPIs before Xen, and without
CONFIG_GICV3_ESPI enabled, Xen would not reinitialize them properly
during boot. In such cases, once the GIC is re-enabled in Xen,
interrupts may be received that cannot be handled.

To ensure proper operation on hardware with eSPI feature, even when the eSPI
config is disabled, gicv3_dist_espi_common_init() should be invoked
regardless of whether CONFIG_GICV3_ESPI is enabled or not. This will not
affect hardware without eSPI support, as the function checks if the
hardware supports eSPIs by reading the GICD_TYPER.ESPI field (using
GICD_TYPER_ESPIS_NUM macro), which indicates whether the extended SPI
range is supported. If the hardware does not support eSPI, the function
will not perform any actions.

There are no functional changes for setups where CONFIG_GICV3_ESPI=y.

Suggested-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
Acked-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
Leonid Komarianskyi authored and Michal Orzel committed 2026-10-06 12:19:31 +02:00
1 parent 671168282b
commit 63d0e8cc84
2 files changed
+17 -17

No files matched your search

+17 -15
View File
@@ -703,17 +703,32 @@ unsigned int gic_number_espis(void)
return gic_hw_ops->info->nr_espi;
}
static void __init gicv3_dist_espi_init_aff(uint64_t affinity)
{
unsigned int i;
for ( i = 0; i < gicv3_info.nr_espi; i++ )
writeq_relaxed_non_atomic(affinity, GICD + GICD_IROUTERnE + i * 8);
}
#else
static void __init gicv3_dist_espi_init_aff(uint64_t affinity) { }
#endif
static void __init gicv3_dist_espi_common_init(uint32_t type)
{
unsigned int espi_nr, i;
espi_nr = min(1024U, GICD_TYPER_ESPIS_NUM(type));
#ifdef CONFIG_GICV3_ESPI
gicv3_info.nr_espi = espi_nr;
#endif
/* The GIC HW doesn't support eSPI, so we can leave from here */
if ( gicv3_info.nr_espi == 0 )
if ( espi_nr == 0 )
return;
printk("GICv3: %u eSPI lines\n", gicv3_info.nr_espi);
if ( IS_ENABLED(CONFIG_GICV3_ESPI) )
printk("GICv3: %u eSPI lines\n", espi_nr);
/* The configuration for eSPIs is similar to that for regular SPIs */
for ( i = 0; i < espi_nr; i += 16 )
@@ -733,19 +748,6 @@ static void __init gicv3_dist_espi_common_init(uint32_t type)
writel_relaxed(GENMASK(31, 0), GICD + GICD_IGROUPRnE + (i / 32) * 4);
}
static void __init gicv3_dist_espi_init_aff(uint64_t affinity)
{
unsigned int i;
for ( i = 0; i < gicv3_info.nr_espi; i++ )
writeq_relaxed_non_atomic(affinity, GICD + GICD_IROUTERnE + i * 8);
}
#else
static void __init gicv3_dist_espi_common_init(uint32_t type) { }
static void __init gicv3_dist_espi_init_aff(uint64_t affinity) { }
#endif
static void __init gicv3_dist_init(void)
{
uint32_t type;
-2
View File
@@ -63,7 +63,6 @@
#define GICD_IROUTERnE (0x8000)
#define GICD_IROUTERnEN (0x9FFC)
#ifdef CONFIG_GICV3_ESPI
#define GICD_TYPER_ESPI_SHIFT 8
#define GICD_TYPER_ESPI_RANGE_SHIFT 27
#define GICD_TYPER_ESPI_RANGE_MASK (0x1F)
@@ -73,7 +72,6 @@
#define GICD_TYPER_ESPIS_NUM(typer) \
(((typer) & GICD_TYPER_ESPI) ? \
GICD_TYPER_ESPI_RANGE((typer) >> GICD_TYPER_ESPI_RANGE_SHIFT) : 0)
#endif
/* Common between GICD_PIDR2 and GICR_PIDR2 */
#define GIC_PIDR2_ARCH_MASK (0xf0)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.