KVM: VMX: Clear CR4.VMXE in hardware_disable

Previous thread: KVM: migrate PIT timer by Linux Kernel Mailing List on Wednesday, June 11, 2008 - 6:06 pm. (1 message)

Next thread: KVM: MMU: reschedule during shadow teardown by Linux Kernel Mailing List on Wednesday, June 11, 2008 - 6:06 pm. (1 message)
From: Linux Kernel Mailing List
Date: Wednesday, June 11, 2008 - 6:06 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e693d7...
Commit:     e693d71b46e64536581bf4884434fc1b8797e96f
Parent:     2f5997140f22f68f6390c49941150d3fa8a95cb7
Author:     Eli Collins <ecollins@vmware.com>
AuthorDate: Sun Jun 1 20:24:40 2008 -0700
Committer:  Avi Kivity <avi@qumranet.com>
CommitDate: Fri Jun 6 21:30:20 2008 +0300

    KVM: VMX: Clear CR4.VMXE in hardware_disable
    
    Clear CR4.VMXE in hardware_disable. There's no reason to leave it set
    after doing a VMXOFF.
    
    VMware Workstation 6.5 checks CR4.VMXE as a proxy for whether the CPU is
    in VMX mode, so leaving VMXE set means we'll refuse to power on. With this
    change the user can power on after unloading the kvm-intel module. I
    tested on kvm-67 and kvm-69.
    
    Signed-off-by: Eli Collins <ecollins@vmware.com>
    Signed-off-by: Avi Kivity <avi@qumranet.com>
---
 arch/x86/kvm/vmx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 96445f3..02efbe7 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1036,6 +1036,7 @@ static void hardware_enable(void *garbage)
 static void hardware_disable(void *garbage)
 {
 	asm volatile (ASM_VMX_VMXOFF : : : "cc");
+	write_cr4(read_cr4() & ~X86_CR4_VMXE);
 }
 
 static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt,
--

Previous thread: KVM: migrate PIT timer by Linux Kernel Mailing List on Wednesday, June 11, 2008 - 6:06 pm. (1 message)

Next thread: KVM: MMU: reschedule during shadow teardown by Linux Kernel Mailing List on Wednesday, June 11, 2008 - 6:06 pm. (1 message)