diff options
author | Avi Kivity <avi@redhat.com> | 2010-07-20 08:06:17 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:52:54 -0400 |
commit | b463a6f744a263fccd7da14db1afdc880371a280 (patch) | |
tree | 30dbb8d47f4a3a6b2036dd890d03cb53081eadef /arch/x86/kvm/vmx.c | |
parent | 83422e17c19d61399cab7dbf9bf40ff9af2a7dd2 (diff) |
KVM: Non-atomic interrupt injection
Change the interrupt injection code to work from preemptible, interrupts
enabled context. This works by adding a ->cancel_injection() operation
that undoes an injection in case we were not able to actually enter the guest
(this condition could never happen with atomic injection).
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 3237f6cc930d..70af3db372d7 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3895,6 +3895,16 @@ static void vmx_complete_interrupts(struct vcpu_vmx *vmx) | |||
3895 | IDT_VECTORING_ERROR_CODE); | 3895 | IDT_VECTORING_ERROR_CODE); |
3896 | } | 3896 | } |
3897 | 3897 | ||
3898 | static void vmx_cancel_injection(struct kvm_vcpu *vcpu) | ||
3899 | { | ||
3900 | __vmx_complete_interrupts(to_vmx(vcpu), | ||
3901 | vmcs_read32(VM_ENTRY_INTR_INFO_FIELD), | ||
3902 | VM_ENTRY_INSTRUCTION_LEN, | ||
3903 | VM_ENTRY_EXCEPTION_ERROR_CODE); | ||
3904 | |||
3905 | vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0); | ||
3906 | } | ||
3907 | |||
3898 | /* | 3908 | /* |
3899 | * Failure to inject an interrupt should give us the information | 3909 | * Failure to inject an interrupt should give us the information |
3900 | * in IDT_VECTORING_INFO_FIELD. However, if the failure occurs | 3910 | * in IDT_VECTORING_INFO_FIELD. However, if the failure occurs |
@@ -4348,6 +4358,7 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
4348 | .set_irq = vmx_inject_irq, | 4358 | .set_irq = vmx_inject_irq, |
4349 | .set_nmi = vmx_inject_nmi, | 4359 | .set_nmi = vmx_inject_nmi, |
4350 | .queue_exception = vmx_queue_exception, | 4360 | .queue_exception = vmx_queue_exception, |
4361 | .cancel_injection = vmx_cancel_injection, | ||
4351 | .interrupt_allowed = vmx_interrupt_allowed, | 4362 | .interrupt_allowed = vmx_interrupt_allowed, |
4352 | .nmi_allowed = vmx_nmi_allowed, | 4363 | .nmi_allowed = vmx_nmi_allowed, |
4353 | .get_nmi_mask = vmx_get_nmi_mask, | 4364 | .get_nmi_mask = vmx_get_nmi_mask, |