From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: Re: [PATCH uq/master V2] kvm: Add CPUID support for VIA CPU Date: Mon, 30 May 2011 12:02:12 +0800 Message-ID: References: <4DE120BE.1010602@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: KaryJin@viatech.com.cn, kvm@vger.kernel.org, mst@redhat.com, mtosatti@redhat.com, qemu-devel@nongnu.org, avi@redhat.com To: , Return-path: Content-class: urn:content-classes:message In-Reply-To: <4DE120BE.1010602@web.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org Hi, Jan >=20 > > @@ -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) { >=20 > This condition can't be correct. It triggers on every index <=3D 15 = and=20 > breaks qemu. I'm so sorry to make such a stupid mistake. Thank you very for your = revieview. >=20 > > + /* Handle the Centaur's CPUID instruction. */ > > + if (index > env->cpuid_xlevel2) { > > + index =3D env->cpuid_xlevel2; > > + } > > + } else if (index & 0x80000000) { >=20 > Your very first version looked like this: The first version has some problem, so you could ignore it. >=20 > - 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) { >=20 > Something went wrong here, please re-validate the patch carefully. Ok, I will check it soon.=20 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQtgf-00043w-Ka for qemu-devel@nongnu.org; Mon, 30 May 2011 00:02:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQtge-0003Gk-RX for qemu-devel@nongnu.org; Mon, 30 May 2011 00:02:41 -0400 Received: from exchtp08.via.com.tw ([61.66.243.7]:46507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQtge-0003ER-GJ for qemu-devel@nongnu.org; Mon, 30 May 2011 00:02:40 -0400 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Mon, 30 May 2011 12:02:12 +0800 Message-ID: In-Reply-To: <4DE120BE.1010602@web.de> References: <4DE120BE.1010602@web.de> From: 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: jan.kiszka@web.de, brillywu@gmail.com Cc: KaryJin@viatech.com.cn, kvm@vger.kernel.org, mst@redhat.com, mtosatti@redhat.com, qemu-devel@nongnu.org, avi@redhat.com Hi, Jan >=20 > > @@ -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) { >=20 > This condition can't be correct. It triggers on every index <=3D 15 = and=20 > breaks qemu. I'm so sorry to make such a stupid mistake. Thank you very for your = revieview. >=20 > > + /* Handle the Centaur's CPUID instruction. */ > > + if (index > env->cpuid_xlevel2) { > > + index =3D env->cpuid_xlevel2; > > + } > > + } else if (index & 0x80000000) { >=20 > Your very first version looked like this: The first version has some problem, so you could ignore it. >=20 > - 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) { >=20 > Something went wrong here, please re-validate the patch carefully. Ok, I will check it soon.=20