Skip to content

Commit bdedff2

Browse files
committed
KVM: x86: Route pending NMIs from userspace through process_nmi()
Use the asynchronous NMI queue to handle pending NMIs coming in from userspace during KVM_SET_VCPU_EVENTS so that all of KVM's logic for handling multiple NMIs goes through process_nmi(). This will simplify supporting SVM's upcoming "virtual NMI" functionality, which will need changes KVM manages pending NMIs. Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 1c4522a commit bdedff2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kvm/x86.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5213,9 +5213,9 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
52135213

52145214
vcpu->arch.nmi_injected = events->nmi.injected;
52155215
if (events->flags & KVM_VCPUEVENT_VALID_NMI_PENDING) {
5216-
vcpu->arch.nmi_pending = events->nmi.pending;
5217-
if (vcpu->arch.nmi_pending)
5218-
kvm_make_request(KVM_REQ_NMI, vcpu);
5216+
vcpu->arch.nmi_pending = 0;
5217+
atomic_set(&vcpu->arch.nmi_queued, events->nmi.pending);
5218+
kvm_make_request(KVM_REQ_NMI, vcpu);
52195219
}
52205220
static_call(kvm_x86_set_nmi_mask)(vcpu, events->nmi.masked);
52215221

0 commit comments

Comments
 (0)