From: Jan Kiszka Date: Sat, 9 Apr 2011 11:18:59 +0000 (+0200) Subject: ioapic: Do not set irr for masked edge IRQs X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=47f7be394aa7baf7855fe78f56b8ba4c69bf75d9;p=qemu.git ioapic: Do not set irr for masked edge IRQs So far we set IRR for edge IRQs even if the pin is masked. If the guest later on unmasks and switches the pin to level-triggered mode, irr will remain set, causing an IRQ storm. The point is that setting IRR is not correct in this case according to the spec, and avoiding this resolves the issue. Reported-and-tested-by: Isaku Yamahata Signed-off-by: Jan Kiszka Signed-off-by: Aurelien Jarno --- diff --git a/hw/ioapic.c b/hw/ioapic.c index 569327d1e9..6c26e820e0 100644 --- a/hw/ioapic.c +++ b/hw/ioapic.c @@ -160,8 +160,9 @@ static void ioapic_set_irq(void *opaque, int vector, int level) s->irr &= ~mask; } } else { - /* edge triggered */ - if (level) { + /* According to the 82093AA manual, we must ignore edge requests + * if the input pin is masked. */ + if (level && !(entry & IOAPIC_LVT_MASKED)) { s->irr |= mask; ioapic_service(s); }