[xen stable-4.10] xen/arm: vgic: Make sure the number of SPIs is a multiple of 32

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.10] xen/arm: vgic: Make sure the number of SPIs is a multiple of 32

patchbot
commit e3dfd5d1dda9be764273f36e04380a6cd66401bc
Author:     Julien Grall <[hidden email]>
AuthorDate: Fri Feb 16 14:59:56 2018 +0000
Commit:     Stefano Stabellini <[hidden email]>
CommitDate: Fri Mar 2 15:19:13 2018 -0800

    xen/arm: vgic: Make sure the number of SPIs is a multiple of 32
   
    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 <[hidden email]>
    Signed-off-by: Julien Grall <[hidden email]>
    Reviewed-by: Stefano Stabellini <[hidden email]>
    Cc: Jarvis Roach <[hidden email]>
    (cherry picked from commit 23b40df6f098e3bcb2f105a4909860240976e40f)
---
 xen/arch/arm/vgic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index d8acbbe..223030d 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -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;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog