Skip to contentSkip to conversation

KVM: nVMX: Advertise IA32_PAT in VM exit control

PATCH Superseded Arthur Chunqi Li 3 participants 3 messages Aug 5, 2013

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

Advertise VM_EXIT_SAVE_IA32_PAT and VM_EXIT_LOAD_IA32_PAT.

---

ChangeLog to v1:
Add host features check. Format is the same as "entry controls".

 arch/x86/kvm/vmx.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx.c +6 -4
index 396572d..fd451c1 100644
@@ -2191,14 +2191,16 @@ 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;
 	/* 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;
+	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
maintainer
#1 lore raw

----- Original Message -----

Quoted 27 lines

From: "Arthur Chunqi Li" <[email protected]>
To: [email protected]
Cc: "jan kiszka" <[email protected]>, [email protected], [email protected], "Arthur Chunqi Li" <[email protected]>
Sent: Monday, August 5, 2013 1:18:13 PM
Subject: [PATCH v2] KVM: nVMX: Advertise IA32_PAT in VM exit control

Advertise VM_EXIT_SAVE_IA32_PAT and VM_EXIT_LOAD_IA32_PAT.

---

ChangeLog to v1:
Add host features check. Format is the same as "entry controls".

 arch/x86/kvm/vmx.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx.c +2 -0
index 396572d..fd451c1 100644
@@ -2191,14 +2191,16 @@ 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);

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

Quoted 10 lines
arch/x86/kvm/vmx.c +4 -3
 	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;
 	/* 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;
+	nested_vmx_exit_ctls_high |= VM_EXIT_HOST_ADDR_SPACE_SIZE;

I think you should clear the bit if !X86_64 (and not do anything if X86_64, the bit should be already set in MSR_IA32_VMX_EXIT_CTLS).

Paolo

Quoted 9 lines
arch/x86/kvm/vmx.c +0 -2
 #endif
-	nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
 
 	/* entry controls */
 	rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
--

1.7.9.5

#2 lore raw
Quoted 35 lines · Paolo Bonzini

----- Original Message -----

Quoted 32 lines

From: "Arthur Chunqi Li" <[email protected]>
To: [email protected]
Cc: "jan kiszka" <[email protected]>, [email protected], [email protected], "Arthur Chunqi Li" <[email protected]>
Sent: Monday, August 5, 2013 1:18:13 PM
Subject: [PATCH v2] KVM: nVMX: Advertise IA32_PAT in VM exit control

Advertise VM_EXIT_SAVE_IA32_PAT and VM_EXIT_LOAD_IA32_PAT.

---

ChangeLog to v1:
Add host features check. Format is the same as "entry controls".

 arch/x86/kvm/vmx.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx.c +5 -0
index 396572d..fd451c1 100644
@@ -2191,14 +2191,16 @@ 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;
 	/* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */
Quoted 9 lines

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

Quoted 5 lines
arch/x86/kvm/vmx.c +1 -3
 #ifdef CONFIG_X86_64
-	nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE;
-#else
-	nested_vmx_exit_ctls_high = 0;
+	nested_vmx_exit_ctls_high |= VM_EXIT_HOST_ADDR_SPACE_SIZE;

I think you should clear the bit if !X86_64 (and not do anything if X86_64, the bit should be already set in MSR_IA32_VMX_EXIT_CTLS).

Yes, we do not support 64 bit guests on 32bit host. It means that 32 bit host is essentially "processors that do not support Intel 64 architecture", so the control should be zero.

--
Gleb.