aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/svm.c17
-rw-r--r--include/asm-x86/kvm_host.h1
2 files changed, 17 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 8af463b9152..da3ddef4760 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
1048static 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
1047static int shutdown_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) 1061static 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,
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index de3eccfb767..286117878ce 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -62,6 +62,7 @@
62#define SS_VECTOR 12 62#define SS_VECTOR 12
63#define GP_VECTOR 13 63#define GP_VECTOR 13
64#define PF_VECTOR 14 64#define PF_VECTOR 14
65#define MC_VECTOR 18
65 66
66#define SELECTOR_TI_MASK (1 << 2) 67#define SELECTOR_TI_MASK (1 << 2)
67#define SELECTOR_RPL_MASK 0x03 68#define SELECTOR_RPL_MASK 0x03