diff options
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r-- | drivers/kvm/svm.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index c75c6b65b651..87072c647f28 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -188,6 +188,25 @@ static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer) | |||
188 | vcpu->shadow_efer = efer; | 188 | vcpu->shadow_efer = efer; |
189 | } | 189 | } |
190 | 190 | ||
191 | static void svm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr, | ||
192 | bool has_error_code, u32 error_code) | ||
193 | { | ||
194 | struct vcpu_svm *svm = to_svm(vcpu); | ||
195 | |||
196 | svm->vmcb->control.event_inj = nr | ||
197 | | SVM_EVTINJ_VALID | ||
198 | | (has_error_code ? SVM_EVTINJ_VALID_ERR : 0) | ||
199 | | SVM_EVTINJ_TYPE_EXEPT; | ||
200 | svm->vmcb->control.event_inj_err = error_code; | ||
201 | } | ||
202 | |||
203 | static bool svm_exception_injected(struct kvm_vcpu *vcpu) | ||
204 | { | ||
205 | struct vcpu_svm *svm = to_svm(vcpu); | ||
206 | |||
207 | return !(svm->vmcb->control.exit_int_info & SVM_EXITINTINFO_VALID); | ||
208 | } | ||
209 | |||
191 | static void svm_inject_gp(struct kvm_vcpu *vcpu, unsigned error_code) | 210 | static void svm_inject_gp(struct kvm_vcpu *vcpu, unsigned error_code) |
192 | { | 211 | { |
193 | struct vcpu_svm *svm = to_svm(vcpu); | 212 | struct vcpu_svm *svm = to_svm(vcpu); |
@@ -1712,6 +1731,8 @@ static struct kvm_x86_ops svm_x86_ops = { | |||
1712 | .patch_hypercall = svm_patch_hypercall, | 1731 | .patch_hypercall = svm_patch_hypercall, |
1713 | .get_irq = svm_get_irq, | 1732 | .get_irq = svm_get_irq, |
1714 | .set_irq = svm_set_irq, | 1733 | .set_irq = svm_set_irq, |
1734 | .queue_exception = svm_queue_exception, | ||
1735 | .exception_injected = svm_exception_injected, | ||
1715 | .inject_pending_irq = svm_intr_assist, | 1736 | .inject_pending_irq = svm_intr_assist, |
1716 | .inject_pending_vectors = do_interrupt_requests, | 1737 | .inject_pending_vectors = do_interrupt_requests, |
1717 | 1738 | ||