diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2007-03-21 14:47:00 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:26 -0400 |
commit | 916ce2360fadc71d924e02403b31280112a31280 (patch) | |
tree | 6cdb3c1e122cb25e18f1848c151aacc356c06fde /drivers/kvm | |
parent | 0e5bf0d0e449f6597870570e8dd17e78ba4d75ff (diff) |
KVM: SVM: forbid guest to execute monitor/mwait
This patch forbids the guest to execute monitor/mwait instructions on
SVM. This is necessary because the guest can execute these instructions
if they are available even if the kvm cpuid doesn't report its
existence.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm')
-rw-r--r-- | drivers/kvm/svm.c | 6 | ||||
-rw-r--r-- | drivers/kvm/svm.h | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index ddc0505c3374..0542d3357ce1 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -511,7 +511,9 @@ static void init_vmcb(struct vmcb *vmcb) | |||
511 | (1ULL << INTERCEPT_VMSAVE) | | 511 | (1ULL << INTERCEPT_VMSAVE) | |
512 | (1ULL << INTERCEPT_STGI) | | 512 | (1ULL << INTERCEPT_STGI) | |
513 | (1ULL << INTERCEPT_CLGI) | | 513 | (1ULL << INTERCEPT_CLGI) | |
514 | (1ULL << INTERCEPT_SKINIT); | 514 | (1ULL << INTERCEPT_SKINIT) | |
515 | (1ULL << INTERCEPT_MONITOR) | | ||
516 | (1ULL << INTERCEPT_MWAIT); | ||
515 | 517 | ||
516 | control->iopm_base_pa = iopm_base; | 518 | control->iopm_base_pa = iopm_base; |
517 | control->msrpm_base_pa = msrpm_base; | 519 | control->msrpm_base_pa = msrpm_base; |
@@ -1292,6 +1294,8 @@ static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
1292 | [SVM_EXIT_STGI] = invalid_op_interception, | 1294 | [SVM_EXIT_STGI] = invalid_op_interception, |
1293 | [SVM_EXIT_CLGI] = invalid_op_interception, | 1295 | [SVM_EXIT_CLGI] = invalid_op_interception, |
1294 | [SVM_EXIT_SKINIT] = invalid_op_interception, | 1296 | [SVM_EXIT_SKINIT] = invalid_op_interception, |
1297 | [SVM_EXIT_MONITOR] = invalid_op_interception, | ||
1298 | [SVM_EXIT_MWAIT] = invalid_op_interception, | ||
1295 | }; | 1299 | }; |
1296 | 1300 | ||
1297 | 1301 | ||
diff --git a/drivers/kvm/svm.h b/drivers/kvm/svm.h index df731c3fb588..5e93814400ce 100644 --- a/drivers/kvm/svm.h +++ b/drivers/kvm/svm.h | |||
@@ -44,6 +44,9 @@ enum { | |||
44 | INTERCEPT_RDTSCP, | 44 | INTERCEPT_RDTSCP, |
45 | INTERCEPT_ICEBP, | 45 | INTERCEPT_ICEBP, |
46 | INTERCEPT_WBINVD, | 46 | INTERCEPT_WBINVD, |
47 | INTERCEPT_MONITOR, | ||
48 | INTERCEPT_MWAIT, | ||
49 | INTERCEPT_MWAIT_COND, | ||
47 | }; | 50 | }; |
48 | 51 | ||
49 | 52 | ||
@@ -298,6 +301,9 @@ struct __attribute__ ((__packed__)) vmcb { | |||
298 | #define SVM_EXIT_RDTSCP 0x087 | 301 | #define SVM_EXIT_RDTSCP 0x087 |
299 | #define SVM_EXIT_ICEBP 0x088 | 302 | #define SVM_EXIT_ICEBP 0x088 |
300 | #define SVM_EXIT_WBINVD 0x089 | 303 | #define SVM_EXIT_WBINVD 0x089 |
304 | #define SVM_EXIT_MONITOR 0x08a | ||
305 | #define SVM_EXIT_MWAIT 0x08b | ||
306 | #define SVM_EXIT_MWAIT_COND 0x08c | ||
301 | #define SVM_EXIT_NPF 0x400 | 307 | #define SVM_EXIT_NPF 0x400 |
302 | 308 | ||
303 | #define SVM_EXIT_ERR -1 | 309 | #define SVM_EXIT_ERR -1 |