[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 05/10] i8259: fix so that dropping IRQ level alwa
From: |
Matthew Ogilvie |
Subject: |
[Qemu-devel] [PATCH v7 05/10] i8259: fix so that dropping IRQ level always clears the interrupt request |
Date: |
Sun, 25 Nov 2012 14:51:41 -0700 |
Intel's definition of "edge triggered" means: "asserted with a
low-to-high transition at the time an interrupt is registered and
then kept high until the interrupt is served via one of the
EOI mechanisms or goes away unhandled."
So the only difference between edge triggered and level triggered
is in the leading edge, with no difference in the trailing edge.
This bug manifested itself when the guest was Microport UNIX
System V/386 v2.1 (ca. 1987), because it would sometimes mask
off IRQ14 in the slave IMR after it had already been asserted.
The master would still try to deliver an interrupt even though
IRQ2 had dropped again, resulting in a spurious interupt
(IRQ15) and a panicked kernel.
Output from a test program:
-----------
Real hardware [Pentium 4]:
cmdRead unmask IRR=4005 mask IRR=4001 sti unmask irq14 IRR=0001 DONE
[I also see a final IRR=0000 occasionally. Probably just happened to
ask it while the timer (IRQ0) line is low. It masks off most IRQ's, including
timer.]
-----------
Unpatched qemu:
cmdRead unmask IRR=4015 mask IRR=4015 sti irq15 unmask IRR=4015 DONE
[Presumably IRQ4 (0x10 - qemu's serial device model?) had a transient
edge during initialization, but had been masked off even before I
masked it off?]
-----------
Patched qemu:
cmdRead unmask IRR=4005 mask IRR=4001 sti unmask irq14 IRR=0001 DONE
-----------
Signed-off-by: Matthew Ogilvie <address@hidden>
---
hw/i8259.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/i8259.c b/hw/i8259.c
index 60c25ba..95587cd 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -157,6 +157,7 @@ static void pic_set_irq(void *opaque, int irq, int level)
}
s->last_irr |= mask;
} else {
+ s->irr &= ~mask;
s->last_irr &= ~mask;
}
}
--
1.7.10.2.484.gcd07cc5
- [Qemu-devel] [PATCH v7 00/10] i8254, i8259 and running Microport UNIX (ca 1987), Matthew Ogilvie, 2012/11/25
- [Qemu-devel] [PATCH v7 01/10] fix some debug printf format strings, Matthew Ogilvie, 2012/11/25
- [Qemu-devel] [PATCH v7 05/10] i8259: fix so that dropping IRQ level always clears the interrupt request,
Matthew Ogilvie <=
- [Qemu-devel] [PATCH v7 07/10] i8254/i8259: workaround to make IRQ0 work like before, Matthew Ogilvie, 2012/11/25
- [Qemu-devel] [PATCH v7 02/10] vl: fix -hdachs/-hda argument order parsing issues, Matthew Ogilvie, 2012/11/25
- [Qemu-devel] [PATCH v7 08/10] i8254: add comments about fixing timings, Matthew Ogilvie, 2012/11/25
- [Qemu-devel] [PATCH v7 03/10] qemu-options.hx: mention retrace= VGA option, Matthew Ogilvie, 2012/11/25
- [Qemu-devel] [PATCH v7 04/10] vga: add some optional CGA compatibility hacks, Matthew Ogilvie, 2012/11/25
- [Qemu-devel] [PATCH v7 06/10] i8259: refactor pic_set_irq level logic, Matthew Ogilvie, 2012/11/25
- [Qemu-devel] [PATCH v7 09/10] i8254: prepare for migration compatibility with future fixes, Matthew Ogilvie, 2012/11/25
- [Qemu-devel] [PATCH v7 10/10] FOR FUTURE: fix i8254/i8259 IRQ0 line logic, Matthew Ogilvie, 2012/11/25