[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 3/3] mc146818rtc: fix timer interrupt reinjection
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 3/3] mc146818rtc: fix timer interrupt reinjection |
Date: |
Thu, 24 Oct 2019 14:24:25 +0200 |
From: Marcelo Tosatti <address@hidden>
commit 369b41359af46bded5799c9ef8be2b641d92e043 broke timer interrupt
reinjection when there is no period change by the guest.
In that case, old_period is 0, which ends up zeroing irq_coalesced
(counter of reinjected interrupts).
The consequence is Windows 7 is unable to synchronize time via NTP.
Easily reproducible by playing a fullscreen video with cirrus and VNC.
Fix by not updating s->irq_coalesced when old_period is 0.
Signed-off-by: Marcelo Tosatti <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/timer/mc146818rtc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 8da7fd1a50..adbc3b9d57 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -224,7 +224,6 @@ periodic_timer_update(RTCState *s, int64_t current_time,
uint32_t old_period)
last_periodic_clock = next_periodic_clock - old_period;
lost_clock = cur_clock - last_periodic_clock;
assert(lost_clock >= 0);
- }
/*
* s->irq_coalesced can change for two reasons:
@@ -261,6 +260,7 @@ periodic_timer_update(RTCState *s, int64_t current_time,
uint32_t old_period)
*/
lost_clock = MIN(lost_clock, period);
}
+ }
assert(lost_clock >= 0 && lost_clock <= period);
--
2.21.0