• Home
  • Raw
  • Download

Lines Matching refs:kvm

36 kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args)  in kvm_arch_irqfd_allowed()  argument
46 struct kvm *kvm = irqfd->kvm; in irqfd_inject() local
49 kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 1, in irqfd_inject()
51 kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 0, in irqfd_inject()
54 kvm_set_irq(kvm, KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID, in irqfd_inject()
67 struct kvm *kvm; in irqfd_resampler_ack() local
73 kvm = resampler->kvm; in irqfd_resampler_ack()
75 kvm_set_irq(kvm, KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID, in irqfd_resampler_ack()
78 idx = srcu_read_lock(&kvm->irq_srcu); in irqfd_resampler_ack()
83 srcu_read_unlock(&kvm->irq_srcu, idx); in irqfd_resampler_ack()
90 struct kvm *kvm = resampler->kvm; in irqfd_resampler_shutdown() local
92 mutex_lock(&kvm->irqfds.resampler_lock); in irqfd_resampler_shutdown()
95 synchronize_srcu(&kvm->irq_srcu); in irqfd_resampler_shutdown()
99 kvm_unregister_irq_ack_notifier(kvm, &resampler->notifier); in irqfd_resampler_shutdown()
100 kvm_set_irq(kvm, KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID, in irqfd_resampler_shutdown()
105 mutex_unlock(&kvm->irqfds.resampler_lock); in irqfd_resampler_shutdown()
116 struct kvm *kvm = irqfd->kvm; in irqfd_shutdown() local
120 synchronize_srcu(&kvm->irq_srcu); in irqfd_shutdown()
174 struct kvm *kvm, int irq_source_id, in kvm_arch_set_irq_inatomic() argument
191 struct kvm *kvm = irqfd->kvm; in irqfd_wakeup() local
196 idx = srcu_read_lock(&kvm->irq_srcu); in irqfd_wakeup()
202 if (kvm_arch_set_irq_inatomic(&irq, kvm, in irqfd_wakeup()
206 srcu_read_unlock(&kvm->irq_srcu, idx); in irqfd_wakeup()
213 spin_lock_irqsave(&kvm->irqfds.lock, iflags); in irqfd_wakeup()
227 spin_unlock_irqrestore(&kvm->irqfds.lock, iflags); in irqfd_wakeup()
243 static void irqfd_update(struct kvm *kvm, struct kvm_kernel_irqfd *irqfd) in irqfd_update() argument
249 n_entries = kvm_irq_map_gsi(kvm, entries, irqfd->gsi); in irqfd_update()
274 struct kvm *kvm, unsigned int host_irq, in kvm_arch_update_irqfd_routing() argument
282 kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args) in kvm_irqfd_assign() argument
291 if (!kvm_arch_intc_initialized(kvm)) in kvm_irqfd_assign()
294 if (!kvm_arch_irqfd_allowed(kvm, args)) in kvm_irqfd_assign()
301 irqfd->kvm = kvm; in kvm_irqfd_assign()
334 mutex_lock(&kvm->irqfds.resampler_lock); in kvm_irqfd_assign()
337 &kvm->irqfds.resampler_list, link) { in kvm_irqfd_assign()
349 mutex_unlock(&kvm->irqfds.resampler_lock); in kvm_irqfd_assign()
353 resampler->kvm = kvm; in kvm_irqfd_assign()
359 list_add(&resampler->link, &kvm->irqfds.resampler_list); in kvm_irqfd_assign()
360 kvm_register_irq_ack_notifier(kvm, in kvm_irqfd_assign()
366 synchronize_srcu(&kvm->irq_srcu); in kvm_irqfd_assign()
368 mutex_unlock(&kvm->irqfds.resampler_lock); in kvm_irqfd_assign()
378 spin_lock_irq(&kvm->irqfds.lock); in kvm_irqfd_assign()
381 list_for_each_entry(tmp, &kvm->irqfds.items, list) { in kvm_irqfd_assign()
386 spin_unlock_irq(&kvm->irqfds.lock); in kvm_irqfd_assign()
390 idx = srcu_read_lock(&kvm->irq_srcu); in kvm_irqfd_assign()
391 irqfd_update(kvm, irqfd); in kvm_irqfd_assign()
393 list_add_tail(&irqfd->list, &kvm->irqfds.items); in kvm_irqfd_assign()
395 spin_unlock_irq(&kvm->irqfds.lock); in kvm_irqfd_assign()
420 srcu_read_unlock(&kvm->irq_srcu, idx); in kvm_irqfd_assign()
446 bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin) in kvm_irq_has_notifier() argument
451 idx = srcu_read_lock(&kvm->irq_srcu); in kvm_irq_has_notifier()
452 gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin); in kvm_irq_has_notifier()
454 hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, in kvm_irq_has_notifier()
457 srcu_read_unlock(&kvm->irq_srcu, idx); in kvm_irq_has_notifier()
461 srcu_read_unlock(&kvm->irq_srcu, idx); in kvm_irq_has_notifier()
467 void kvm_notify_acked_gsi(struct kvm *kvm, int gsi) in kvm_notify_acked_gsi() argument
471 hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, in kvm_notify_acked_gsi()
477 void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin) in kvm_notify_acked_irq() argument
483 idx = srcu_read_lock(&kvm->irq_srcu); in kvm_notify_acked_irq()
484 gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin); in kvm_notify_acked_irq()
486 kvm_notify_acked_gsi(kvm, gsi); in kvm_notify_acked_irq()
487 srcu_read_unlock(&kvm->irq_srcu, idx); in kvm_notify_acked_irq()
490 void kvm_register_irq_ack_notifier(struct kvm *kvm, in kvm_register_irq_ack_notifier() argument
493 mutex_lock(&kvm->irq_lock); in kvm_register_irq_ack_notifier()
494 hlist_add_head_rcu(&kian->link, &kvm->irq_ack_notifier_list); in kvm_register_irq_ack_notifier()
495 mutex_unlock(&kvm->irq_lock); in kvm_register_irq_ack_notifier()
496 kvm_arch_post_irq_ack_notifier_list_update(kvm); in kvm_register_irq_ack_notifier()
499 void kvm_unregister_irq_ack_notifier(struct kvm *kvm, in kvm_unregister_irq_ack_notifier() argument
502 mutex_lock(&kvm->irq_lock); in kvm_unregister_irq_ack_notifier()
504 mutex_unlock(&kvm->irq_lock); in kvm_unregister_irq_ack_notifier()
505 synchronize_srcu(&kvm->irq_srcu); in kvm_unregister_irq_ack_notifier()
506 kvm_arch_post_irq_ack_notifier_list_update(kvm); in kvm_unregister_irq_ack_notifier()
511 kvm_eventfd_init(struct kvm *kvm) in kvm_eventfd_init() argument
514 spin_lock_init(&kvm->irqfds.lock); in kvm_eventfd_init()
515 INIT_LIST_HEAD(&kvm->irqfds.items); in kvm_eventfd_init()
516 INIT_LIST_HEAD(&kvm->irqfds.resampler_list); in kvm_eventfd_init()
517 mutex_init(&kvm->irqfds.resampler_lock); in kvm_eventfd_init()
519 INIT_LIST_HEAD(&kvm->ioeventfds); in kvm_eventfd_init()
527 kvm_irqfd_deassign(struct kvm *kvm, struct kvm_irqfd *args) in kvm_irqfd_deassign() argument
536 spin_lock_irq(&kvm->irqfds.lock); in kvm_irqfd_deassign()
538 list_for_each_entry_safe(irqfd, tmp, &kvm->irqfds.items, list) { in kvm_irqfd_deassign()
553 spin_unlock_irq(&kvm->irqfds.lock); in kvm_irqfd_deassign()
567 kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) in kvm_irqfd() argument
573 return kvm_irqfd_deassign(kvm, args); in kvm_irqfd()
575 return kvm_irqfd_assign(kvm, args); in kvm_irqfd()
583 kvm_irqfd_release(struct kvm *kvm) in kvm_irqfd_release() argument
587 spin_lock_irq(&kvm->irqfds.lock); in kvm_irqfd_release()
589 list_for_each_entry_safe(irqfd, tmp, &kvm->irqfds.items, list) in kvm_irqfd_release()
592 spin_unlock_irq(&kvm->irqfds.lock); in kvm_irqfd_release()
606 void kvm_irq_routing_update(struct kvm *kvm) in kvm_irq_routing_update() argument
610 spin_lock_irq(&kvm->irqfds.lock); in kvm_irq_routing_update()
612 list_for_each_entry(irqfd, &kvm->irqfds.items, list) { in kvm_irq_routing_update()
613 irqfd_update(kvm, irqfd); in kvm_irq_routing_update()
618 irqfd->kvm, irqfd->producer->irq, in kvm_irq_routing_update()
625 spin_unlock_irq(&kvm->irqfds.lock); in kvm_irq_routing_update()
760 ioeventfd_check_collision(struct kvm *kvm, struct _ioeventfd *p) in ioeventfd_check_collision() argument
764 list_for_each_entry(_p, &kvm->ioeventfds, list) in ioeventfd_check_collision()
785 static int kvm_assign_ioeventfd_idx(struct kvm *kvm, in kvm_assign_ioeventfd_idx() argument
816 mutex_lock(&kvm->slots_lock); in kvm_assign_ioeventfd_idx()
819 if (ioeventfd_check_collision(kvm, p)) { in kvm_assign_ioeventfd_idx()
826 ret = kvm_io_bus_register_dev(kvm, bus_idx, p->addr, p->length, in kvm_assign_ioeventfd_idx()
831 kvm_get_bus(kvm, bus_idx)->ioeventfd_count++; in kvm_assign_ioeventfd_idx()
832 list_add_tail(&p->list, &kvm->ioeventfds); in kvm_assign_ioeventfd_idx()
834 mutex_unlock(&kvm->slots_lock); in kvm_assign_ioeventfd_idx()
839 mutex_unlock(&kvm->slots_lock); in kvm_assign_ioeventfd_idx()
849 kvm_deassign_ioeventfd_idx(struct kvm *kvm, enum kvm_bus bus_idx, in kvm_deassign_ioeventfd_idx() argument
861 mutex_lock(&kvm->slots_lock); in kvm_deassign_ioeventfd_idx()
863 list_for_each_entry_safe(p, tmp, &kvm->ioeventfds, list) { in kvm_deassign_ioeventfd_idx()
876 kvm_io_bus_unregister_dev(kvm, bus_idx, &p->dev); in kvm_deassign_ioeventfd_idx()
877 bus = kvm_get_bus(kvm, bus_idx); in kvm_deassign_ioeventfd_idx()
885 mutex_unlock(&kvm->slots_lock); in kvm_deassign_ioeventfd_idx()
892 static int kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) in kvm_deassign_ioeventfd() argument
895 int ret = kvm_deassign_ioeventfd_idx(kvm, bus_idx, args); in kvm_deassign_ioeventfd()
898 kvm_deassign_ioeventfd_idx(kvm, KVM_FAST_MMIO_BUS, args); in kvm_deassign_ioeventfd()
904 kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) in kvm_assign_ioeventfd() argument
934 ret = kvm_assign_ioeventfd_idx(kvm, bus_idx, args); in kvm_assign_ioeventfd()
942 ret = kvm_assign_ioeventfd_idx(kvm, KVM_FAST_MMIO_BUS, args); in kvm_assign_ioeventfd()
950 kvm_deassign_ioeventfd_idx(kvm, bus_idx, args); in kvm_assign_ioeventfd()
956 kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) in kvm_ioeventfd() argument
959 return kvm_deassign_ioeventfd(kvm, args); in kvm_ioeventfd()
961 return kvm_assign_ioeventfd(kvm, args); in kvm_ioeventfd()