Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a5e1852 authored by Ladi Prosek's avatar Ladi Prosek Committed by Paolo Bonzini
Browse files

KVM: SVM: suppress unnecessary NMI singlestep on GIF=0 and nested exit



enable_nmi_window is supposed to be a no-op if we know that we'll see
a VM exit by the time the NMI window opens. This commit adds two more
cases:

* We intercept stgi so we don't need to singlestep on GIF=0.

* We emulate nested vmexit so we don't need to singlestep when nested
  VM exit is required.

Signed-off-by: default avatarLadi Prosek <lprosek@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent a12713c2
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -4678,6 +4678,12 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu)
	    == HF_NMI_MASK)
	    == HF_NMI_MASK)
		return; /* IRET will cause a vm exit */
		return; /* IRET will cause a vm exit */


	if ((svm->vcpu.arch.hflags & HF_GIF_MASK) == 0)
		return; /* STGI will cause a vm exit */

	if (svm->nested.exit_required)
		return; /* we're not going to run the guest yet */

	/*
	/*
	 * Something prevents NMI from been injected. Single step over possible
	 * Something prevents NMI from been injected. Single step over possible
	 * problem (IRET or exception injection or interrupt shadow)
	 * problem (IRET or exception injection or interrupt shadow)