[PATCH 04/15] mailbox: mtk-cmdq: Support GCE thread loop

CK Hu (胡俊光) ck.hu at mediatek.com
Tue Aug 29 00:13:50 PDT 2023


Hi, Hsiao-chien:


On Wed, 2023-08-23 at 23:13 +0800, Hsiao Chien Sung wrote:
> Do not disable CMDQ thread if it is a loop.

Once loop thread does not insert CMDQ_CODE_EOC command, this patch
could be dropped.

Regards,
CK

> 
> Signed-off-by: Hsiao Chien Sung <shawn.sung at mediatek.com>
> ---
>  drivers/mailbox/mtk-cmdq-mailbox.c       | 5 +++++
>  include/linux/mailbox/mtk-cmdq-mailbox.h | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c
> b/drivers/mailbox/mtk-cmdq-mailbox.c
> index b18d47ea13a0..88ff39a28415 100644
> --- a/drivers/mailbox/mtk-cmdq-mailbox.c
> +++ b/drivers/mailbox/mtk-cmdq-mailbox.c
> @@ -264,6 +264,11 @@ static void cmdq_thread_irq_handler(struct cmdq
> *cmdq,
>  
>  	curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR) << cmdq-
> >pdata->shift;
>  
> +	task = list_first_entry_or_null(&thread->task_busy_list,
> +					struct cmdq_task, list_entry);
> +	if (task && task->pkt->loop)
> +		return;
> +
>  	list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
>  				 list_entry) {
>  		task_end_pa = task->pa_base + task->pkt->cmd_buf_size;
> diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h
> b/include/linux/mailbox/mtk-cmdq-mailbox.h
> index a8f0070c7aa9..f78a08e7c6ed 100644
> --- a/include/linux/mailbox/mtk-cmdq-mailbox.h
> +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h
> @@ -76,6 +76,7 @@ struct cmdq_pkt {
>  	size_t			cmd_buf_size; /* command occupied
> size */
>  	size_t			buf_size; /* real buffer size */
>  	void			*cl;
> +	bool			loop;
>  };
>  
>  u8 cmdq_get_shift_pa(struct mbox_chan *chan);


More information about the Linux-mediatek mailing list