From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQF3F-0006Wj-Mn for qemu-devel@nongnu.org; Sat, 28 May 2011 04:39:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQF3E-0001fR-GD for qemu-devel@nongnu.org; Sat, 28 May 2011 04:39:17 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:41381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQF3E-0001fH-2W for qemu-devel@nongnu.org; Sat, 28 May 2011 04:39:16 -0400 Message-ID: <4DE0B4B1.1000407@web.de> Date: Sat, 28 May 2011 10:39:13 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4DDAD5CF.5050805@redhat.com> In-Reply-To: <4DDAD5CF.5050805@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9750A38E870B8DFDD7CCD494" Sender: jan.kiszka@web.de Subject: Re: [Qemu-devel] [PATCH 3/7] cpu model bug fixes and definition corrections: Add kvm emulated x2apic flag to config defined cpu models List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: john cooper Cc: "Roedel, Joerg" , Anthony Liguori , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9750A38E870B8DFDD7CCD494 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-05-23 23:46, john cooper wrote: > Add kvm emulated x2apic flag to config defined cpu models > and general support for such hypervisor emulated flags. >=20 > In addition to checking user request flags against the host > we also selectively check against kvm for emulated flags. As you are already digging through this jungle, could you also check how much of this diff from qemu-kvm is obsolete now? diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index e479a4d..091d812 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -1175,6 +1175,31 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *ecx |=3D 1 << 1; /* CmpLegacy bit */ } } + if (kvm_enabled()) { + uint32_t h_eax, h_edx; + + host_cpuid(index, 0, &h_eax, NULL, NULL, &h_edx); + + /* disable CPU features that the host does not support */ + + /* long mode */ + if ((h_edx & 0x20000000) =3D=3D 0 /* || !lm_capable_kernel *= /) + *edx &=3D ~0x20000000; + /* syscall */ + if ((h_edx & 0x00000800) =3D=3D 0) + *edx &=3D ~0x00000800; + /* nx */ + if ((h_edx & 0x00100000) =3D=3D 0) + *edx &=3D ~0x00100000; + + /* disable CPU features that KVM cannot support */ + + /* svm */ + if (!kvm_nested) + *ecx &=3D ~CPUID_EXT3_SVM; + /* 3dnow */ + *edx &=3D ~0xc0000000; + } break; case 0x80000002: case 0x80000003: If something is still missing in upstream, it should be ported - except for kvm_nested which should be controllable via '-cpu ...,+/-svm'. TIA! J=F6rg, how to deal with -enable-nesting in qemu-kvm to align behavior with upstream? Jan --------------enig9750A38E870B8DFDD7CCD494 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk3gtLEACgkQitSsb3rl5xTcdACgmEaMbKt15yEacIzHIa5DkMW9 ZpMAn1IVRnjCWtrtsp7lpbRO1oAFojze =SE+d -----END PGP SIGNATURE----- --------------enig9750A38E870B8DFDD7CCD494--