summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorHaiwei Li <lihaiwei.kernel@gmail.com>2020-03-02 20:19:28 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2020-03-02 17:06:52 +0100
commitaaca21007ba14005feca74a079888c49a9b6f6ac (patch)
tree2dfe0c5017266eba723fce760f8fa37cbee3c623 /arch
parent9a11997e757bcf716c1b199ea7bd1abbadc4b357 (diff)
downloadlinux-rpi-aaca21007ba14005feca74a079888c49a9b6f6ac.tar.gz
linux-rpi-aaca21007ba14005feca74a079888c49a9b6f6ac.tar.bz2
linux-rpi-aaca21007ba14005feca74a079888c49a9b6f6ac.zip
KVM: SVM: Fix the svm vmexit code for WRMSR
In svm, exit_code for MSR writes is not EXIT_REASON_MSR_WRITE which belongs to vmx. According to amd manual, SVM_EXIT_MSR(7ch) is the exit_code of VMEXIT_MSR due to RDMSR or WRMSR access to protected MSR. Additionally, the processor indicates in the VMCB's EXITINFO1 whether a RDMSR(EXITINFO1=0) or WRMSR(EXITINFO1=1) was intercepted. Signed-off-by: Haiwei Li <lihaiwei@tencent.com> Fixes: 1e9e2622a149 ("KVM: VMX: FIXED+PHYSICAL mode single target IPI fastpath", 2019-11-21) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/svm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 24c0b2ba8fb9..91000501756e 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -6312,7 +6312,8 @@ static void svm_handle_exit_irqoff(struct kvm_vcpu *vcpu,
enum exit_fastpath_completion *exit_fastpath)
{
if (!is_guest_mode(vcpu) &&
- to_svm(vcpu)->vmcb->control.exit_code == EXIT_REASON_MSR_WRITE)
+ to_svm(vcpu)->vmcb->control.exit_code == SVM_EXIT_MSR &&
+ to_svm(vcpu)->vmcb->control.exit_info_1)
*exit_fastpath = handle_fastpath_set_msr_irqoff(vcpu);
}