Skip to contentSkip to conversation

KVM: nVMX: Advertise IA32_PAT in VM exit control

PATCH In review Arthur Chunqi Li 2 participants 2 messages Aug 6, 2013

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

PATCH v3 1/1 KVM: nVMX: Advertise IA32_PAT in VM exit control

Advertise VM_EXIT_SAVE_IA32_PAT and VM_EXIT_LOAD_IA32_PAT.

---
 arch/x86/kvm/vmx.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
arch/x86/kvm/vmx.c +8 -5
index 396572d..c45adea 100644
@@ -2191,14 +2191,17 @@ static __init void nested_vmx_setup_ctls_msrs(void)
 	 * If bit 55 of VMX_BASIC is off, bits 0-8 and 10, 11, 13, 14, 16 and
 	 * 17 must be 1.
 	 */
+	rdmsr(MSR_IA32_VMX_EXIT_CTLS,
+		nested_vmx_exit_ctls_low, nested_vmx_exit_ctls_high);
 	nested_vmx_exit_ctls_low = VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
+	nested_vmx_exit_ctls_high &=
+		VM_EXIT_LOAD_IA32_PAT | VM_EXIT_SAVE_IA32_PAT;
+	nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR |
+		VM_EXIT_HOST_ADDR_SPACE_SIZE;
 	/* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */
-#ifdef CONFIG_X86_64
-	nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE;
-#else
-	nested_vmx_exit_ctls_high = 0;
+#ifndef CONFIG_X86_64
+	nested_vmx_exit_ctls_high &= (~VM_EXIT_HOST_ADDR_SPACE_SIZE);
 #endif
-	nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
 
 	/* entry controls */
 	rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 12 lines · Arthur Chunqi Li

Advertise VM_EXIT_SAVE_IA32_PAT and VM_EXIT_LOAD_IA32_PAT.

---
 arch/x86/kvm/vmx.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
arch/x86/kvm/vmx.c +0 -0
index 396572d..c45adea 100644

arch/x86/kvm/vmx.c static __init void nested_vmx_setup_ctls_msrs(void) · line 2200

Quoted 10 lines
arch/x86/kvm/vmx.c +6 -0
@@ -2191,14 +2191,17 @@ static __init void nested_vmx_setup_ctls_msrs(void)
 	 * If bit 55 of VMX_BASIC is off, bits 0-8 and 10, 11, 13, 14, 16 and
 	 * 17 must be 1.
 	 */
+	rdmsr(MSR_IA32_VMX_EXIT_CTLS,
+		nested_vmx_exit_ctls_low, nested_vmx_exit_ctls_high);
 	nested_vmx_exit_ctls_low = VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
+	nested_vmx_exit_ctls_high &=
+		VM_EXIT_LOAD_IA32_PAT | VM_EXIT_SAVE_IA32_PAT;
+	nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR |
+		VM_EXIT_HOST_ADDR_SPACE_SIZE;

I would suggest to align the pattern to [1].

Jan

[1] http://thread.gmane.org/gmane.comp.emulators.kvm.devel/113629

Quoted 13 lines
arch/x86/kvm/vmx.c +2 -5
 	/* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */
-#ifdef CONFIG_X86_64
-	nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE;
-#else
-	nested_vmx_exit_ctls_high = 0;
+#ifndef CONFIG_X86_64
+	nested_vmx_exit_ctls_high &= (~VM_EXIT_HOST_ADDR_SPACE_SIZE);
 #endif
-	nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
 
 	/* entry controls */
 	rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux