[v2] xen/arm: Cap the number of interrupt lines for dom0
diff mbox series

Message ID abc8ea85-fe26-46b6-af1a-dcaaa877fd7d@rwthex-w1-a.rwth-ad.de
State New, archived
Headers show
Series
  • [v2] xen/arm: Cap the number of interrupt lines for dom0
Related show

Commit Message

Lukas Juenger April 5, 2019, 1:54 p.m. UTC
Dom0 vGIC will use the same number of interrupt lines as the hardware GIC.
While the hardware GIC can support up to 1020 interrupt lines,
the vGIC is only supporting up to 992 interrupt lines.
This means that Xen will not be able to boot on platforms where the hardware
GIC supports more than 992 interrupt lines.
While it would make sense to increase the limits in the vGICs, this is not
trivial because of the design choices.
At the moment, only models seem to report the maximum of interrupt lines.
They also do not have any interrupt wired above the 992 limit.
So it should be fine to cap the number of interrupt lines for dom0 to 992 lines.

Signed-off-by: Lukas Juenger <juenger@ice.rwth-aachen.de>

---
Changed since v1:
- Adapted commit message as suggested
- Changed code comment to reflect correct terminology
---
 xen/arch/arm/setup.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Julien Grall April 8, 2019, 10:15 a.m. UTC | #1
Hi Lukas,

On 4/5/19 2:54 PM, Lukas Juenger wrote:
> Dom0 vGIC will use the same number of interrupt lines as the hardware GIC.
> While the hardware GIC can support up to 1020 interrupt lines,
> the vGIC is only supporting up to 992 interrupt lines.
> This means that Xen will not be able to boot on platforms where the hardware
> GIC supports more than 992 interrupt lines.
> While it would make sense to increase the limits in the vGICs, this is not
> trivial because of the design choices.
> At the moment, only models seem to report the maximum of interrupt lines.
> They also do not have any interrupt wired above the 992 limit.
> So it should be fine to cap the number of interrupt lines for dom0 to 992 lines.
> 
> Signed-off-by: Lukas Juenger <juenger@ice.rwth-aachen.de>

Acked-by: Julien Grall <julien.grall@arm.com>

Cheers,
Julien Grall April 8, 2019, 10:24 a.m. UTC | #2
On 4/8/19 11:15 AM, Julien Grall wrote:
> Hi Lukas,
> 
> On 4/5/19 2:54 PM, Lukas Juenger wrote:
>> Dom0 vGIC will use the same number of interrupt lines as the hardware 
>> GIC.
>> While the hardware GIC can support up to 1020 interrupt lines,
>> the vGIC is only supporting up to 992 interrupt lines.
>> This means that Xen will not be able to boot on platforms where the 
>> hardware
>> GIC supports more than 992 interrupt lines.
>> While it would make sense to increase the limits in the vGICs, this is 
>> not
>> trivial because of the design choices.
>> At the moment, only models seem to report the maximum of interrupt lines.
>> They also do not have any interrupt wired above the 992 limit.
>> So it should be fine to cap the number of interrupt lines for dom0 to 
>> 992 lines.
>>
>> Signed-off-by: Lukas Juenger <juenger@ice.rwth-aachen.de>
> 
> Acked-by: Julien Grall <julien.grall@arm.com>

Now pushed.

Cheers,

Patch
diff mbox series

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 444857a967..ccb0f181ea 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 interrupt 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);