aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>2014-11-07 13:31:33 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2014-11-13 16:13:28 +0100
commit3ef0eab178e5120a0e1c079d163d5c71689d9b71 (patch)
tree478e4973d18cd8a05f53a23b9f28b1f5bd6de98d /hw
parentf4ec5cd29d1f0d3a265039767399d2cf3e75950b (diff)
acpi: accurate overflow check
Compare clock in ns, because acpi_pm_tmr_update uses rounded to ns value instead of ticks. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> [This lets Windows boot in icount mode. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/acpi/core.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index a7368fb242..51913d6932 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -376,8 +376,11 @@ static void acpi_notify_wakeup(Notifier *notifier, void *data)
/* ACPI PM1a EVT */
uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar)
{
- int64_t d = acpi_pm_tmr_get_clock();
- if (d >= ar->tmr.overflow_time) {
+ /* Compare ns-clock, not PM timer ticks, because
+ acpi_pm_tmr_update function uses ns for setting the timer. */
+ int64_t d = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+ if (d >= muldiv64(ar->tmr.overflow_time,
+ get_ticks_per_sec(), PM_TIMER_FREQUENCY)) {
ar->pm1.evt.sts |= ACPI_BITMASK_TIMER_STATUS;
}
return ar->pm1.evt.sts;