@@ -175,10 +180,15 @@ uint32_t gic_acknowledge_irq(GICState *s, int cpu)
return 1023;
}
s->last_active[new_irq][cpu] = s->running_irq[cpu];
- /* Clear pending flags for both level and edge triggered interrupts.
- Level triggered IRQs will be reasserted once they become inactive. */
- gic_clear_pending(s, new_irq, GIC_TEST_MODEL(new_irq) ? ALL_CPU_MASK : cm,
- GIC_SGI_SRC(new_irq, cpu));
+ /* Clear pending flags for edge-triggered and non-asserted level-triggered
+ * interrupts.
+ */
+ cm = GIC_TEST_MODEL(new_irq) ? ALL_CPU_MASK : cm;
+ if (GIC_TEST_TRIGGER(new_irq) || !GIC_TEST_LEVEL(new_irq, cm)) {
+ gic_clear_pending(s, new_irq, cm, GIC_SGI_SRC(new_irq, cpu));
+ }
+
gic_set_running_irq(s, cpu, new_irq);
DPRINTF("ACK %d\n", new_irq);
return new_irq;