From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1XwF9c-0002Bj-Ml for mharc-grub-devel@gnu.org; Wed, 03 Dec 2014 14:00:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwF9U-0002B4-Qw for grub-devel@gnu.org; Wed, 03 Dec 2014 13:59:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwF9P-0004T7-CD for grub-devel@gnu.org; Wed, 03 Dec 2014 13:59:52 -0500 Received: from mail-lb0-x232.google.com ([2a00:1450:4010:c04::232]:55846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwF9P-0004Sv-0z for grub-devel@gnu.org; Wed, 03 Dec 2014 13:59:47 -0500 Received: by mail-lb0-f178.google.com with SMTP id f15so13882059lbj.23 for ; Wed, 03 Dec 2014 10:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; bh=HdD80+Liu2+7UfPUnU8pdiGNfd9wk1qPRtuV2vNWJCs=; b=ZIOV4IhSahS1TThNhD31csrBfPTrDexjC9jBz/48QYg/j0my/+P8RW3jS1E0Sms9iu aCxylCf6p3GfyHfcDZEC+vw/8bo55Hb8C2x19I0Bk77rFqW/2nGPer+aCUg39MleXQ+v WepozwbjSa8Axl1J744OYY85g2JFiBhOCrlmQMhL1AiMvyy5oYhaJLYGKyM2f0+v6DLi 9/Ta7Yv2ZPROD23zwpwOZ7zxVtIZjsdEALva3oew0KeP4ZnX8yGYPl6fPwDXnX5NOnA/ UIFXo3NS3BDGbGi2BFItQKAexjGXn5WscBOMWytRrM0yYy1/cFbKPH0UV2hcC/fiDQFz amBg== X-Received: by 10.152.21.167 with SMTP id w7mr5772140lae.70.1417633185054; Wed, 03 Dec 2014 10:59:45 -0800 (PST) Received: from opensuse.site (ppp91-76-15-25.pppoe.mtu-net.ru. [91.76.15.25]) by mx.google.com with ESMTPSA id wv5sm1403325lbb.20.2014.12.03.10.59.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Dec 2014 10:59:44 -0800 (PST) Date: Wed, 3 Dec 2014 21:59:42 +0300 From: Andrei Borzenkov To: Vladimir =?UTF-8?B?J8+GLWNvZGVyL3BoY29kZXIn?= Serbinenko Subject: Re: [PATCH] calibrate_tsc(): use the Stall() EFI boot service on GRUB_MACHINE_EFI Message-ID: <20141203215942.38e0ecc4@opensuse.site> In-Reply-To: <5478CC2A.30505@gmail.com> References: <1416992361-4167-1-git-send-email-lersek@redhat.com> <5478CC2A.30505@gmail.com> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.25; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/+ZFgP_Gn0xLDfr7N/0cMl8p"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::232 Cc: The development of GNU GRUB X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2014 18:59:58 -0000 --Sig_/+ZFgP_Gn0xLDfr7N/0cMl8p Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Fri, 28 Nov 2014 21:25:30 +0200 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > On 26.11.2014 10:59, Laszlo Ersek wrote: > > HyperV Gen2 virtual machines have no PIT; guest code should rely on UEFI > > services instead. > >=20 > > RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=3D1150698 > > RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=3D1160128 > > Signed-off-by: Laszlo Ersek > I don't like to be using any additional EFI function. I prefer to use > pmtimer as I did in my other patch. Is pmtimer available on hyperv? It was tested on Hyper-V v2 in https://savannah.gnu.org/bugs/?42944. I have no idea if it is available on Hyper-V v1. > > --- > >=20 > > Notes: > > Please note that I'm not subscribed to the list. > >=20 > > grub-core/kern/i386/tsc.c | 20 ++++++++++++++++---- > > 1 file changed, 16 insertions(+), 4 deletions(-) > >=20 > > diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c > > index 3a4cae6..e499648 100644 > > --- a/grub-core/kern/i386/tsc.c > > +++ b/grub-core/kern/i386/tsc.c > > @@ -26,9 +26,14 @@ > > #include > > #include > > #ifdef GRUB_MACHINE_XEN > > -#include > > +# include > > #else > > -#include > > +# ifdef GRUB_MACHINE_EFI > > +# include > > +# include > > +# else > > +# include > > +# endif > > #endif > > #include > > =20 > > @@ -72,8 +77,14 @@ grub_cpu_is_tsc_supported (void) > > #ifndef GRUB_MACHINE_XEN > > =20 > > static void > > -grub_pit_wait (grub_uint16_t tics) > > +grub_stall (grub_uint16_t tics) > > { > > +# ifdef GRUB_MACHINE_EFI > > + grub_uint64_t microseconds; > > + > > + microseconds =3D (grub_uint64_t)tics * 1000 * 1000 * 3 / 3579545; > > + efi_call_1 (grub_efi_system_table->boot_services->stall, microsecond= s); > > +# else > > /* Disable timer2 gate and speaker. */ > > grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT) > > & ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2), > > @@ -97,6 +108,7 @@ grub_pit_wait (grub_uint16_t tics) > > grub_outb (grub_inb (GRUB_PIT_SPEAKER_PORT) > > & ~ (GRUB_PIT_SPK_DATA | GRUB_PIT_SPK_TMR2), > > GRUB_PIT_SPEAKER_PORT); > > +# endif > > } > > #endif > > =20 > > @@ -119,7 +131,7 @@ calibrate_tsc (void) > > grub_uint64_t end_tsc; > > =20 > > tsc_boot_time =3D grub_get_tsc (); > > - grub_pit_wait (0xffff); > > + grub_stall (0xffff); > > end_tsc =3D grub_get_tsc (); > > =20 > > grub_tsc_rate =3D grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_t= ime, 0); > >=20 >=20 >=20 --Sig_/+ZFgP_Gn0xLDfr7N/0cMl8p Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlR/XZ4ACgkQR6LMutpd94w+VgCg0/YKcKonjQPMZr5pL5DIrUnP q9gAoJMDjOdW7Ymz4lIBfTlua2ko4soo =OHSL -----END PGP SIGNATURE----- --Sig_/+ZFgP_Gn0xLDfr7N/0cMl8p--