Blob Blame History Raw
From: Oliver Upton <oupton@google.com>
Date: Mon, 6 Apr 2020 20:12:37 +0000
Subject: KVM: nVMX: don't clear mtf_pending when nested events are blocked
Git-commit: 5c8beb474665220374abcafa79e40d78778606d1
Patch-mainline: v5.7-rc1
References: bsc#1182489

If nested events are blocked, don't clear the mtf_pending flag to avoid
missing later delivery of the MTF VM-exit.

Fixes: 5ef8acbdd687c ("KVM: nVMX: Emulate MTF when performing instruction emulation")
Signed-off-by: Oliver Upton <oupton@google.com>
Message-Id: <20200406201237.178725-1-oupton@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Dario Faggioli <dfaggioli@suse.com>
---
 arch/x86/kvm/vmx/nested.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -3447,7 +3447,8 @@
 	 * Clear the MTF state. If a higher priority VM-exit is delivered first,
 	 * this state is discarded.
 	 */
-	vmx->nested.mtf_pending = false;
+	if (!block_nested_events)
+		vmx->nested.mtf_pending = false;
 
 	/*
 	 * Process any exceptions that are not debug traps before MTF.