From mboxrd@z Thu Jan 1 00:00:00 1970 From: BrillyWu Subject: Re: [PATCH uq/master V2] kvm: Add CPUID support for VIA CPU Date: Mon, 30 May 2011 15:40:17 +0800 Message-ID: References: <4DE120BE.1010602@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: avi@redhat.com, mtosatti@redhat.com, qemu-devel@nongnu.org, mst@redhat.com, KaryJin@viatech.com.cn, kvm@vger.kernel.org To: jan.kiszka@web.de, BrillyWu@viatech.com.cn Return-path: Received: from mail-yi0-f46.google.com ([209.85.218.46]:59616 "EHLO mail-yi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754820Ab1E3HkS (ORCPT ); Mon, 30 May 2011 03:40:18 -0400 Received: by yia27 with SMTP id 27so1331645yia.19 for ; Mon, 30 May 2011 00:40:17 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: From: BrillyWu Hi, Jan I'm very sorry for these bugs in the patch. Now I have made a new patch based on the newest uq/master where the patch has been applied to fix these bugs, is it feasible? If it is not acceptable, should I re-generate a patch based on previous uq/master, or what else? Signed-off-by: BrillyWu Signed-off-by: KaryJin --- target-i386/cpu.h | 4 ++++ target-i386/cpuid.c | 18 +++++++++++------- target-i386/2 files changed, 15 insertions(+), 7 deletions(-) --- a/target-i386/cpu.h 2011-05-30 10:14:30.184533002 +0800 +++ b/target-i386/cpu.h 2011-05-30 10:41:45.704533001 +0800 @@ -441,6 +441,10 @@ #define CPUID_VENDOR_AMD_2 0x69746e65 /* "enti" */ #define CPUID_VENDOR_AMD_3 0x444d4163 /* "cAMD" */ +#define CPUID_VENDOR_VIA_1 0x746e6543 /* "Cent" */ +#define CPUID_VENDOR_VIA_2 0x48727561 /* "aurH" */ +#define CPUID_VENDOR_VIA_3 0x736c7561 /* "auls" */ + #define CPUID_MWAIT_IBE (1 << 1) /* Interrupts can exit capability */ #define CPUID_MWAIT_EMX (1 << 0) /* enumeration supported */ --- a/target-i386/cpuid.c 2011-05-30 10:14:30.194533005 +0800 +++ b/target-i386/cpuid.c 2011-05-30 15:07:18.794532910 +0800 @@ -1051,14 +1051,18 @@ void cpu_x86_cpuid(CPUX86State *env, uin uint32_t *ecx, uint32_t *edx) { /* test if maximum index reached */ - if ((index & 0xC000000f) == index) { - /* Handle the Centaur's CPUID instruction. */ - if (index > env->cpuid_xlevel2) { - index = env->cpuid_xlevel2; + if (index & 0x80000000) { + if (index > env->cpuid_xlevel) { + if (env->cpuid_xlevel2 > 0) { + /* Handle the Centaur's CPUID instruction. */ + if (index > env->cpuid_xlevel2) { + index = env->cpuid_xlevel2; + } else if (index < 0xC0000000) { + index = env->cpuid_xlevel; + } + } else + index = env->cpuid_xlevel; } - } else if (index & 0x80000000) { - if (index > env->cpuid_xlevel) - index = env->cpuid_level; } else { if (index > env->cpuid_level) index = env->cpuid_level; From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQx5L-0006JY-HF for qemu-devel@nongnu.org; Mon, 30 May 2011 03:40:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQx5G-0005vN-KO for qemu-devel@nongnu.org; Mon, 30 May 2011 03:40:23 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:51153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQx5G-0005v9-Hm for qemu-devel@nongnu.org; Mon, 30 May 2011 03:40:18 -0400 Received: by ywl41 with SMTP id 41so1663827ywl.4 for ; Mon, 30 May 2011 00:40:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <4DE120BE.1010602@web.de> Date: Mon, 30 May 2011 15:40:17 +0800 Message-ID: From: BrillyWu Content-Type: text/plain; charset=ISO-8859-1 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@viatech.com.cn Cc: KaryJin@viatech.com.cn, kvm@vger.kernel.org, mst@redhat.com, mtosatti@redhat.com, qemu-devel@nongnu.org, avi@redhat.com From: BrillyWu Hi, Jan I'm very sorry for these bugs in the patch. Now I have made a new patch based on the newest uq/master where the patch has been applied to fix these bugs, is it feasible? If it is not acceptable, should I re-generate a patch based on previous uq/master, or what else? Signed-off-by: BrillyWu Signed-off-by: KaryJin --- target-i386/cpu.h | 4 ++++ target-i386/cpuid.c | 18 +++++++++++------- target-i386/2 files changed, 15 insertions(+), 7 deletions(-) --- a/target-i386/cpu.h 2011-05-30 10:14:30.184533002 +0800 +++ b/target-i386/cpu.h 2011-05-30 10:41:45.704533001 +0800 @@ -441,6 +441,10 @@ #define CPUID_VENDOR_AMD_2 0x69746e65 /* "enti" */ #define CPUID_VENDOR_AMD_3 0x444d4163 /* "cAMD" */ +#define CPUID_VENDOR_VIA_1 0x746e6543 /* "Cent" */ +#define CPUID_VENDOR_VIA_2 0x48727561 /* "aurH" */ +#define CPUID_VENDOR_VIA_3 0x736c7561 /* "auls" */ + #define CPUID_MWAIT_IBE (1 << 1) /* Interrupts can exit capability */ #define CPUID_MWAIT_EMX (1 << 0) /* enumeration supported */ --- a/target-i386/cpuid.c 2011-05-30 10:14:30.194533005 +0800 +++ b/target-i386/cpuid.c 2011-05-30 15:07:18.794532910 +0800 @@ -1051,14 +1051,18 @@ void cpu_x86_cpuid(CPUX86State *env, uin uint32_t *ecx, uint32_t *edx) { /* test if maximum index reached */ - if ((index & 0xC000000f) == index) { - /* Handle the Centaur's CPUID instruction. */ - if (index > env->cpuid_xlevel2) { - index = env->cpuid_xlevel2; + if (index & 0x80000000) { + if (index > env->cpuid_xlevel) { + if (env->cpuid_xlevel2 > 0) { + /* Handle the Centaur's CPUID instruction. */ + if (index > env->cpuid_xlevel2) { + index = env->cpuid_xlevel2; + } else if (index < 0xC0000000) { + index = env->cpuid_xlevel; + } + } else + index = env->cpuid_xlevel; } - } else if (index & 0x80000000) { - if (index > env->cpuid_xlevel) - index = env->cpuid_level; } else { if (index > env->cpuid_level) index = env->cpuid_level;