From: Shawn Sung <shawn.sung@mediatek.com>
To: CK Hu <ck.hu@mediatek.com>, Jassi Brar <jassisinghbrar@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Hsiao Chien Sung <shawn.sung@mediatek.com>,
"Jason-JH . Lin" <jason-jh.lin@mediatek.com>,
Houlong Wei <houlong.wei@mediatek.com>,
<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>
Subject: [PATCH v5 06/10] soc: mediatek: cmdq: Add cmdq_pkt_finalize_loop for looping cmd with irq
Date: Wed, 3 Apr 2024 18:25:58 +0800 [thread overview]
Message-ID: <20240403102602.32155-7-shawn.sung@mediatek.com> (raw)
In-Reply-To: <20240403102602.32155-1-shawn.sung@mediatek.com>
From: "Jason-JH.Lin" <jason-jh.lin@mediatek.com>
Add cmdq_pkt_finalize_loop to CMDQ driver.
cmdq_pkt_finalize_loop appends end of command(EOC) instruction and
jump to start of command buffer instruction to make the command
buffer loopable.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/soc/mediatek/mtk-cmdq-helper.c | 23 +++++++++++++++++++++++
include/linux/soc/mediatek/mtk-cmdq.h | 8 ++++++++
2 files changed, 31 insertions(+)
diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c
index 42a0194198d5b..3e5a9c4592fd0 100644
--- a/drivers/soc/mediatek/mtk-cmdq-helper.c
+++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
@@ -568,6 +568,29 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
}
EXPORT_SYMBOL(cmdq_pkt_finalize);
+int cmdq_pkt_finalize_loop(struct cmdq_pkt *pkt)
+{
+ struct cmdq_instruction inst = { {0} };
+ int err;
+
+ /* insert EOC and generate IRQ for each command iteration */
+ inst.op = CMDQ_CODE_EOC;
+ inst.value = CMDQ_EOC_IRQ_EN;
+ err = cmdq_pkt_append_command(pkt, inst);
+ if (err < 0)
+ return err;
+
+ /* JUMP to start of pkt */
+ err = cmdq_pkt_jump(pkt, pkt->pa_base);
+ if (err < 0)
+ return err;
+
+ pkt->loop = true;
+
+ return err;
+}
+EXPORT_SYMBOL(cmdq_pkt_finalize_loop);
+
int cmdq_pkt_flush_async(struct cmdq_pkt *pkt)
{
int err;
diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h
index 7bd77d40a5720..f986117d930c0 100644
--- a/include/linux/soc/mediatek/mtk-cmdq.h
+++ b/include/linux/soc/mediatek/mtk-cmdq.h
@@ -371,6 +371,14 @@ int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr);
*/
int cmdq_pkt_finalize(struct cmdq_pkt *pkt);
+/**
+ * cmdq_pkt_finalize_loop() - Append EOC and jump to start command.
+ * @pkt: the CMDQ packet
+ *
+ * Return: 0 for success; else the error code is returned
+ */
+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
--
2.18.0
next prev parent reply other threads:[~2024-04-03 10:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 10:25 [PATCH v5 00/10] Add CMDQ secure driver for SVP Shawn Sung
2024-04-03 10:25 ` [PATCH v5 01/10] dt-bindings: gce: mt8195: Add CMDQ_SYNC_TOKEN_SECURE_THR_EOF event id Shawn Sung
2024-04-03 10:25 ` [PATCH v5 02/10] dt-bindings: mailbox: Add mboxes property for CMDQ secure driver Shawn Sung
2024-04-03 11:43 ` Rob Herring
2024-04-03 15:46 ` Conor Dooley
2024-04-04 4:31 ` Jason-JH Lin (林睿祥)
2024-04-04 14:52 ` Conor Dooley
2024-04-05 14:33 ` Jason-JH Lin (林睿祥)
2024-04-05 16:13 ` Conor Dooley
2024-04-06 16:15 ` Jason-JH Lin (林睿祥)
2024-04-09 17:52 ` Conor Dooley
2024-04-12 9:00 ` Jason-JH Lin (林睿祥)
2024-04-15 16:53 ` Conor Dooley
2024-04-03 10:25 ` [PATCH v5 03/10] soc: mediatek: cmdq: Add cmdq_pkt_logic_command to support math operation Shawn Sung
2024-04-03 10:25 ` [PATCH v5 04/10] soc: mediatek: cmdq: Add cmdq_pkt_write_s_reg_value to support write value to reg Shawn Sung
2024-04-03 10:25 ` [PATCH v5 05/10] mailbox: mtk-cmdq: Support GCE loop packets in interrupt handler Shawn Sung
2024-04-03 10:25 ` Shawn Sung [this message]
2024-04-03 10:25 ` [PATCH v5 07/10] mailbox: mediatek: Move reuseable definition to header for secure driver Shawn Sung
2024-04-03 10:26 ` [PATCH v5 08/10] mailbox: mediatek: Add CMDQ secure mailbox driver Shawn Sung
2024-04-03 10:26 ` [PATCH v5 09/10] mailbox: mediatek: Add secure CMDQ driver support for CMDQ driver Shawn Sung
2024-04-03 10:26 ` [PATCH v5 10/10] drm/mediatek: Add interface to allocate MediaTek GEM buffer Shawn Sung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240403102602.32155-7-shawn.sung@mediatek.com \
--to=shawn.sung@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=ck.hu@mediatek.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=houlong.wei@mediatek.com \
--cc=jason-jh.lin@mediatek.com \
--cc=jassisinghbrar@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox