Skip to contentSkip to conversation

hw/intc/arm_gic: Fix NVIC assertion failure

PATCH In review Peter Maydell 2 participants 2 messages Feb 18, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/intc/arm_gic: Fix NVIC assertion failure

Commit 40d225009ef accidentally changed the behaviour of gic_acknowledge_irq() for the NVIC. The NVIC doesn't have SGIs, so this meant we hit an assertion:
gic_acknowledge_irq: Assertion `s->sgi_pending[irq][cpu] != 0' failed.

Return NVIC acknowledge-irq to its previous behaviour, like 11MPCore.

---
Oops. I think I mentioned that NVIC should behave like 11MPcore in one of the rounds of code review, but then didn't spot that this if() had been missed. We get the checks right elsewhere.

 hw/intc/arm_gic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/arm_gic.c +1 -1
index 93eaa6b..955b8d4 100644
@@ -189,7 +189,7 @@ uint32_t gic_acknowledge_irq(GICState *s, int cpu)
     }
     s->last_active[irq][cpu] = s->running_irq[cpu];
 
-    if (s->revision == REV_11MPCORE) {
+    if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {
         /* Clear pending flags for both level and edge triggered interrupts.
          * Level triggered IRQs will be reasserted once they become inactive.
          */
Signature · 1 line
1.8.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Peter Maydell

Commit 40d225009ef accidentally changed the behaviour of gic_acknowledge_irq() for the NVIC. The NVIC doesn't have SGIs, so this meant we hit an assertion:
gic_acknowledge_irq: Assertion `s->sgi_pending[irq][cpu] != 0' failed.

Quoted 8 lines

Return NVIC acknowledge-irq to its previous behaviour, like 11MPCore.

---
Oops. I think I mentioned that NVIC should behave like 11MPcore in one of the rounds of code review, but then didn't spot that this if() had been missed. We get the checks right elsewhere.

That was my bad entirely. Sorry for missing that one.

Quoted 17 lines
 hw/intc/arm_gic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/arm_gic.c +1 -2
index 93eaa6b..955b8d4 100644
@@ -189,7 +189,7 @@ uint32_t gic_acknowledge_irq(GICState *s, int cpu)
     }
     s->last_active[irq][cpu] = s->running_irq[cpu];
 
-    if (s->revision == REV_11MPCORE) {
+    if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {
         /* Clear pending flags for both level and edge triggered interrupts.
          * Level triggered IRQs will be reasserted once they become inactive.
          */
--
Quoted 2 lines

1.8.5

Thanks for the fix.