diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2010-05-17 08:43:34 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-06-09 11:39:10 -0400 |
commit | fe5913e4e1700cbfc337f4b1da9ddb26f6a55586 (patch) | |
tree | fac7ecc398a41a9ffdb3d8b0dfe43a651c98ea28 /arch | |
parent | a06cdb5676272a12056820aeb49a1416ad2d0c6f (diff) |
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: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/svm.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 96dc232bfc56..5e1ed033cd7e 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1410,7 +1410,7 @@ static int nm_interception(struct vcpu_svm *svm) | |||
1410 | return 1; | 1410 | return 1; |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | static int mc_interception(struct vcpu_svm *svm) | 1413 | static void svm_handle_mce(struct vcpu_svm *svm) |
1414 | { | 1414 | { |
1415 | /* | 1415 | /* |
1416 | * On an #MC intercept the MCE handler is not called automatically in | 1416 | * On an #MC intercept the MCE handler is not called automatically in |
@@ -1420,6 +1420,11 @@ static int mc_interception(struct vcpu_svm *svm) | |||
1420 | "int $0x12\n"); | 1420 | "int $0x12\n"); |
1421 | /* not sure if we ever come back to this point */ | 1421 | /* not sure if we ever come back to this point */ |
1422 | 1422 | ||
1423 | return; | ||
1424 | } | ||
1425 | |||
1426 | static int mc_interception(struct vcpu_svm *svm) | ||
1427 | { | ||
1423 | return 1; | 1428 | return 1; |
1424 | } | 1429 | } |
1425 | 1430 | ||
@@ -3088,6 +3093,14 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) | |||
3088 | vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR); | 3093 | vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR); |
3089 | vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR); | 3094 | vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR); |
3090 | } | 3095 | } |
3096 | |||
3097 | /* | ||
3098 | * We need to handle MC intercepts here before the vcpu has a chance to | ||
3099 | * change the physical cpu | ||
3100 | */ | ||
3101 | if (unlikely(svm->vmcb->control.exit_code == | ||
3102 | SVM_EXIT_EXCP_BASE + MC_VECTOR)) | ||
3103 | svm_handle_mce(svm); | ||
3091 | } | 3104 | } |
3092 | 3105 | ||
3093 | #undef R | 3106 | #undef R |