Recover from an interupt flood by propagating the end of interrupt state. Signed-off-by: Jason Wessel --- hw/apic.c | 23 +++++++++++++++++++++-- hw/pc.c | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) Index: qemu/hw/apic.c =================================================================== --- qemu.orig/hw/apic.c +++ qemu/hw/apic.c @@ -332,6 +332,26 @@ static void apic_set_irq(APICState *s, i apic_update_irq(s); } +struct IOAPICState *ioapic; +/* XXX Multi IOAPIC support */ +static void apic_propogate_eoi(int vector) { + uint32_t irr; + int pin; + + if ((vector < 0x10) || (vector > 0xfe)) + return; + + irr = ioapic->irr; + while (irr) { + pin = ffs_bit(irr); + irr &= ~(1 << pin); + if ((ioapic->ioredtbl[pin] & 0xff) == vector) { + ioapic->irr &= ~(1 << pin); + break; + } + } +} + static void apic_eoi(APICState *s) { int isrv; @@ -339,8 +359,7 @@ static void apic_eoi(APICState *s) if (isrv < 0) return; reset_bit(s->isr, isrv); - /* XXX: send the EOI packet to the APIC bus to allow the I/O APIC to - set the remote IRR bit for level triggered interrupts. */ + apic_propogate_eoi(isrv); apic_update_irq(s); } Index: qemu/hw/pc.c =================================================================== --- qemu.orig/hw/pc.c +++ qemu/hw/pc.c @@ -36,7 +36,7 @@ static fdctrl_t *floppy_controller; static RTCState *rtc_state; static PITState *pit; -static IOAPICState *ioapic; +extern IOAPICState *ioapic; static PCIDevice *i440fx_state; static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)