diff options
Diffstat (limited to 'virt/kvm/irq_comm.c')
-rw-r--r-- | virt/kvm/irq_comm.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c index 656fa455e154..ff6d40e2c06d 100644 --- a/virt/kvm/irq_comm.c +++ b/virt/kvm/irq_comm.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/kvm_host.h> | 23 | #include <linux/kvm_host.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/export.h> | ||
25 | #include <trace/events/kvm.h> | 26 | #include <trace/events/kvm.h> |
26 | 27 | ||
27 | #include <asm/msidef.h> | 28 | #include <asm/msidef.h> |
@@ -237,6 +238,28 @@ int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level) | |||
237 | return ret; | 238 | return ret; |
238 | } | 239 | } |
239 | 240 | ||
241 | bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin) | ||
242 | { | ||
243 | struct kvm_irq_ack_notifier *kian; | ||
244 | struct hlist_node *n; | ||
245 | int gsi; | ||
246 | |||
247 | rcu_read_lock(); | ||
248 | gsi = rcu_dereference(kvm->irq_routing)->chip[irqchip][pin]; | ||
249 | if (gsi != -1) | ||
250 | hlist_for_each_entry_rcu(kian, n, &kvm->irq_ack_notifier_list, | ||
251 | link) | ||
252 | if (kian->gsi == gsi) { | ||
253 | rcu_read_unlock(); | ||
254 | return true; | ||
255 | } | ||
256 | |||
257 | rcu_read_unlock(); | ||
258 | |||
259 | return false; | ||
260 | } | ||
261 | EXPORT_SYMBOL_GPL(kvm_irq_has_notifier); | ||
262 | |||
240 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin) | 263 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin) |
241 | { | 264 | { |
242 | struct kvm_irq_ack_notifier *kian; | 265 | struct kvm_irq_ack_notifier *kian; |
@@ -261,6 +284,7 @@ void kvm_register_irq_ack_notifier(struct kvm *kvm, | |||
261 | mutex_lock(&kvm->irq_lock); | 284 | mutex_lock(&kvm->irq_lock); |
262 | hlist_add_head_rcu(&kian->link, &kvm->irq_ack_notifier_list); | 285 | hlist_add_head_rcu(&kian->link, &kvm->irq_ack_notifier_list); |
263 | mutex_unlock(&kvm->irq_lock); | 286 | mutex_unlock(&kvm->irq_lock); |
287 | kvm_ioapic_make_eoibitmap_request(kvm); | ||
264 | } | 288 | } |
265 | 289 | ||
266 | void kvm_unregister_irq_ack_notifier(struct kvm *kvm, | 290 | void kvm_unregister_irq_ack_notifier(struct kvm *kvm, |
@@ -270,6 +294,7 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm, | |||
270 | hlist_del_init_rcu(&kian->link); | 294 | hlist_del_init_rcu(&kian->link); |
271 | mutex_unlock(&kvm->irq_lock); | 295 | mutex_unlock(&kvm->irq_lock); |
272 | synchronize_rcu(); | 296 | synchronize_rcu(); |
297 | kvm_ioapic_make_eoibitmap_request(kvm); | ||
273 | } | 298 | } |
274 | 299 | ||
275 | int kvm_request_irq_source_id(struct kvm *kvm) | 300 | int kvm_request_irq_source_id(struct kvm *kvm) |