aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/irq.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@qumranet.com>2008-06-27 08:55:02 -0400
committerAvi Kivity <avi@qumranet.com>2008-10-15 04:15:12 -0400
commit867767a365ee74a3adcfaba27075eefb66b14bfd (patch)
tree896716e81ff5e13f47a15221e66d0aceeeb9456a /arch/x86/kvm/irq.c
parentd98e6346350ac909f095768beb28b82368bd126f (diff)
KVM: Introduce kvm_set_irq to inject interrupts in guests
This function injects an interrupt into the guest given the kvm struct, the (guest) irq number and the interrupt level. Signed-off-by: Amit Shah <amit.shah@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/irq.c')
-rw-r--r--arch/x86/kvm/irq.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 76d736b5f664..0d9e55275af1 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -100,3 +100,14 @@ void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
100 __kvm_migrate_apic_timer(vcpu); 100 __kvm_migrate_apic_timer(vcpu);
101 __kvm_migrate_pit_timer(vcpu); 101 __kvm_migrate_pit_timer(vcpu);
102} 102}
103
104/* This should be called with the kvm->lock mutex held */
105void kvm_set_irq(struct kvm *kvm, int irq, int level)
106{
107 /* Not possible to detect if the guest uses the PIC or the
108 * IOAPIC. So set the bit in both. The guest will ignore
109 * writes to the unused one.
110 */
111 kvm_ioapic_set_irq(kvm->arch.vioapic, irq, level);
112 kvm_pic_set_irq(pic_irqchip(kvm), irq, level);
113}