From: Marcelo Tosatti <mtosa...@redhat.com> 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 <mtosa...@redhat.com> Message-Id: <20191010123008.ga19...@amt.cnet> Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com> --- 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