Commit 221e7610 authored by Paolo Bonzini's avatar Paolo Bonzini

KVM: nSVM: Preserve IRQ/NMI/SMI priority irrespective of exiting behavior

Short circuit vmx_check_nested_events() if an unblocked IRQ/NMI/SMI is
pending and needs to be injected into L2, priority between coincident
events is not dependent on exiting behavior.

Fixes: b518ba9f ("KVM: nSVM: implement check_nested_events for interrupts")
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent fc6f7c03
...@@ -835,23 +835,29 @@ static int svm_check_nested_events(struct kvm_vcpu *vcpu) ...@@ -835,23 +835,29 @@ static int svm_check_nested_events(struct kvm_vcpu *vcpu)
kvm_event_needs_reinjection(vcpu) || svm->nested.exit_required || kvm_event_needs_reinjection(vcpu) || svm->nested.exit_required ||
svm->nested.nested_run_pending; svm->nested.nested_run_pending;
if (vcpu->arch.smi_pending && nested_exit_on_smi(svm)) { if (vcpu->arch.smi_pending && !svm_smi_blocked(vcpu)) {
if (block_nested_events) if (block_nested_events)
return -EBUSY; return -EBUSY;
if (!nested_exit_on_smi(svm))
return 0;
nested_svm_smi(svm); nested_svm_smi(svm);
return 0; return 0;
} }
if (vcpu->arch.nmi_pending && nested_exit_on_nmi(svm)) { if (vcpu->arch.nmi_pending && !svm_nmi_blocked(vcpu)) {
if (block_nested_events) if (block_nested_events)
return -EBUSY; return -EBUSY;
if (!nested_exit_on_nmi(svm))
return 0;
nested_svm_nmi(svm); nested_svm_nmi(svm);
return 0; return 0;
} }
if (kvm_cpu_has_interrupt(vcpu) && nested_exit_on_intr(svm)) { if (kvm_cpu_has_interrupt(vcpu) && !svm_interrupt_blocked(vcpu)) {
if (block_nested_events) if (block_nested_events)
return -EBUSY; return -EBUSY;
if (!nested_exit_on_intr(svm))
return 0;
nested_svm_intr(svm); nested_svm_intr(svm);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment