Skip to contentSkip to conversation

intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs

PATCH Applied Edgar E. Iglesias 4 participants 5 messages Dec 14, 2020 – Jan 7, 2021

lore
Share & tools
lore
#0 lore raw

cover intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs

From: "Edgar E. Iglesias" <[email protected]>

Hi,

Found this while debugging an issue with lockups during boot of Linux on Xen.

In the particular setup, I'm running without EL3 firmware so group0 interrupts are disabled on the physical interface and enabled on the virtual interface.

Looks like we're checking the wrong CPU_CTLR reg for vCPUs. This fixes the problem on my side.

Cheers,
Edgar

Edgar E. Iglesias (1):
intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs

 hw/intc/arm_gic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs

From: "Edgar E. Iglesias" <[email protected]>

Correct the indexing into s->cpu_ctlr for vCPUs.

---
 hw/intc/arm_gic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/intc/arm_gic.c +3 -1
index c60dc6b5e6..af41e2fb44 100644
@@ -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;
     }
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#2 lore raw
Quoted 4 lines · Edgar E. Iglesias

From: "Edgar E. Iglesias" <[email protected]>

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 ;)

Quoted 28 lines
---
 hw/intc/arm_gic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/intc/arm_gic.c +3 -1
index c60dc6b5e6..af41e2fb44 100644
@@ -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;
     }
 
Reviewed-by on v1 1/1
#3 lore raw
In reply to Edgar E. Iglesias
Quoted 5 lines · Edgar E. Iglesias

From: "Edgar E. Iglesias" <[email protected]>

Correct the indexing into s->cpu_ctlr for vCPUs.

Hi Edgar,
Nice catch! Thanks.

Signature · 1 line
Luc
Quoted 27 lines
---
  hw/intc/arm_gic.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
hw/intc/arm_gic.c +3 -1
index c60dc6b5e6..af41e2fb44 100644
@@ -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;
      }
 
#4 lore raw
In reply to Edgar E. Iglesias
Quoted 8 lines · Edgar E. Iglesias

From: "Edgar E. Iglesias" <[email protected]>

Hi,

Found this while debugging an issue with lockups during boot of Linux on Xen.

Quoted 6 lines

In the particular setup, I'm running without EL3 firmware so group0 interrupts are disabled on the physical interface and enabled on the virtual interface.

Looks like we're checking the wrong CPU_CTLR reg for vCPUs. This fixes the problem on my side.

Applied to target-arm.next, thanks.

-- PMM