summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm.c
diff options
context:
space:
mode:
authorLadi Prosek2017-06-21 09:07:01 +0200
committerPaolo Bonzini2017-06-27 16:35:43 +0200
commit1a5e1852941d0d8ae98a4b5c769ec998e3708158 (patch)
tree0a805780d40800a2506b077a45320ff2846dc1ff /arch/x86/kvm/svm.c
parentKVM: SVM: don't NMI singlestep over event injection (diff)
downloadkernel-qcow2-linux-1a5e1852941d0d8ae98a4b5c769ec998e3708158.tar.gz
kernel-qcow2-linux-1a5e1852941d0d8ae98a4b5c769ec998e3708158.tar.xz
kernel-qcow2-linux-1a5e1852941d0d8ae98a4b5c769ec998e3708158.zip
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: Ladi Prosek <lprosek@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r--arch/x86/kvm/svm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 597337987a16..03df7c1da581 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -4678,6 +4678,12 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu)
== HF_NMI_MASK)
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
* problem (IRET or exception injection or interrupt shadow)