KVM: x86: pending exceptions must not be blocked by an injected event
[linux-block.git] / arch / x86 / kvm / svm / nested.c
index fb46f90ae9af24e73ed0e90572123371a1d3700e..8453c898b68be1ffb74f85473ed7f9348dded905 100644 (file)
@@ -1062,7 +1062,13 @@ static int svm_check_nested_events(struct kvm_vcpu *vcpu)
        }
 
        if (vcpu->arch.exception.pending) {
-               if (block_nested_events)
+               /*
+                * Only a pending nested run can block a pending exception.
+                * Otherwise an injected NMI/interrupt should either be
+                * lost or delivered to the nested hypervisor in the EXITINTINFO
+                * vmcb field, while delivering the pending exception.
+                */
+               if (svm->nested.nested_run_pending)
                         return -EBUSY;
                if (!nested_exit_on_exception(svm))
                        return 0;