KVM: x86: Check LMA bit before set_efer
authorSheng Yang <sheng@linux.intel.com>
Wed, 12 May 2010 08:40:40 +0000 (16:40 +0800)
committerAvi Kivity <avi@redhat.com>
Wed, 19 May 2010 08:41:09 +0000 (11:41 +0300)
kvm_x86_ops->set_efer() would execute vcpu->arch.efer = efer, so the
checking of LMA bit didn't work.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/x86.c

index fa1c51925597ddd71aff934c85d9ba74883b7dad..f0846d2aa956c3c62ce2be9a84009ac973dc0008 100644 (file)
@@ -709,11 +709,11 @@ static int set_efer(struct kvm_vcpu *vcpu, u64 efer)
                        return 1;
        }
 
-       kvm_x86_ops->set_efer(vcpu, efer);
-
        efer &= ~EFER_LMA;
        efer |= vcpu->arch.efer & EFER_LMA;
 
+       kvm_x86_ops->set_efer(vcpu, efer);
+
        vcpu->arch.efer = efer;
 
        vcpu->arch.mmu.base_role.nxe = (efer & EFER_NX) && !tdp_enabled;