From: Kevin O'Connor Subject: Re: [PATCH v2] add acpi pmtimer support Date: Sun, 2 Sep 2012 16:42:43 -0400 Message-ID: <20120902204243.GC1814@morn.localdomain> References: <1344922159-22703-1-git-send-email-kraxel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: seabios@seabios.org, kvm@vger.kernel.org To: Gerd Hoffmann Return-path: Received: from mail-vb0-f46.google.com ([209.85.212.46]:59893 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754598Ab2IBUmp (ORCPT ); Sun, 2 Sep 2012 16:42:45 -0400 Received: by vbbff1 with SMTP id ff1so4757863vbb.19 for ; Sun, 02 Sep 2012 13:42:45 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1344922159-22703-1-git-send-email-kraxel@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Aug 14, 2012 at 07:29:19AM +0200, Gerd Hoffmann wrote: > This patch makes seabios use the acpi pmtimer instead of tsc for > timekeeping. The pmtimer has a fixed frequency and doesn't need > calibration, thus it doesn't suffer from calibration errors due to a > loaded host machine. The patch looks okay to me, but is it still needed? (I recall seeing something on the kvm list about a bug fix to the main timer.) [...] > +static u64 pmtimer_get(void) > +{ > + u16 ioport = GET_GLOBAL(pmtimer_ioport); > + u32 wraps = GET_LOW(pmtimer_wraps); > + u32 pmtimer = inl(ioport); > + > + if (pmtimer < GET_LOW(pmtimer_last)) { > + wraps++; > + SET_LOW(pmtimer_wraps, wraps); > + } > + SET_LOW(pmtimer_last, pmtimer); > + > + dprintf(9, "pmtimer: %u:%u\n", wraps, pmtimer); > + return (u64)wraps << 24 | pmtimer; BTW, why is this "<< 24", and if it should be that way, shouldn't the pmtimer be "inl(ioport) & 0xffffff" ? -Kevin