• Sean Christopherson's avatar
    KVM: SVM: Don't defer NMI unblocking until next exit for SEV-ES guests · 389fbbec
    Sean Christopherson authored
    Immediately mark NMIs as unmasked in response to #VMGEXIT(NMI complete)
    instead of setting awaiting_iret_completion and waiting until the *next*
    VM-Exit to unmask NMIs.  The whole point of "NMI complete" is that the
    guest is responsible for telling the hypervisor when it's safe to inject
    an NMI, i.e. there's no need to wait.  And because there's no IRET to
    single-step, the next VM-Exit could be a long time coming, i.e. KVM could
    incorrectly hold an NMI pending for far longer than what is required and
    expected.
    
    Opportunistically fix a stale reference to HF_IRET_MASK.
    
    Fixes: 916b54a7 ("KVM: x86: Move HF_NMI_MASK and HF_IRET_MASK into "struct vcpu_svm"")
    Fixes: 4444dfe4 ("KVM: SVM: Add NMI support for an SEV-ES guest")
    Cc: Tom Lendacky <thomas.lendacky@amd.com>
    Link: https://lore.kernel.org/r/20230615063757.3039121-9-aik@amd.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
    389fbbec
sev.c 79 KB