aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/irqchip.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2014-06-30 06:51:12 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2014-08-05 08:26:24 -0400
commite4d57e1ee1ab59f0cef0272800ac6c52e0ec814a (patch)
tree9659cfbdb348479f17090704034e7f9e545ee122 /virt/kvm/irqchip.c
parent9957c86d659a4d5a2bed25ccbd3bfc9c3f25e658 (diff)
KVM: Move irq notifier implementation into eventfd.c
This moves the functions kvm_irq_has_notifier(), kvm_notify_acked_irq(), kvm_register_irq_ack_notifier() and kvm_unregister_irq_ack_notifier() from irqchip.c to eventfd.c. The reason for doing this is that those functions are used in connection with IRQFDs, which are implemented in eventfd.c. In future we will want to use IRQFDs on platforms that don't implement the GSI routing implemented in irqchip.c, so we won't be compiling in irqchip.c, but we still need the irq notifiers. The implementation is unchanged. Signed-off-by: Paul Mackerras <paulus@samba.org> Tested-by: Eric Auger <eric.auger@linaro.org> Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm/irqchip.c')
-rw-r--r--virt/kvm/irqchip.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 04faac50cef5..7f256f31df10 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -69,67 +69,6 @@ int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin)
69 return irq_rt->chip[irqchip][pin]; 69 return irq_rt->chip[irqchip][pin];
70} 70}
71 71
72bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin)
73{
74 struct kvm_irq_ack_notifier *kian;
75 int gsi, idx;
76
77 idx = srcu_read_lock(&kvm->irq_srcu);
78 gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin);
79 if (gsi != -1)
80 hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list,
81 link)
82 if (kian->gsi == gsi) {
83 srcu_read_unlock(&kvm->irq_srcu, idx);
84 return true;
85 }
86
87 srcu_read_unlock(&kvm->irq_srcu, idx);
88
89 return false;
90}
91EXPORT_SYMBOL_GPL(kvm_irq_has_notifier);
92
93void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
94{
95 struct kvm_irq_ack_notifier *kian;
96 int gsi, idx;
97
98 trace_kvm_ack_irq(irqchip, pin);
99
100 idx = srcu_read_lock(&kvm->irq_srcu);
101 gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin);
102 if (gsi != -1)
103 hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list,
104 link)
105 if (kian->gsi == gsi)
106 kian->irq_acked(kian);
107 srcu_read_unlock(&kvm->irq_srcu, idx);
108}
109
110void kvm_register_irq_ack_notifier(struct kvm *kvm,
111 struct kvm_irq_ack_notifier *kian)
112{
113 mutex_lock(&kvm->irq_lock);
114 hlist_add_head_rcu(&kian->link, &kvm->irq_ack_notifier_list);
115 mutex_unlock(&kvm->irq_lock);
116#ifdef __KVM_HAVE_IOAPIC
117 kvm_vcpu_request_scan_ioapic(kvm);
118#endif
119}
120
121void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
122 struct kvm_irq_ack_notifier *kian)
123{
124 mutex_lock(&kvm->irq_lock);
125 hlist_del_init_rcu(&kian->link);
126 mutex_unlock(&kvm->irq_lock);
127 synchronize_srcu(&kvm->irq_srcu);
128#ifdef __KVM_HAVE_IOAPIC
129 kvm_vcpu_request_scan_ioapic(kvm);
130#endif
131}
132
133int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi) 72int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi)
134{ 73{
135 struct kvm_kernel_irq_routing_entry route; 74 struct kvm_kernel_irq_routing_entry route;