KVM: SVM: Fix EFER.LME being stripped
authorZachary Amsden <zamsden@redhat.com>
Thu, 27 May 2010 01:09:43 +0000 (15:09 -1000)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:39:22 +0000 (10:39 +0300)
Must set VCPU register to be the guest notion of EFER even if that
setting is not valid on hardware.  This was masked by the set in
set_efer until 7657fd5ace88e8092f5f3a84117e093d7b893f26 broke that.
Fix is simply to set the VCPU register before stripping bits.

Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/svm.c

index 02ea5cf4b1e52e97885ce79e0b5ee71be38cd8a7..9c68a650f57e4e4411b5258b64dfa414d52efddd 100644 (file)
@@ -286,11 +286,11 @@ static inline void flush_guest_tlb(struct kvm_vcpu *vcpu)
 
 static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)
 {
+       vcpu->arch.efer = efer;
        if (!npt_enabled && !(efer & EFER_LMA))
                efer &= ~EFER_LME;
 
        to_svm(vcpu)->vmcb->save.efer = efer | EFER_SVME;
-       vcpu->arch.efer = efer;
 }
 
 static int is_external_interrupt(u32 info)