Commit 4d2e11d1 authored by Joerg Roedel's avatar Joerg Roedel Committed by Greg Kroah-Hartman

KVM: SVM: Handle MCEs early in the vmexit process

This patch moves handling of the MC vmexits to an earlier
point in the vmexit. The handle_exit function is too late
because the vcpu might alreadry have changed its physical
cpu.

Cc: stable@kernel.org
Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
(cherry picked from commit fe5913e4)
parent 57b8799a
...@@ -1257,7 +1257,7 @@ static int nm_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) ...@@ -1257,7 +1257,7 @@ static int nm_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
return 1; return 1;
} }
static int mc_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) static void svm_handle_mce(struct vcpu_svm *svm)
{ {
/* /*
* On an #MC intercept the MCE handler is not called automatically in * On an #MC intercept the MCE handler is not called automatically in
...@@ -1267,6 +1267,11 @@ static int mc_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) ...@@ -1267,6 +1267,11 @@ static int mc_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
"int $0x12\n"); "int $0x12\n");
/* not sure if we ever come back to this point */ /* not sure if we ever come back to this point */
return;
}
static int mc_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
{
return 1; return 1;
} }
...@@ -2717,6 +2722,14 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) ...@@ -2717,6 +2722,14 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR); vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR);
vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR); vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR);
} }
/*
* We need to handle MC intercepts here before the vcpu has a chance to
* change the physical cpu
*/
if (unlikely(svm->vmcb->control.exit_code ==
SVM_EXIT_EXCP_BASE + MC_VECTOR))
svm_handle_mce(svm);
} }
#undef R #undef R
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment