diff options
-rw-r--r-- | drivers/kvm/svm.c | 12 | ||||
-rw-r--r-- | drivers/kvm/vmx.c | 11 |
2 files changed, 3 insertions, 20 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index f9769338c621..06beed7d4a08 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -207,13 +207,6 @@ static bool svm_exception_injected(struct kvm_vcpu *vcpu) | |||
207 | return !(svm->vmcb->control.exit_int_info & SVM_EXITINTINFO_VALID); | 207 | return !(svm->vmcb->control.exit_int_info & SVM_EXITINTINFO_VALID); |
208 | } | 208 | } |
209 | 209 | ||
210 | static void inject_ud(struct kvm_vcpu *vcpu) | ||
211 | { | ||
212 | to_svm(vcpu)->vmcb->control.event_inj = SVM_EVTINJ_VALID | | ||
213 | SVM_EVTINJ_TYPE_EXEPT | | ||
214 | UD_VECTOR; | ||
215 | } | ||
216 | |||
217 | static int is_external_interrupt(u32 info) | 210 | static int is_external_interrupt(u32 info) |
218 | { | 211 | { |
219 | info &= SVM_EVTINJ_TYPE_MASK | SVM_EVTINJ_VALID; | 212 | info &= SVM_EVTINJ_TYPE_MASK | SVM_EVTINJ_VALID; |
@@ -948,8 +941,7 @@ static int ud_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | |||
948 | 941 | ||
949 | er = emulate_instruction(&svm->vcpu, kvm_run, 0, 0, 0); | 942 | er = emulate_instruction(&svm->vcpu, kvm_run, 0, 0, 0); |
950 | if (er != EMULATE_DONE) | 943 | if (er != EMULATE_DONE) |
951 | inject_ud(&svm->vcpu); | 944 | kvm_queue_exception(&svm->vcpu, UD_VECTOR); |
952 | |||
953 | return 1; | 945 | return 1; |
954 | } | 946 | } |
955 | 947 | ||
@@ -1027,7 +1019,7 @@ static int vmmcall_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | |||
1027 | static int invalid_op_interception(struct vcpu_svm *svm, | 1019 | static int invalid_op_interception(struct vcpu_svm *svm, |
1028 | struct kvm_run *kvm_run) | 1020 | struct kvm_run *kvm_run) |
1029 | { | 1021 | { |
1030 | inject_ud(&svm->vcpu); | 1022 | kvm_queue_exception(&svm->vcpu, UD_VECTOR); |
1031 | return 1; | 1023 | return 1; |
1032 | } | 1024 | } |
1033 | 1025 | ||
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 3b3c5f7d2e7c..3b44573c326e 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -613,14 +613,6 @@ static bool vmx_exception_injected(struct kvm_vcpu *vcpu) | |||
613 | return !(vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK); | 613 | return !(vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK); |
614 | } | 614 | } |
615 | 615 | ||
616 | static void vmx_inject_ud(struct kvm_vcpu *vcpu) | ||
617 | { | ||
618 | vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, | ||
619 | UD_VECTOR | | ||
620 | INTR_TYPE_EXCEPTION | | ||
621 | INTR_INFO_VALID_MASK); | ||
622 | } | ||
623 | |||
624 | /* | 616 | /* |
625 | * Swap MSR entry in host/guest MSR entry array. | 617 | * Swap MSR entry in host/guest MSR entry array. |
626 | */ | 618 | */ |
@@ -1866,8 +1858,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1866 | if (is_invalid_opcode(intr_info)) { | 1858 | if (is_invalid_opcode(intr_info)) { |
1867 | er = emulate_instruction(vcpu, kvm_run, 0, 0, 0); | 1859 | er = emulate_instruction(vcpu, kvm_run, 0, 0, 0); |
1868 | if (er != EMULATE_DONE) | 1860 | if (er != EMULATE_DONE) |
1869 | vmx_inject_ud(vcpu); | 1861 | kvm_queue_exception(vcpu, UD_VECTOR); |
1870 | |||
1871 | return 1; | 1862 | return 1; |
1872 | } | 1863 | } |
1873 | 1864 | ||