intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs
authorEdgar E. Iglesias <edgar.iglesias@xilinx.com>
Mon, 14 Dec 2020 22:21:54 +0000 (23:21 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 8 Jan 2021 15:13:37 +0000 (15:13 +0000)
Correct the indexing into s->cpu_ctlr for vCPUs.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20201214222154.3480243-2-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/intc/arm_gic.c

index c60dc6b5e6e519e61b20dda66c7b50660b2a7773..af41e2fb44840798e4c9321a8ddb72dc5b289505 100644 (file)
@@ -141,6 +141,8 @@ static inline void gic_get_best_virq(GICState *s, int cpu,
 static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt,
                                     int group_mask)
 {
+    int cpu_iface = virt ? (cpu + GIC_NCPU) : cpu;
+
     if (!virt && !(s->ctlr & group_mask)) {
         return false;
     }
@@ -149,7 +151,7 @@ static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt,
         return false;
     }
 
-    if (!(s->cpu_ctlr[cpu] & group_mask)) {
+    if (!(s->cpu_ctlr[cpu_iface] & group_mask)) {
         return false;
     }