aboutsummaryrefslogtreecommitdiff
path: root/hw/mc146818rtc.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-11-21 19:00:31 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2012-01-13 10:20:50 -0600
commitfbc15e27f760b45c74c9ed7de07d2a7dd13d2034 (patch)
tree4282bdc836608426977169d9540150907c1bda71 /hw/mc146818rtc.c
parent663447d4ead009efd8959fe9f7055398dacd6db4 (diff)
rtc: clear non-PF bits when reinjecting on ack
When an rtc interrupt is reinjected immediately after being acked, other interrupts should not be reinjected, so do clear their bits. Also, if the periodic interrupts have been disabled before acking, do not reinject, as the guest might get very confused! Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/mc146818rtc.c')
-rw-r--r--hw/mc146818rtc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 93ceae70a0..657fa10d6d 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -477,10 +477,13 @@ static uint32_t cmos_ioport_read(void *opaque, uint32_t addr)
case RTC_REG_C:
ret = s->cmos_data[s->cmos_index];
qemu_irq_lower(s->irq);
+ s->cmos_data[RTC_REG_C] = 0x00;
#ifdef TARGET_I386
if(s->irq_coalesced &&
+ (s->cmos_data[RTC_REG_B] & REG_B_PIE) &&
s->irq_reinject_on_ack_count < RTC_REINJECT_ON_ACK_COUNT) {
s->irq_reinject_on_ack_count++;
+ s->cmos_data[RTC_REG_C] |= REG_C_IRQF | REG_C_PF;
apic_reset_irq_delivered();
DPRINTF_C("cmos: injecting on ack\n");
qemu_irq_raise(s->irq);
@@ -489,11 +492,8 @@ static uint32_t cmos_ioport_read(void *opaque, uint32_t addr)
DPRINTF_C("cmos: coalesced irqs decreased to %d\n",
s->irq_coalesced);
}
- break;
}
#endif
-
- s->cmos_data[RTC_REG_C] = 0x00;
break;
default:
ret = s->cmos_data[s->cmos_index];