diff mbox series

arm/dom0: Add check for maximum number of supported vGIC IRQs

Message ID 1553614518-16421-1-git-send-email-juenger@ice.rwth-aachen.de (mailing list archive)
State Superseded
Headers show
Series arm/dom0: Add check for maximum number of supported vGIC IRQs | expand

Commit Message

Lukas Juenger March 26, 2019, 3:35 p.m. UTC
Xen's vGIC implementation supports a maximum number of 992 IRQ lines.
GICv2 specification allows for 1020 IRQ lines.
This commit adds a check for this discrepancy.

Signed-off-by: Lukas Juenger (juenger@ice.rwth-aachen.de)
---
 xen/arch/arm/setup.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 444857a..37b3648 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -888,7 +888,13 @@  void __init start_xen(unsigned long boot_phys_offset,
     /* Create initial domain 0. */
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
     dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
-    dom0_cfg.arch.nr_spis = gic_number_lines() - 32;
+    /*
+     * Xen vGIC supports a maximum of 992 IRQ lines.
+     * 32 are substracted to cover local IRQs.
+     */
+    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
+    if ( gic_number_lines() > 992 )
+        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
     dom0_cfg.max_vcpus = dom0_max_vcpus();
 
     dom0 = domain_create(0, &dom0_cfg, true);