aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/irq_comm.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-01-04 10:10:50 -0500
committerAvi Kivity <avi@redhat.com>2009-03-24 05:03:03 -0400
commit75858a84a6207f5e60196f6bbd18fde4250e5759 (patch)
treead8ab5d60a616270c61d88a9af08713cefbc9d35 /virt/kvm/irq_comm.c
parent5d9b8e30f543a9f21a968a4cda71e8f6d1c66a61 (diff)
KVM: Interrupt mask notifiers for ioapic
Allow clients to request notifications when the guest masks or unmasks a particular irq line. This complements irq ack notifications, as the guest will not ack an irq line that is masked. Currently implemented for the ioapic only. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm/irq_comm.c')
-rw-r--r--virt/kvm/irq_comm.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index aa5d1e5c497e..5162a411e4d2 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -99,3 +99,27 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
99 clear_bit(irq_source_id, &kvm->arch.irq_states[i]); 99 clear_bit(irq_source_id, &kvm->arch.irq_states[i]);
100 clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap); 100 clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
101} 101}
102
103void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq,
104 struct kvm_irq_mask_notifier *kimn)
105{
106 kimn->irq = irq;
107 hlist_add_head(&kimn->link, &kvm->mask_notifier_list);
108}
109
110void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
111 struct kvm_irq_mask_notifier *kimn)
112{
113 hlist_del(&kimn->link);
114}
115
116void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask)
117{
118 struct kvm_irq_mask_notifier *kimn;
119 struct hlist_node *n;
120
121 hlist_for_each_entry(kimn, n, &kvm->mask_notifier_list, link)
122 if (kimn->irq == irq)
123 kimn->func(kimn, mask);
124}
125