Skip to contentSkip to conversation

KVM: VMX: Fix a wrong usage of vmcs_config

PATCH Applied Yang, Sheng 2 participants 2 messages Jun 25, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: VMX: Fix a wrong usage of vmcs_config

From a1c929709718c015686b0c23046cc08b8bc47a62 Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Wed, 18 Jun 2008 14:43:38 +0800
Subject: [PATCH] KVM: VMX: Fix a wrong usage of vmcs_config

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.

---
 arch/x86/kvm/vmx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx.c +0 -0
index 6e4278d..6a31406 100644
@@ -1438,7 +1438,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;
@@ -1448,7 +1448,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;
--
1.5.5

From a1c929709718c015686b0c23046cc08b8bc47a62 Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Wed, 18 Jun 2008 14:43:38 +0800
Subject: [PATCH] KVM: VMX: Fix a wrong usage of vmcs_config

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.

---
 arch/x86/kvm/vmx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx.c +2 -2
index 6e4278d..6a31406 100644
@@ -1438,7 +1438,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;
@@ -1448,7 +1448,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;
Signature · 1 line
1.5.5
Applied
#1 lore raw
Quoted 11 lines · Sheng

From a1c929709718c015686b0c23046cc08b8bc47a62 Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Wed, 18 Jun 2008 14:43:38 +0800
Subject: [PATCH] KVM: VMX: Fix a wrong usage of vmcs_config

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.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function