diff options
author | Avi Kivity <avi@redhat.com> | 2009-01-04 17:10:50 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-03-24 11:03:03 +0200 |
commit | 75858a84a6207f5e60196f6bbd18fde4250e5759 (patch) | |
tree | ad8ab5d60a616270c61d88a9af08713cefbc9d35 /virt/kvm/irq_comm.c | |
parent | 5d9b8e30f543a9f21a968a4cda71e8f6d1c66a61 (diff) | |
download | linux-75858a84a6207f5e60196f6bbd18fde4250e5759.tar.gz linux-75858a84a6207f5e60196f6bbd18fde4250e5759.tar.bz2 linux-75858a84a6207f5e60196f6bbd18fde4250e5759.zip |
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.c | 24 |
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) clear_bit(irq_source_id, &kvm->arch.irq_states[i]); clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap); } + +void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq, + struct kvm_irq_mask_notifier *kimn) +{ + kimn->irq = irq; + hlist_add_head(&kimn->link, &kvm->mask_notifier_list); +} + +void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, + struct kvm_irq_mask_notifier *kimn) +{ + hlist_del(&kimn->link); +} + +void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask) +{ + struct kvm_irq_mask_notifier *kimn; + struct hlist_node *n; + + hlist_for_each_entry(kimn, n, &kvm->mask_notifier_list, link) + if (kimn->irq == irq) + kimn->func(kimn, mask); +} + |