diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-04-09 08:15:30 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-04-27 05:01:18 -0400 |
commit | 53371b5098543ab09dcb0c7ce31da887dbe58c62 (patch) | |
tree | 5453a27cb8909c3604f81d4cc8811542b3f48d10 /arch | |
parent | 6394b6494c0a352a2db3ea3e891ba7aeea7c1441 (diff) |
KVM: SVM: add intercept for machine check exception
To properly forward a MCE occured while the guest is running to the host, we
have to intercept this exception and call the host handler by hand. This is
implemented by this patch.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/svm.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 8af463b91526..da3ddef47605 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -507,7 +507,8 @@ static void init_vmcb(struct vcpu_svm *svm) | |||
507 | INTERCEPT_DR7_MASK; | 507 | INTERCEPT_DR7_MASK; |
508 | 508 | ||
509 | control->intercept_exceptions = (1 << PF_VECTOR) | | 509 | control->intercept_exceptions = (1 << PF_VECTOR) | |
510 | (1 << UD_VECTOR); | 510 | (1 << UD_VECTOR) | |
511 | (1 << MC_VECTOR); | ||
511 | 512 | ||
512 | 513 | ||
513 | control->intercept = (1ULL << INTERCEPT_INTR) | | 514 | control->intercept = (1ULL << INTERCEPT_INTR) | |
@@ -1044,6 +1045,19 @@ static int nm_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | |||
1044 | return 1; | 1045 | return 1; |
1045 | } | 1046 | } |
1046 | 1047 | ||
1048 | static int mc_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | ||
1049 | { | ||
1050 | /* | ||
1051 | * On an #MC intercept the MCE handler is not called automatically in | ||
1052 | * the host. So do it by hand here. | ||
1053 | */ | ||
1054 | asm volatile ( | ||
1055 | "int $0x12\n"); | ||
1056 | /* not sure if we ever come back to this point */ | ||
1057 | |||
1058 | return 1; | ||
1059 | } | ||
1060 | |||
1047 | static int shutdown_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | 1061 | static int shutdown_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) |
1048 | { | 1062 | { |
1049 | /* | 1063 | /* |
@@ -1367,6 +1381,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm, | |||
1367 | [SVM_EXIT_EXCP_BASE + UD_VECTOR] = ud_interception, | 1381 | [SVM_EXIT_EXCP_BASE + UD_VECTOR] = ud_interception, |
1368 | [SVM_EXIT_EXCP_BASE + PF_VECTOR] = pf_interception, | 1382 | [SVM_EXIT_EXCP_BASE + PF_VECTOR] = pf_interception, |
1369 | [SVM_EXIT_EXCP_BASE + NM_VECTOR] = nm_interception, | 1383 | [SVM_EXIT_EXCP_BASE + NM_VECTOR] = nm_interception, |
1384 | [SVM_EXIT_EXCP_BASE + MC_VECTOR] = mc_interception, | ||
1370 | [SVM_EXIT_INTR] = nop_on_interception, | 1385 | [SVM_EXIT_INTR] = nop_on_interception, |
1371 | [SVM_EXIT_NMI] = nop_on_interception, | 1386 | [SVM_EXIT_NMI] = nop_on_interception, |
1372 | [SVM_EXIT_SMI] = nop_on_interception, | 1387 | [SVM_EXIT_SMI] = nop_on_interception, |