Skip to contentSkip to conversation

KVM: VMX: Support Unrestricted Guest feature

PATCH Applied Nitin A Kamble 2 participants 2 messages Jun 8, 2009 – Jun 9, 2009

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

PATCH 1/1 KVM: VMX: Support Unrestricted Guest feature

"Unrestricted Guest" feature is added in the VMX specification. Intel Westmere and onwards processors will support this feature.

It allows kvm guests to run real mode and unpaged mode
code natively in the VMX mode when EPT is turned on. With the unrestricted guest there is no need to emulate the guest real mode code in the vm86 container or in the emulator. Also the guest big real mode code works like native.

The attached patch enhances KVM to use the unrestricted guest feature
if available on the processor. It also adds a new kernel/module parameter to disable the unrestricted guest feature at the boot time.

---
 arch/x86/include/asm/kvm_host.h |   12 ++++---
 arch/x86/include/asm/vmx.h      |    1 +
 arch/x86/kvm/vmx.c              |   60 +++++++++++++++++++++++++++++++++++----
 3 files changed, 62 insertions(+), 11 deletions(-)
arch/x86/include/asm/kvm_host.h +7 -5
index 1cc901e..a1a96a5 100644
@@ -37,12 +37,14 @@
 #define CR3_L_MODE_RESERVED_BITS (CR3_NONPAE_RESERVED_BITS |	\
 				  0xFFFFFF0000000000ULL)
 
-#define KVM_GUEST_CR0_MASK				   \
-	(X86_CR0_PG | X86_CR0_PE | X86_CR0_WP | X86_CR0_NE \
-	 | X86_CR0_NW | X86_CR0_CD)
+#define KVM_GUEST_CR0_MASK_UNRESTRICTED_GUEST				\
+	(X86_CR0_WP | X86_CR0_NE | X86_CR0_NW | X86_CR0_CD)
+#define KVM_GUEST_CR0_MASK						\
+	(KVM_GUEST_CR0_MASK_UNRESTRICTED_GUEST | X86_CR0_PG | X86_CR0_PE)
+#define KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST				\
+	(X86_CR0_WP | X86_CR0_NE | X86_CR0_TS | X86_CR0_MP)
 #define KVM_VM_CR0_ALWAYS_ON						\
-	(X86_CR0_PG | X86_CR0_PE | X86_CR0_WP | X86_CR0_NE | X86_CR0_TS \
-	 | X86_CR0_MP)
+	(KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST | X86_CR0_PG | X86_CR0_PE)
 #define KVM_GUEST_CR4_MASK						\
 	(X86_CR4_VME | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_PGE | X86_CR4_VMXE)
 #define KVM_PMODE_VM_CR4_ALWAYS_ON (X86_CR4_PAE | X86_CR4_VMXE)
arch/x86/include/asm/vmx.h +1 -0
index 11be5ad..e7927a6 100644
@@ -55,6 +55,7 @@
 #define SECONDARY_EXEC_ENABLE_EPT               0x00000002
 #define SECONDARY_EXEC_ENABLE_VPID              0x00000020
 #define SECONDARY_EXEC_WBINVD_EXITING		0x00000040
+#define SECONDARY_EXEC_UNRESTRICTED_GUEST	0x00000080
 
 
 #define PIN_BASED_EXT_INTR_MASK                 0x00000001
arch/x86/kvm/vmx.c +54 -6

125 lines not on this page · raw message

Signature · 1 line
1.6.0.6
Applied
#1 lore raw
Quoted 9 lines · Nitin A Kamble

"Unrestricted Guest" feature is added in the VMX specification. Intel Westmere and onwards processors will support this feature.

It allows kvm guests to run real mode and unpaged mode
code natively in the VMX mode when EPT is turned on. With the unrestricted guest there is no need to emulate the guest real mode code in the vm86 container or in the emulator. Also the guest big real mode code works like native.

Quoted 5 lines

The attached patch enhances KVM to use the unrestricted guest feature
if available on the processor. It also adds a new kernel/module parameter to disable the unrestricted guest feature at the boot time.

Applied, thanks.

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