]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
xen/arm: vgic: Make sure the number of SPIs is a multiple of 32
authorJulien Grall <julien.grall@arm.com>
Fri, 16 Feb 2018 14:59:56 +0000 (14:59 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 21 Feb 2018 01:06:19 +0000 (17:06 -0800)
The vGIC relies on having a pending_irq available for every IRQs
described in the ranks. As each rank describes 32 interrupts, we need to
make sure the number of SPIs is a multiple of 32.

Reported-by: Jeff Kubascik <Jeff.Kubascik@dornerworks.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Cc: Jarvis Roach <Jarvis.Roach@dornerworks.com>
xen/arch/arm/vgic.c

index 9921769b15a71c253c32bf66455684d4dcd02bf8..34269bcf27f847d5954d196abdcb0a6cd12c487c 100644 (file)
@@ -123,6 +123,13 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis)
 
     d->arch.vgic.ctlr = 0;
 
+    /*
+     * The vGIC relies on having a pending_irq available for every IRQ
+     * described in the ranks. As each rank describes 32 interrupts, we
+     * need to make sure the number of SPIs is a multiple of 32.
+     */
+    nr_spis = ROUNDUP(nr_spis, 32);
+
     /* Limit the number of virtual SPIs supported to (1020 - 32) = 988  */
     if ( nr_spis > (1020 - NR_LOCAL_IRQS) )
         return -EINVAL;