Skip to contentSkip to conversation

Fix SVM longmode guests

PATCH In review Zachary Amsden 2 participants 2 messages May 27, 2010

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

PATCH 1/1 Fix SVM longmode guests

In recent testing, I discovered guests failed to boot on my AMD box. Bisecting revealed an EFER related change caused the problem; here is the fix.

Cheers,

Zach

Fix 64-bit guests on SVM.

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.

arch/x86/kvm/svm.c +1 -1
index 100bd4b..a05b63f 100644
@@ -285,11 +285,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)
#1 lore raw
Quoted 2 lines · Zachary Amsden

In recent testing, I discovered guests failed to boot on my AMD box. Bisecting revealed an EFER related change caused the problem; here is the fix.

Yikes, applied, thanks.

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