Lines Matching refs:kfd
53 int kfd_interrupt_init(struct kfd_dev *kfd) in kfd_interrupt_init() argument
57 r = kfifo_alloc(&kfd->ih_fifo, in kfd_interrupt_init()
58 KFD_IH_NUM_ENTRIES * kfd->device_info.ih_ring_entry_size, in kfd_interrupt_init()
61 dev_err(kfd->adev->dev, "Failed to allocate IH fifo\n"); in kfd_interrupt_init()
65 kfd->ih_wq = alloc_workqueue("KFD IH", WQ_HIGHPRI, 1); in kfd_interrupt_init()
66 if (unlikely(!kfd->ih_wq)) { in kfd_interrupt_init()
67 kfifo_free(&kfd->ih_fifo); in kfd_interrupt_init()
68 dev_err(kfd->adev->dev, "Failed to allocate KFD IH workqueue\n"); in kfd_interrupt_init()
71 spin_lock_init(&kfd->interrupt_lock); in kfd_interrupt_init()
73 INIT_WORK(&kfd->interrupt_work, interrupt_wq); in kfd_interrupt_init()
75 kfd->interrupts_active = true; in kfd_interrupt_init()
87 void kfd_interrupt_exit(struct kfd_dev *kfd) in kfd_interrupt_exit() argument
96 spin_lock_irqsave(&kfd->interrupt_lock, flags); in kfd_interrupt_exit()
97 kfd->interrupts_active = false; in kfd_interrupt_exit()
98 spin_unlock_irqrestore(&kfd->interrupt_lock, flags); in kfd_interrupt_exit()
105 flush_workqueue(kfd->ih_wq); in kfd_interrupt_exit()
107 kfifo_free(&kfd->ih_fifo); in kfd_interrupt_exit()
113 bool enqueue_ih_ring_entry(struct kfd_dev *kfd, const void *ih_ring_entry) in enqueue_ih_ring_entry() argument
117 count = kfifo_in(&kfd->ih_fifo, ih_ring_entry, in enqueue_ih_ring_entry()
118 kfd->device_info.ih_ring_entry_size); in enqueue_ih_ring_entry()
119 if (count != kfd->device_info.ih_ring_entry_size) { in enqueue_ih_ring_entry()
120 dev_dbg_ratelimited(kfd->adev->dev, in enqueue_ih_ring_entry()
132 static bool dequeue_ih_ring_entry(struct kfd_dev *kfd, void *ih_ring_entry) in dequeue_ih_ring_entry() argument
136 count = kfifo_out(&kfd->ih_fifo, ih_ring_entry, in dequeue_ih_ring_entry()
137 kfd->device_info.ih_ring_entry_size); in dequeue_ih_ring_entry()
139 WARN_ON(count && count != kfd->device_info.ih_ring_entry_size); in dequeue_ih_ring_entry()
141 return count == kfd->device_info.ih_ring_entry_size; in dequeue_ih_ring_entry()