Lines Matching refs:virqfd
35 static void virqfd_deactivate(struct virqfd *virqfd) in virqfd_deactivate() argument
37 queue_work(vfio_irqfd_cleanup_wq, &virqfd->shutdown); in virqfd_deactivate()
42 struct virqfd *virqfd = container_of(wait, struct virqfd, wait); in virqfd_wakeup() local
47 eventfd_ctx_do_read(virqfd->eventfd, &cnt); in virqfd_wakeup()
50 if ((!virqfd->handler || in virqfd_wakeup()
51 virqfd->handler(virqfd->opaque, virqfd->data)) && in virqfd_wakeup()
52 virqfd->thread) in virqfd_wakeup()
53 schedule_work(&virqfd->inject); in virqfd_wakeup()
67 if (*(virqfd->pvirqfd) == virqfd) { in virqfd_wakeup()
68 *(virqfd->pvirqfd) = NULL; in virqfd_wakeup()
69 virqfd_deactivate(virqfd); in virqfd_wakeup()
81 struct virqfd *virqfd = container_of(pt, struct virqfd, pt); in virqfd_ptable_queue_proc() local
82 add_wait_queue(wqh, &virqfd->wait); in virqfd_ptable_queue_proc()
87 struct virqfd *virqfd = container_of(work, struct virqfd, shutdown); in virqfd_shutdown() local
90 eventfd_ctx_remove_wait_queue(virqfd->eventfd, &virqfd->wait, &cnt); in virqfd_shutdown()
91 flush_work(&virqfd->inject); in virqfd_shutdown()
92 eventfd_ctx_put(virqfd->eventfd); in virqfd_shutdown()
94 kfree(virqfd); in virqfd_shutdown()
99 struct virqfd *virqfd = container_of(work, struct virqfd, inject); in virqfd_inject() local
100 if (virqfd->thread) in virqfd_inject()
101 virqfd->thread(virqfd->opaque, virqfd->data); in virqfd_inject()
106 struct virqfd *virqfd = container_of(work, struct virqfd, flush_inject); in virqfd_flush_inject() local
108 flush_work(&virqfd->inject); in virqfd_flush_inject()
114 void *data, struct virqfd **pvirqfd, int fd) in vfio_virqfd_enable()
118 struct virqfd *virqfd; in vfio_virqfd_enable() local
122 virqfd = kzalloc(sizeof(*virqfd), GFP_KERNEL_ACCOUNT); in vfio_virqfd_enable()
123 if (!virqfd) in vfio_virqfd_enable()
126 virqfd->pvirqfd = pvirqfd; in vfio_virqfd_enable()
127 virqfd->opaque = opaque; in vfio_virqfd_enable()
128 virqfd->handler = handler; in vfio_virqfd_enable()
129 virqfd->thread = thread; in vfio_virqfd_enable()
130 virqfd->data = data; in vfio_virqfd_enable()
132 INIT_WORK(&virqfd->shutdown, virqfd_shutdown); in vfio_virqfd_enable()
133 INIT_WORK(&virqfd->inject, virqfd_inject); in vfio_virqfd_enable()
134 INIT_WORK(&virqfd->flush_inject, virqfd_flush_inject); in vfio_virqfd_enable()
148 virqfd->eventfd = ctx; in vfio_virqfd_enable()
163 *pvirqfd = virqfd; in vfio_virqfd_enable()
171 init_waitqueue_func_entry(&virqfd->wait, virqfd_wakeup); in vfio_virqfd_enable()
172 init_poll_funcptr(&virqfd->pt, virqfd_ptable_queue_proc); in vfio_virqfd_enable()
174 events = vfs_poll(fd_file(irqfd), &virqfd->pt); in vfio_virqfd_enable()
182 schedule_work(&virqfd->inject); in vfio_virqfd_enable()
197 kfree(virqfd); in vfio_virqfd_enable()
203 void vfio_virqfd_disable(struct virqfd **pvirqfd) in vfio_virqfd_disable()
225 void vfio_virqfd_flush_thread(struct virqfd **pvirqfd) in vfio_virqfd_flush_thread()