From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtcRt-0002C6-DQ for qemu-devel@nongnu.org; Wed, 26 Nov 2014 08:16:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XtcRn-0006iU-N5 for qemu-devel@nongnu.org; Wed, 26 Nov 2014 08:16:01 -0500 Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]:65382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtcRn-0006iM-Eu for qemu-devel@nongnu.org; Wed, 26 Nov 2014 08:15:55 -0500 Received: by mail-wg0-f42.google.com with SMTP id z12so3707325wgg.1 for ; Wed, 26 Nov 2014 05:15:54 -0800 (PST) Sender: Paolo Bonzini Message-ID: <5475D285.6070404@redhat.com> Date: Wed, 26 Nov 2014 14:15:49 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20141126103841.7772.11864.stgit@PASHA-ISP> <20141126103857.7772.52957.stgit@PASHA-ISP> In-Reply-To: <20141126103857.7772.52957.stgit@PASHA-ISP> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v5 02/31] acpi: accurate overflow check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, alex.bennee@linaro.org, afaerber@suse.de, fred.konrad@greensocs.com On 26/11/2014 11:38, Pavel Dovgalyuk wrote: > Compare clock in ns, because acpi_pm_tmr_update uses rounded > to ns value instead of ticks. > > Reviewed-by: Paolo Bonzini > > Signed-off-by: Pavel Dovgalyuk > --- > hw/acpi/core.c | 7 +++++-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/hw/acpi/core.c b/hw/acpi/core.c > index a7368fb..51913d6 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; This is commit 3ef0eab178e5120a0e1c079d163d5c71689d9b71. :) With it, Windows can boot in -icount mode (at least I tested XP). Paolo