From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQMFs-000323-Vb for qemu-devel@nongnu.org; Sat, 28 May 2011 12:20:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQMFr-0001d8-KT for qemu-devel@nongnu.org; Sat, 28 May 2011 12:20:48 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:37754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQMFr-0001d3-6B for qemu-devel@nongnu.org; Sat, 28 May 2011 12:20:47 -0400 Message-ID: <4DE120BE.1010602@web.de> Date: Sat, 28 May 2011 18:20:14 +0200 From: Jan Kiszka MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig8F4ED94612BCF38296F9DF58" Sender: jan.kiszka@web.de Subject: Re: [Qemu-devel] [PATCH uq/master V2] kvm: Add CPUID support for VIA CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: BrillyWu Cc: karyjin@viatech.com.cn, kvm@vger.kernel.org, mst@redhat.com, mtosatti@redhat.com, "BrillyWu@viatech.com.cn" , qemu-devel@nongnu.org, avi@redhat.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8F4ED94612BCF38296F9DF58 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-05-10 10:02, BrillyWu wrote: > From: BrillyWu >=20 > When KVM is running on VIA CPU with host cpu's model, the > feautures of VIA CPU will be passed into kvm guest by calling > the CPUID instruction for Centaur. >=20 > Signed-off-by: BrillyWu > Signed-off-by: KaryJin =2E.. > @@ -855,6 +870,8 @@ int cpu_x86_register (CPUX86State *env, > env->cpuid_xlevel =3D def->xlevel; > env->cpuid_kvm_features =3D def->kvm_features; > env->cpuid_svm_features =3D def->svm_features; > + env->cpuid_ext4_features =3D def->ext4_features; > + env->cpuid_xlevel2 =3D def->xlevel2; > if (!kvm_enabled()) { > env->cpuid_features &=3D TCG_FEATURES; > env->cpuid_ext_features &=3D TCG_EXT_FEATURES; > @@ -1034,7 +1051,12 @@ void cpu_x86_cpuid(CPUX86State *env, uin > uint32_t *ecx, uint32_t *edx) > { > /* test if maximum index reached */ > - if (index & 0x80000000) { > + if ((index & 0xC000000f) =3D=3D index) { This condition can't be correct. It triggers on every index <=3D 15 and breaks qemu. > + /* Handle the Centaur's CPUID instruction. */ > + if (index > env->cpuid_xlevel2) { > + index =3D env->cpuid_xlevel2; > + } > + } else if (index & 0x80000000) { Your very first version looked like this: - if (index & 0x80000000) { + if ((index & 0xC0000000) =3D=3D 0xC0000000) { + /* Handle the Centaur's CPUID instruction.* + * If cpuid_xlevel2 is "0", then put into the* + * default case. */ + if (env->cpuid_xlevel2 =3D=3D 0) + index =3D 0xF0000000; + else if (index > env->cpuid_xlevel2) + index =3D env->cpuid_xlevel2; + } else if (index & 0x80000000) { Something went wrong here, please re-validate the patch carefully. Jan --------------enig8F4ED94612BCF38296F9DF58 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/ iEYEARECAAYFAk3hIL4ACgkQitSsb3rl5xRlhgCgunNKERWzILMelzIUXEv4Kd2a OBgAn3lU6XztdDq7q7mp6V5av2yf6yq5 =n7ip -----END PGP SIGNATURE----- --------------enig8F4ED94612BCF38296F9DF58--