[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 8/8] i8259/i8254: migration workaround for timer
From: |
Matthew Ogilvie |
Subject: |
[Qemu-devel] [PATCH v6 8/8] i8259/i8254: migration workaround for timer |
Date: |
Sun, 30 Sep 2012 22:56:38 -0600 |
Signed-off-by: Matthew Ogilvie <address@hidden>
---
It is not at all clear that this is the best way to handle this.
See the detailed notes in the cover letter of this patch series.
UPDATE: Also, some fixes moved the leading edge by 1 CLK
tick (CLK ticks at about 1.1 MHz), and some strategies like this
might risk extra interrupts just from that.
------
hw/i8259.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/hw/i8259.c b/hw/i8259.c
index 1ba9b3a..4b3c6c9 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -153,6 +153,45 @@ static void pic_set_irq(void *opaque, int irq, int level)
s->irr &= ~mask;
s->last_irr &= ~mask;
}
+
+ /* Back-migration compatibility hack:
+ * As of late 2012, the PIT timer model was incorrectly
+ * pulsing the the IRQ0 line high for only a short time to
+ * indicate an interrupt. It counted on a conceptual bug in
+ * the PIC irq model to latch onto and and deliver the
+ * interrupt even after it became low again. (Normally lowering
+ * an IRQ line before it is serviced should cancel the
+ * interrupt.)
+ *
+ * In late 2012 the model has been improved to match hardware
+ * much better by only pulsing low for a short time (in most
+ * PIT modes), but unfortunately that means if you back-migrate
+ * a guest to a version without this fix, the next interrupt
+ * won't have its own leading edge at all, and will
+ * be lost.
+ *
+ * The following hack will allow both the current
+ * interrupt to be serviced properly, and the next one
+ * as well, regardless of which version the migration is
+ * restored on.
+ *
+ * Unfortunately, this has a small possibility of causing
+ * an extra IRQ0 in cases that would not have in the old 2012
+ * model, nor on real hardware. Specifically, if the current
+ * interrupt is processed, and then something causes an
+ * pit_irq_timer_update() to the same high level it was previously
+ * updated with. Re-setting various PIT modes (like 4) could
+ * do this, for example.
+ *
+ * At some point in the future (years from now?),
+ * when back-migration to the old 2012 version is
+ * no longer important, it should be safe to just delete
+ * this hack.
+ */
+ if (irq==0 && s->master) {
+ s->last_irr &= ~1;
+ }
+
pic_update_irq(s);
}
--
1.7.10.2.484.gcd07cc5
- [Qemu-devel] [PATCH v6 0/8] i8254, i8259 and running Microport UNIX (ca 1987), Matthew Ogilvie, 2012/10/01
- [Qemu-devel] [PATCH v6 1/8] fix some debug printf format strings, Matthew Ogilvie, 2012/10/01
- [Qemu-devel] [PATCH v6 2/8] vl: fix -hdachs/-hda argument order parsing issues, Matthew Ogilvie, 2012/10/01
- [Qemu-devel] [PATCH v6 3/8] qemu-options.hx: mention retrace= VGA option, Matthew Ogilvie, 2012/10/01
- [Qemu-devel] [PATCH v6 5/8] i8254: fix inaccuracies in pit_get_out(), Matthew Ogilvie, 2012/10/01
- [Qemu-devel] [PATCH v6 4/8] vga: add some optional CGA compatibility hacks, Matthew Ogilvie, 2012/10/01
- [Qemu-devel] [PATCH v6 6/8] i8259: fix so that dropping IRQ level always clears the interrupt request, Matthew Ogilvie, 2012/10/01
- [Qemu-devel] [PATCH v6 7/8] i8259: refactor pic_set_irq level logic, Matthew Ogilvie, 2012/10/01
- [Qemu-devel] [PATCH v6 8/8] i8259/i8254: migration workaround for timer,
Matthew Ogilvie <=