qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH uq/master V2] kvm: Add CPUID support for VIA CPU


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH uq/master V2] kvm: Add CPUID support for VIA CPU
Date: Sat, 28 May 2011 18:20:14 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2011-05-10 10:02, BrillyWu wrote:
> From: BrillyWu <address@hidden>
> 
> 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.
> 
> Signed-off-by: BrillyWu<address@hidden>
> Signed-off-by: KaryJin<address@hidden>

...

> @@ -855,6 +870,8 @@ int cpu_x86_register (CPUX86State *env,
>      env->cpuid_xlevel = def->xlevel;
>      env->cpuid_kvm_features = def->kvm_features;
>      env->cpuid_svm_features = def->svm_features;
> +    env->cpuid_ext4_features = def->ext4_features;
> +    env->cpuid_xlevel2 = def->xlevel2;
>      if (!kvm_enabled()) {
>          env->cpuid_features &= TCG_FEATURES;
>          env->cpuid_ext_features &= 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) == index) {

This condition can't be correct. It triggers on every index <= 15 and
breaks qemu.

> +        /* Handle the Centaur's CPUID instruction. */
> +        if (index > env->cpuid_xlevel2) {
> +            index = env->cpuid_xlevel2;
> +        }
> +    } else if (index & 0x80000000) {

Your very first version looked like this:

-    if (index & 0x80000000) {
+    if ((index & 0xC0000000) == 0xC0000000) {
+       /* Handle the Centaur's CPUID instruction.*
+       * If cpuid_xlevel2 is "0", then put into the*
+       * default case. */
+       if (env->cpuid_xlevel2 == 0)
+           index = 0xF0000000;
+       else if (index > env->cpuid_xlevel2)
+           index = env->cpuid_xlevel2;
+    } else if (index & 0x80000000) {

Something went wrong here, please re-validate the patch carefully.

Jan


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]