Lines Matching refs:thread

68 	struct cmdq_thread	*thread;  member
78 struct cmdq_thread *thread; member
101 static int cmdq_thread_suspend(struct cmdq *cmdq, struct cmdq_thread *thread) in cmdq_thread_suspend() argument
105 writel(CMDQ_THR_SUSPEND, thread->base + CMDQ_THR_SUSPEND_TASK); in cmdq_thread_suspend()
108 if (!(readl(thread->base + CMDQ_THR_ENABLE_TASK) & CMDQ_THR_ENABLED)) in cmdq_thread_suspend()
111 if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_CURR_STATUS, in cmdq_thread_suspend()
114 (u32)(thread->base - cmdq->base)); in cmdq_thread_suspend()
121 static void cmdq_thread_resume(struct cmdq_thread *thread) in cmdq_thread_resume() argument
123 writel(CMDQ_THR_RESUME, thread->base + CMDQ_THR_SUSPEND_TASK); in cmdq_thread_resume()
139 static int cmdq_thread_reset(struct cmdq *cmdq, struct cmdq_thread *thread) in cmdq_thread_reset() argument
143 writel(CMDQ_THR_DO_WARM_RESET, thread->base + CMDQ_THR_WARM_RESET); in cmdq_thread_reset()
144 if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_WARM_RESET, in cmdq_thread_reset()
148 (u32)(thread->base - cmdq->base)); in cmdq_thread_reset()
155 static void cmdq_thread_disable(struct cmdq *cmdq, struct cmdq_thread *thread) in cmdq_thread_disable() argument
157 cmdq_thread_reset(cmdq, thread); in cmdq_thread_disable()
158 writel(CMDQ_THR_DISABLED, thread->base + CMDQ_THR_ENABLE_TASK); in cmdq_thread_disable()
162 static void cmdq_thread_invalidate_fetched_data(struct cmdq_thread *thread) in cmdq_thread_invalidate_fetched_data() argument
164 writel(readl(thread->base + CMDQ_THR_CURR_ADDR), in cmdq_thread_invalidate_fetched_data()
165 thread->base + CMDQ_THR_CURR_ADDR); in cmdq_thread_invalidate_fetched_data()
171 struct cmdq_thread *thread = task->thread; in cmdq_task_insert_into_thread() local
173 &thread->task_busy_list, typeof(*task), list_entry); in cmdq_task_insert_into_thread()
185 cmdq_thread_invalidate_fetched_data(thread); in cmdq_task_insert_into_thread()
188 static bool cmdq_thread_is_in_wfe(struct cmdq_thread *thread) in cmdq_thread_is_in_wfe() argument
190 return readl(thread->base + CMDQ_THR_WAIT_TOKEN) & CMDQ_THR_IS_WAITING; in cmdq_thread_is_in_wfe()
204 mbox_chan_received_data(task->thread->chan, &data); in cmdq_task_exec_done()
211 struct cmdq_thread *thread = task->thread; in cmdq_task_handle_error() local
216 WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0); in cmdq_task_handle_error()
217 next_task = list_first_entry_or_null(&thread->task_busy_list, in cmdq_task_handle_error()
221 thread->base + CMDQ_THR_CURR_ADDR); in cmdq_task_handle_error()
222 cmdq_thread_resume(thread); in cmdq_task_handle_error()
226 struct cmdq_thread *thread) in cmdq_thread_irq_handler() argument
232 irq_flag = readl(thread->base + CMDQ_THR_IRQ_STATUS); in cmdq_thread_irq_handler()
233 writel(~irq_flag, thread->base + CMDQ_THR_IRQ_STATUS); in cmdq_thread_irq_handler()
241 if (!(readl(thread->base + CMDQ_THR_ENABLE_TASK) & CMDQ_THR_ENABLED)) in cmdq_thread_irq_handler()
251 curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR) << cmdq->shift_pa; in cmdq_thread_irq_handler()
253 list_for_each_entry_safe(task, tmp, &thread->task_busy_list, in cmdq_thread_irq_handler()
272 if (list_empty(&thread->task_busy_list)) { in cmdq_thread_irq_handler()
273 cmdq_thread_disable(cmdq, thread); in cmdq_thread_irq_handler()
289 struct cmdq_thread *thread = &cmdq->thread[bit]; in cmdq_irq_handler() local
291 spin_lock_irqsave(&thread->chan->lock, flags); in cmdq_irq_handler()
292 cmdq_thread_irq_handler(cmdq, thread); in cmdq_irq_handler()
293 spin_unlock_irqrestore(&thread->chan->lock, flags); in cmdq_irq_handler()
302 struct cmdq_thread *thread; in cmdq_suspend() local
309 thread = &cmdq->thread[i]; in cmdq_suspend()
310 if (!list_empty(&thread->task_busy_list)) { in cmdq_suspend()
344 struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv; in cmdq_mbox_send_data() local
359 task->thread = thread; in cmdq_mbox_send_data()
362 if (list_empty(&thread->task_busy_list)) { in cmdq_mbox_send_data()
371 WARN_ON(cmdq_thread_reset(cmdq, thread) < 0); in cmdq_mbox_send_data()
374 thread->base + CMDQ_THR_CURR_ADDR); in cmdq_mbox_send_data()
376 thread->base + CMDQ_THR_END_ADDR); in cmdq_mbox_send_data()
378 writel(thread->priority, thread->base + CMDQ_THR_PRIORITY); in cmdq_mbox_send_data()
379 writel(CMDQ_THR_IRQ_EN, thread->base + CMDQ_THR_IRQ_ENABLE); in cmdq_mbox_send_data()
380 writel(CMDQ_THR_ENABLED, thread->base + CMDQ_THR_ENABLE_TASK); in cmdq_mbox_send_data()
382 WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0); in cmdq_mbox_send_data()
383 curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR) << in cmdq_mbox_send_data()
385 end_pa = readl(thread->base + CMDQ_THR_END_ADDR) << in cmdq_mbox_send_data()
392 thread->base + CMDQ_THR_CURR_ADDR); in cmdq_mbox_send_data()
398 thread->base + CMDQ_THR_END_ADDR); in cmdq_mbox_send_data()
399 cmdq_thread_resume(thread); in cmdq_mbox_send_data()
401 list_move_tail(&task->list_entry, &thread->task_busy_list); in cmdq_mbox_send_data()
413 struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv; in cmdq_mbox_shutdown() local
418 spin_lock_irqsave(&thread->chan->lock, flags); in cmdq_mbox_shutdown()
419 if (list_empty(&thread->task_busy_list)) in cmdq_mbox_shutdown()
422 WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0); in cmdq_mbox_shutdown()
425 cmdq_thread_irq_handler(cmdq, thread); in cmdq_mbox_shutdown()
426 if (list_empty(&thread->task_busy_list)) in cmdq_mbox_shutdown()
429 list_for_each_entry_safe(task, tmp, &thread->task_busy_list, in cmdq_mbox_shutdown()
435 cmdq_thread_disable(cmdq, thread); in cmdq_mbox_shutdown()
445 spin_unlock_irqrestore(&thread->chan->lock, flags); in cmdq_mbox_shutdown()
450 struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv; in cmdq_mbox_flush() local
458 spin_lock_irqsave(&thread->chan->lock, flags); in cmdq_mbox_flush()
459 if (list_empty(&thread->task_busy_list)) in cmdq_mbox_flush()
462 WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0); in cmdq_mbox_flush()
463 if (!cmdq_thread_is_in_wfe(thread)) in cmdq_mbox_flush()
466 list_for_each_entry_safe(task, tmp, &thread->task_busy_list, in cmdq_mbox_flush()
475 mbox_chan_received_data(task->thread->chan, &data); in cmdq_mbox_flush()
480 cmdq_thread_resume(thread); in cmdq_mbox_flush()
481 cmdq_thread_disable(cmdq, thread); in cmdq_mbox_flush()
485 spin_unlock_irqrestore(&thread->chan->lock, flags); in cmdq_mbox_flush()
489 cmdq_thread_resume(thread); in cmdq_mbox_flush()
490 spin_unlock_irqrestore(&thread->chan->lock, flags); in cmdq_mbox_flush()
491 if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_ENABLE_TASK, in cmdq_mbox_flush()
494 (u32)(thread->base - cmdq->base)); in cmdq_mbox_flush()
512 struct cmdq_thread *thread; in cmdq_xlate() local
517 thread = (struct cmdq_thread *)mbox->chans[ind].con_priv; in cmdq_xlate()
518 thread->priority = sp->args[1]; in cmdq_xlate()
519 thread->chan = &mbox->chans[ind]; in cmdq_xlate()
604 cmdq->thread = devm_kcalloc(dev, cmdq->thread_nr, in cmdq_probe()
605 sizeof(*cmdq->thread), GFP_KERNEL); in cmdq_probe()
606 if (!cmdq->thread) in cmdq_probe()
610 cmdq->thread[i].base = cmdq->base + CMDQ_THR_BASE + in cmdq_probe()
612 INIT_LIST_HEAD(&cmdq->thread[i].task_busy_list); in cmdq_probe()
613 cmdq->mbox.chans[i].con_priv = (void *)&cmdq->thread[i]; in cmdq_probe()