KVM: VMX: Make flexpriority module parameter reflect hardware capability
authorAvi Kivity <avi@redhat.com>
Tue, 24 Mar 2009 12:27:47 +0000 (14:27 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 10 Jun 2009 08:48:34 +0000 (11:48 +0300)
If the hardware does not support flexpriority, zero the module parameter.

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

index b9e06b07aca12d1a8c2eb657c68932413819f9a9..37ae13d7b8143f5197c44d8273293f88e4a16b59 100644 (file)
@@ -237,9 +237,7 @@ static inline int cpu_has_secondary_exec_ctrls(void)
 
 static inline bool cpu_has_vmx_virtualize_apic_accesses(void)
 {
-       return flexpriority_enabled
-               && (vmcs_config.cpu_based_2nd_exec_ctrl &
-                   SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES);
+       return flexpriority_enabled;
 }
 
 static inline int cpu_has_vmx_invept_individual_addr(void)
@@ -1203,6 +1201,9 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
        if (!cpu_has_vmx_ept())
                enable_ept = 0;
 
+       if (!(vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
+               flexpriority_enabled = 0;
+
        min = 0;
 #ifdef CONFIG_X86_64
        min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;