]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: VMX: Fix a wrong usage of vmcs_config
authorSheng Yang <sheng.yang@intel.com>
Wed, 18 Jun 2008 06:43:38 +0000 (14:43 +0800)
committerAvi Kivity <avi@qumranet.com>
Sun, 20 Jul 2008 09:42:36 +0000 (12:42 +0300)
The function ept_update_paging_mode_cr0() write to
CPU_BASED_VM_EXEC_CONTROL based on vmcs_config.cpu_based_exec_ctrl. That's
wrong because the variable may not consistent with the content in the
CPU_BASE_VM_EXEC_CONTROL MSR.

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

index 1bb994657208ce6a34573851010adf90b2083c2e..6a3a4038f3b941eabb09276dcf4837bf25bccfc3 100644 (file)
@@ -1441,7 +1441,7 @@ static void ept_update_paging_mode_cr0(unsigned long *hw_cr0,
        if (!(cr0 & X86_CR0_PG)) {
                /* From paging/starting to nonpaging */
                vmcs_write32(CPU_BASED_VM_EXEC_CONTROL,
-                            vmcs_config.cpu_based_exec_ctrl |
+                            vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) |
                             (CPU_BASED_CR3_LOAD_EXITING |
                              CPU_BASED_CR3_STORE_EXITING));
                vcpu->arch.cr0 = cr0;
@@ -1451,7 +1451,7 @@ static void ept_update_paging_mode_cr0(unsigned long *hw_cr0,
        } else if (!is_paging(vcpu)) {
                /* From nonpaging to paging */
                vmcs_write32(CPU_BASED_VM_EXEC_CONTROL,
-                            vmcs_config.cpu_based_exec_ctrl &
+                            vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) &
                             ~(CPU_BASED_CR3_LOAD_EXITING |
                               CPU_BASED_CR3_STORE_EXITING));
                vcpu->arch.cr0 = cr0;