wrmsrl(MSR_VM_HSAVE_PA, 0);
        rdmsrl(MSR_EFER, efer);
-       wrmsrl(MSR_EFER, efer & ~EFER_SVME);
+       if (efer & EFER_SVME) {
+               /*
+                * Force GIF=1 prior to disabling SVM to ensure INIT and NMI
+                * aren't blocked, e.g. if a fatal error occurred between CLGI
+                * and STGI.  Note, STGI may #UD if SVM is disabled from NMI
+                * context between reading EFER and executing STGI.  In that
+                * case, GIF must already be set, otherwise the NMI would have
+                * been blocked, so just eat the fault.
+                */
+               asm_volatile_goto("1: stgi\n\t"
+                                 _ASM_EXTABLE(1b, %l[fault])
+                                 ::: "memory" : fault);
+fault:
+               wrmsrl(MSR_EFER, efer & ~EFER_SVME);
+       }
 }
 
 /** Makes sure SVM is disabled, if it is supported on the CPU