diff mbox series

[v1,1/1] intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs

Message ID 20201214222154.3480243-2-edgar.iglesias@gmail.com
State New
Headers show
Series intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs | expand

Commit Message

Edgar E. Iglesias Dec. 14, 2020, 10:21 p.m. UTC
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

Correct the indexing into s->cpu_ctlr for vCPUs.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/intc/arm_gic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Dec. 14, 2020, 11:20 p.m. UTC | #1
On 12/14/20 11:21 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Correct the indexing into s->cpu_ctlr for vCPUs.
> 

Fixes: cbe1282b568 ("intc/arm_gic: Implement gic_update_virt() function")

LGTM but better double-check with GIC specialist ;)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/intc/arm_gic.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
> index c60dc6b5e6..af41e2fb44 100644
> --- a/hw/intc/arm_gic.c
> +++ b/hw/intc/arm_gic.c
> @@ -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;
>      }
>  
>
Luc Michel Dec. 15, 2020, 10:28 a.m. UTC | #2
On 12/14/20 11:21 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Correct the indexing into s->cpu_ctlr for vCPUs.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

Hi Edgar,
Nice catch! Thanks.

Reviewed-by: Luc Michel <luc.michel@greensocs.com>
diff mbox series

Patch

diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index c60dc6b5e6..af41e2fb44 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -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;
     }