diff options
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index fc5e7c8381ce..f382956f176a 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -595,6 +595,24 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) | |||
595 | vcpu->interrupt_window_open = 1; | 595 | vcpu->interrupt_window_open = 1; |
596 | } | 596 | } |
597 | 597 | ||
598 | static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr, | ||
599 | bool has_error_code, u32 error_code) | ||
600 | { | ||
601 | vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, | ||
602 | nr | INTR_TYPE_EXCEPTION | ||
603 | | (has_error_code ? INTR_INFO_DELIEVER_CODE_MASK : 0) | ||
604 | | INTR_INFO_VALID_MASK); | ||
605 | if (has_error_code) | ||
606 | vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code); | ||
607 | } | ||
608 | |||
609 | static bool vmx_exception_injected(struct kvm_vcpu *vcpu) | ||
610 | { | ||
611 | struct vcpu_vmx *vmx = to_vmx(vcpu); | ||
612 | |||
613 | return !(vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK); | ||
614 | } | ||
615 | |||
598 | static void vmx_inject_gp(struct kvm_vcpu *vcpu, unsigned error_code) | 616 | static void vmx_inject_gp(struct kvm_vcpu *vcpu, unsigned error_code) |
599 | { | 617 | { |
600 | printk(KERN_DEBUG "inject_general_protection: rip 0x%lx\n", | 618 | printk(KERN_DEBUG "inject_general_protection: rip 0x%lx\n", |
@@ -2641,6 +2659,8 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
2641 | .patch_hypercall = vmx_patch_hypercall, | 2659 | .patch_hypercall = vmx_patch_hypercall, |
2642 | .get_irq = vmx_get_irq, | 2660 | .get_irq = vmx_get_irq, |
2643 | .set_irq = vmx_inject_irq, | 2661 | .set_irq = vmx_inject_irq, |
2662 | .queue_exception = vmx_queue_exception, | ||
2663 | .exception_injected = vmx_exception_injected, | ||
2644 | .inject_pending_irq = vmx_intr_assist, | 2664 | .inject_pending_irq = vmx_intr_assist, |
2645 | .inject_pending_vectors = do_interrupt_requests, | 2665 | .inject_pending_vectors = do_interrupt_requests, |
2646 | 2666 | ||