KVM: VMX: Fix feature testing
authorSheng Yang <sheng@linux.intel.com>
Wed, 1 Apr 2009 07:52:32 +0000 (15:52 +0800)
committerAvi Kivity <avi@redhat.com>
Wed, 10 Jun 2009 08:48:36 +0000 (11:48 +0300)
The testing of feature is too early now, before vmcs_config complete initialization.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/vmx.c

index 1caa1fc6d5eceefc409824441c2bee883636756a..7d7b0d6e3f58751451c276a2f7b85699caa55cba 100644 (file)
@@ -1208,15 +1208,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
                      vmx_capability.ept, vmx_capability.vpid);
        }
 
-       if (!cpu_has_vmx_vpid())
-               enable_vpid = 0;
-
-       if (!cpu_has_vmx_ept())
-               enable_ept = 0;
-
-       if (!cpu_has_vmx_flexpriority())
-               flexpriority_enabled = 0;
-
        min = 0;
 #ifdef CONFIG_X86_64
        min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
@@ -1320,6 +1311,15 @@ static __init int hardware_setup(void)
        if (boot_cpu_has(X86_FEATURE_NX))
                kvm_enable_efer_bits(EFER_NX);
 
+       if (!cpu_has_vmx_vpid())
+               enable_vpid = 0;
+
+       if (!cpu_has_vmx_ept())
+               enable_ept = 0;
+
+       if (!cpu_has_vmx_flexpriority())
+               flexpriority_enabled = 0;
+
        return alloc_kvm_area();
 }