[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b63ee7a1158855abc5a4ffa815f62d7f249b2bdf.camel@mediatek.com>
Date: Tue, 29 Aug 2023 07:07:48 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>,
Shawn Sung (宋孝謙)
<Shawn.Sung@...iatek.com>, "daniel@...ll.ch" <daniel@...ll.ch>,
"p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
"airlied@...il.com" <airlied@...il.com>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"jassisinghbrar@...il.com" <jassisinghbrar@...il.com>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>
CC: "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
Jason-JH Lin (林睿祥)
<Jason-JH.Lin@...iatek.com>,
Nancy Lin (林欣螢) <Nancy.Lin@...iatek.com>,
Singo Chang (張興國)
<Singo.Chang@...iatek.com>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: Re: [PATCH 03/15] soc: mediatek: Support GCE thread loop
Hi, Hsiao-chien:
On Wed, 2023-08-23 at 23:13 +0800, Hsiao Chien Sung wrote:
> Add a new API to create GCE thread loop by
> appending a command at the end of CMDQ packet
> to jump to the head of it.
>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@...iatek.com>
> ---
> drivers/soc/mediatek/mtk-cmdq-helper.c | 30
> ++++++++++++++++++++++++++
> include/linux/soc/mediatek/mtk-cmdq.h | 2 ++
> 2 files changed, 32 insertions(+)
>
> diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c
> b/drivers/soc/mediatek/mtk-cmdq-helper.c
> index c1837a468267..7d503d491c0d 100644
> --- a/drivers/soc/mediatek/mtk-cmdq-helper.c
> +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
> @@ -430,6 +430,9 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt)
> int err;
> struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
>
> + dma_sync_single_for_device(client->chan->mbox->dev, pkt-
> >pa_base,
> + pkt->cmd_buf_size, DMA_TO_DEVICE);
> +
> err = mbox_send_message(client->chan, pkt);
> if (err < 0)
> return err;
> @@ -440,4 +443,31 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt)
> }
> EXPORT_SYMBOL(cmdq_pkt_flush_async);
>
> +int cmdq_pkt_finalize_loop(struct cmdq_pkt *pkt)
> +{
> + struct cmdq_instruction inst = { {0} };
> + int err;
> + u8 shift_pa = 0;
> +
> + shift_pa = cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)-
> >chan);
> +
> + /* insert EOC and generate IRQ for command iteration */
> + inst.op = CMDQ_CODE_EOC;
> + inst.value = CMDQ_EOC_IRQ_EN;
It's not necessary to trigger IRQ, so drop this.
> + err = cmdq_pkt_append_command(pkt, inst);
> + if (err < 0)
> + return err;
> +
> + /* jump to head of the packet */
> + inst.op = CMDQ_CODE_JUMP;
> + inst.offset = CMDQ_JUMP_RELATIVE;
> + inst.value = pkt->pa_base >> shift_pa;
> + err = cmdq_pkt_append_command(pkt, inst);
This function has only dump function, so rename this function to
relative dump and pass pkt->pa_base by client driver.
Regards,
CK
> +
> + pkt->loop = true;
> +
> + return err;
> +}
> +EXPORT_SYMBOL(cmdq_pkt_finalize_loop);
> +
> MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/soc/mediatek/mtk-cmdq.h
> b/include/linux/soc/mediatek/mtk-cmdq.h
> index 3eb95ef34c6c..4c30f891d924 100644
> --- a/include/linux/soc/mediatek/mtk-cmdq.h
> +++ b/include/linux/soc/mediatek/mtk-cmdq.h
> @@ -273,6 +273,8 @@ int cmdq_pkt_jump(struct cmdq_pkt *pkt,
> dma_addr_t addr);
> */
> int cmdq_pkt_finalize(struct cmdq_pkt *pkt);
>
> +int cmdq_pkt_finalize_loop(struct cmdq_pkt *pkt);
> +
> /**
> * cmdq_pkt_flush_async() - trigger CMDQ to asynchronously execute
> the CMDQ
> * packet and call back at the end of done
> packet
Powered by blists - more mailing lists