]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: Introduce kvm_set_irq to inject interrupts in guests
authorAmit Shah <amit.shah@qumranet.com>
Fri, 27 Jun 2008 12:55:02 +0000 (15:55 +0300)
committerAvi Kivity <avi@qumranet.com>
Wed, 15 Oct 2008 08:15:12 +0000 (10:15 +0200)
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>
arch/x86/kvm/irq.c
arch/x86/kvm/irq.h

index 76d736b5f66464372a95979c0ada398f6f109a1d..0d9e55275af17450136f5506f4bc74c57251bbaa 100644 (file)
@@ -100,3 +100,14 @@ void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
        __kvm_migrate_apic_timer(vcpu);
        __kvm_migrate_pit_timer(vcpu);
 }
+
+/* This should be called with the kvm->lock mutex held */
+void kvm_set_irq(struct kvm *kvm, int irq, int level)
+{
+       /* Not possible to detect if the guest uses the PIC or the
+        * IOAPIC.  So set the bit in both. The guest will ignore
+        * writes to the unused one.
+        */
+       kvm_ioapic_set_irq(kvm->arch.vioapic, irq, level);
+       kvm_pic_set_irq(pic_irqchip(kvm), irq, level);
+}
index 7ca47cbb48bb3c2239a2ebb13975d43f5f9bac4b..07ff2aef0c13722bf38ba5ac5c41561d75a17ea8 100644 (file)
@@ -82,6 +82,8 @@ static inline int irqchip_in_kernel(struct kvm *kvm)
 
 void kvm_pic_reset(struct kvm_kpic_state *s);
 
+void kvm_set_irq(struct kvm *kvm, int irq, int level);
+
 void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
 void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
 void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu);