i386: kvm: mask cpuid_ext4_features bits earlier
authorEduardo Habkost <ehabkost@redhat.com>
Thu, 4 Oct 2012 20:49:04 +0000 (17:49 -0300)
committerMarcelo Tosatti <mtosatti@redhat.com>
Wed, 31 Oct 2012 01:39:49 +0000 (23:39 -0200)
This way all the filtering by GET_SUPPORTED_CPUID is being done at the
same place in the code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
target-i386/kvm.c

index 8eb61a02e724c16c01f06b8e1104cc4ca3e96780..be37a1f7bac1675f94dfae06840e307535fc34f1 100644 (file)
@@ -431,6 +431,9 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     env->cpuid_kvm_features &=
             kvm_arch_get_supported_cpuid(s, KVM_CPUID_FEATURES, 0, R_EAX);
 
+    env->cpuid_ext4_features &= kvm_arch_get_supported_cpuid(s, 0xC0000001,
+                                                             0, R_EDX);
+
     cpuid_i = 0;
 
     /* Paravirtualization CPUIDs */
@@ -572,8 +575,6 @@ int kvm_arch_init_vcpu(CPUX86State *env)
 
     /* Call Centaur's CPUID instructions they are supported. */
     if (env->cpuid_xlevel2 > 0) {
-        env->cpuid_ext4_features &=
-            kvm_arch_get_supported_cpuid(s, 0xC0000001, 0, R_EDX);
         cpu_x86_cpuid(env, 0xC0000000, 0, &limit, &unused, &unused, &unused);
 
         for (i = 0xC0000000; i <= limit; i++) {