Skip to content

Commit 2e6b9bd

Browse files
committed
KVM: SVM: Use "standard" stgi() helper when disabling SVM
Now that kvm_rebooting is guaranteed to be true prior to disabling SVM in an emergency, use the existing stgi() helper instead of open coding STGI. In effect, eat faults on STGI if and only if kvm_rebooting==true. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 6ae44e0 commit 2e6b9bd

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -588,17 +588,10 @@ static inline void kvm_cpu_svm_disable(void)
588588
rdmsrl(MSR_EFER, efer);
589589
if (efer & EFER_SVME) {
590590
/*
591-
* Force GIF=1 prior to disabling SVM to ensure INIT and NMI
592-
* aren't blocked, e.g. if a fatal error occurred between CLGI
593-
* and STGI. Note, STGI may #UD if SVM is disabled from NMI
594-
* context between reading EFER and executing STGI. In that
595-
* case, GIF must already be set, otherwise the NMI would have
596-
* been blocked, so just eat the fault.
591+
* Force GIF=1 prior to disabling SVM, e.g. to ensure INIT and
592+
* NMI aren't blocked.
597593
*/
598-
asm_volatile_goto("1: stgi\n\t"
599-
_ASM_EXTABLE(1b, %l[fault])
600-
::: "memory" : fault);
601-
fault:
594+
stgi();
602595
wrmsrl(MSR_EFER, efer & ~EFER_SVME);
603596
}
604597
}

0 commit comments

Comments
 (0)