diff options
-rw-r--r-- | arch/x86/include/asm/kvm_emulate.h | 1 | ||||
-rw-r--r-- | arch/x86/kvm/svm.c | 12 |
2 files changed, 5 insertions, 8 deletions
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h index 127ea3e17171..28114f581fa3 100644 --- a/arch/x86/include/asm/kvm_emulate.h +++ b/arch/x86/include/asm/kvm_emulate.h | |||
@@ -304,6 +304,7 @@ struct x86_emulate_ctxt { | |||
304 | X86EMUL_MODE_PROT64) | 304 | X86EMUL_MODE_PROT64) |
305 | 305 | ||
306 | enum x86_intercept_stage { | 306 | enum x86_intercept_stage { |
307 | X86_ICTP_NONE = 0, /* Allow zero-init to not match anything */ | ||
307 | X86_ICPT_PRE_EXCEPT, | 308 | X86_ICPT_PRE_EXCEPT, |
308 | X86_ICPT_POST_EXCEPT, | 309 | X86_ICPT_POST_EXCEPT, |
309 | X86_ICPT_POST_MEMACCESS, | 310 | X86_ICPT_POST_MEMACCESS, |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index de4bba99160d..9cff0368e1fc 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -3959,19 +3959,15 @@ static void svm_fpu_deactivate(struct kvm_vcpu *vcpu) | |||
3959 | } | 3959 | } |
3960 | 3960 | ||
3961 | #define PRE_EX(exit) { .exit_code = (exit), \ | 3961 | #define PRE_EX(exit) { .exit_code = (exit), \ |
3962 | .stage = X86_ICPT_PRE_EXCEPT, \ | 3962 | .stage = X86_ICPT_PRE_EXCEPT, } |
3963 | .valid = true } | ||
3964 | #define POST_EX(exit) { .exit_code = (exit), \ | 3963 | #define POST_EX(exit) { .exit_code = (exit), \ |
3965 | .stage = X86_ICPT_POST_EXCEPT, \ | 3964 | .stage = X86_ICPT_POST_EXCEPT, } |
3966 | .valid = true } | ||
3967 | #define POST_MEM(exit) { .exit_code = (exit), \ | 3965 | #define POST_MEM(exit) { .exit_code = (exit), \ |
3968 | .stage = X86_ICPT_POST_MEMACCESS, \ | 3966 | .stage = X86_ICPT_POST_MEMACCESS, } |
3969 | .valid = true } | ||
3970 | 3967 | ||
3971 | static struct __x86_intercept { | 3968 | static struct __x86_intercept { |
3972 | u32 exit_code; | 3969 | u32 exit_code; |
3973 | enum x86_intercept_stage stage; | 3970 | enum x86_intercept_stage stage; |
3974 | bool valid; | ||
3975 | } x86_intercept_map[] = { | 3971 | } x86_intercept_map[] = { |
3976 | [x86_intercept_cr_read] = POST_EX(SVM_EXIT_READ_CR0), | 3972 | [x86_intercept_cr_read] = POST_EX(SVM_EXIT_READ_CR0), |
3977 | [x86_intercept_cr_write] = POST_EX(SVM_EXIT_WRITE_CR0), | 3973 | [x86_intercept_cr_write] = POST_EX(SVM_EXIT_WRITE_CR0), |
@@ -4039,7 +4035,7 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu, | |||
4039 | 4035 | ||
4040 | icpt_info = x86_intercept_map[info->intercept]; | 4036 | icpt_info = x86_intercept_map[info->intercept]; |
4041 | 4037 | ||
4042 | if (!icpt_info.valid || stage != icpt_info.stage) | 4038 | if (stage != icpt_info.stage) |
4043 | goto out; | 4039 | goto out; |
4044 | 4040 | ||
4045 | switch (icpt_info.exit_code) { | 4041 | switch (icpt_info.exit_code) { |