hw/intc/arm_gic: Fix GIC_SET_LEVEL
PATCH 1/1 hw/intc/arm_gic: Fix GIC_SET_LEVEL
The GIC_SET_LEVEL macro unfortunately overwrote the entire level bitmask instead of just or'ing on the necessary bits, causing active level PPIs on a core to clear PPIs on other cores.
I introduced this bug, sorry about that.
--- hw/intc/gic_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/gic_internal.h +1 -1
@@ -40,7 +40,7 @@#define GIC_SET_MODEL (irq) s->irq_state[irq].model = true#define GIC_CLEAR_MODEL (irq) s->irq_state[irq].model = false#define GIC_TEST_MODEL (irq) s->irq_state[irq].model -#define GIC_SET_LEVEL (irq, cm) s->irq_state[irq].level = (cm) +#define GIC_SET_LEVEL (irq, cm) s->irq_state[irq].level |= (cm)#define GIC_CLEAR_LEVEL (irq, cm) s->irq_state[irq].level &= ~(cm)#define GIC_TEST_LEVEL (irq, cm) ((s->irq_state[irq].level & (cm)) != 0)#define GIC_SET_EDGE_TRIGGER (irq) s->irq_state[irq].edge_trigger = true
Signature · 1 line
1.8.5.2
Quoted 6 lines · Christoffer Dall
The
GIC_SET_LEVELmacro unfortunately overwrote the entire level bitmask instead of just or'ing on the necessary bits, causing active level PPIs on a core to clear PPIs on other cores.I introduced this bug, sorry about that.
Actually it turns out this was ancient, I was a little too quick to blame myself there.
-Christoffer
Peter Maydell
Reviewed-byQuoted 9 lines · Christoffer Dall
Quoted 6 lines · Christoffer Dall
The
GIC_SET_LEVELmacro unfortunately overwrote the entire level bitmask instead of just or'ing on the necessary bits, causing active level PPIs on a core to clear PPIs on other cores.I introduced this bug, sorry about that.
Actually it turns out this was ancient, I was a little too quick to blame myself there.
Yes, it's been present since 2007 or so. Probably not noticed at that time because all the 11MPcore PPIs are edge rather than level triggered.
I'll remove the line about it being your fault when I apply this to target-arm.next :-)
thanks
-- PMM