]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: nVMX: Emulate MTF when performing instruction emulation
authorOliver Upton <oupton@google.com>
Fri, 7 Feb 2020 10:36:07 +0000 (02:36 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 23 Feb 2020 08:36:23 +0000 (09:36 +0100)
commitfd29fe5882392e8b421fd4abd9f94791fe165572
treec812f7aa49d4277536f51fb32f346ee643a17b88
parent69d81d9ac3465705e2c1bb3f8cb9938eeb8d5691
KVM: nVMX: Emulate MTF when performing instruction emulation

Since commit dcbf89dd2f52 ("kvm/x86: add support for
MONITOR_TRAP_FLAG"), KVM has allowed an L1 guest to use the monitor trap
flag processor-based execution control for its L2 guest. KVM simply
forwards any MTF VM-exits to the L1 guest, which works for normal
instruction execution.

However, when KVM needs to emulate an instruction on the behalf of an L2
guest, the monitor trap flag is not emulated. Add the necessary logic to
kvm_skip_emulated_instruction() to synthesize an MTF VM-exit to L1 upon
instruction emulation for L2.

Fixes: dcbf89dd2f52 ("kvm/x86: add support for MONITOR_TRAP_FLAG")
Signed-off-by: Oliver Upton <oupton@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/include/uapi/asm/kvm.h
arch/x86/kvm/svm.c
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/nested.h
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h
arch/x86/kvm/x86.c