mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
To: "CK Hu (胡俊光)" <ck.hu@mediatek.com>,
	"jassisinghbrar@gmail.com" <jassisinghbrar@gmail.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
	"Johnson Wang (王聖鑫)" <Johnson.Wang@mediatek.com>,
	"Jason-ch Chen (陳建豪)" <Jason-ch.Chen@mediatek.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Shawn Sung (宋孝謙)" <Shawn.Sung@mediatek.com>,
	"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"Elvis Wang (王军)" <Elvis.Wang@mediatek.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: Re: [PATCH 08/15] soc: mediatek: Add cmdq_pkt_finalize_loop to CMDQ driver
Date: Thu, 21 Sep 2023 14:25:37 +0000	[thread overview]
Message-ID: <6a80acb293cbc7e1b544f85b22800b5343a931b0.camel@mediatek.com> (raw)
In-Reply-To: <54799d50c0b4427102e275117e715d9d4a190375.camel@mediatek.com>

On Tue, 2023-09-19 at 01:38 +0000, CK Hu (胡俊光) wrote:
> Hi, Jason:
> 
> On Tue, 2023-09-19 at 03:21 +0800, Jason-JH.Lin wrote:
> > 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>
> > ---
> >  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 4be2a18a4a02..bbb127620bb3 100644
> > --- a/drivers/soc/mediatek/mtk-cmdq-helper.c
> > +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
> > @@ -475,6 +475,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;
> 
> Could you explain the case that a loop thread would trigger an
> interrupt? In DRM crc function, the loop thread need not to trigger
> interrupt, so I'm curious about this.
> 
The looping thread in DRM crc funtion is for update CRC value to DRAM
during every vblank event coming. It doesn't need to handle the
software flow after the EOC.

The looping thread in cmdq_sec_irq_notify_start() is waiting for every
CMDQ_SYNC_TOKEN_SEC_THR_EOF being set, that means the GCE in secure
world has finished all commands in a command buffer. Then it needs a
GCE irq to trigger secure mailbox rx_callback() to handle the task of
secure cmdq_pkt done in software.

Regards,
Jason-JH.Lin

> Regards,
> CK
> 
> > +
> > +	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 837ad8656adc..38a8e47da338 100644
> > --- a/include/linux/soc/mediatek/mtk-cmdq.h
> > +++ b/include/linux/soc/mediatek/mtk-cmdq.h
> > @@ -323,6 +323,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

  reply	other threads:[~2023-09-21 16:59 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230918192204.32263-1-jason-jh.lin@mediatek.com>
     [not found] ` <20230918192204.32263-12-jason-jh.lin@mediatek.com>
2023-09-19  3:04   ` [PATCH 11/15] soc: mediatek: Add cmdq_insert_backup_cookie before EOC for secure pkt CK Hu (胡俊光)
2023-09-21 14:28     ` Jason-JH Lin (林睿祥)
     [not found] ` <20230918192204.32263-2-jason-jh.lin@mediatek.com>
2023-09-19 16:46   ` [PATCH 01/15] dt-bindings: mailbox: Add property for CMDQ secure driver Rob Herring
2023-09-21 15:12     ` Jason-JH Lin (林睿祥)
2023-09-20  3:08 ` [PATCH 00/15] Add CMDQ secure driver for SVP CK Hu (胡俊光)
2023-09-21 14:44   ` Jason-JH Lin (林睿祥)
     [not found] ` <20230918192204.32263-3-jason-jh.lin@mediatek.com>
2023-09-23 18:01   ` [PATCH 02/15] dt-bindings: gce: mt8195: Add CMDQ_SYNC_TOKEN_SECURE_THR_EOF event id Krzysztof Kozlowski
2023-09-25  5:05     ` Jason-JH Lin (林睿祥)
2023-09-25  6:42       ` Krzysztof Kozlowski
2023-09-25  9:11         ` Jason-JH Lin (林睿祥)
2023-09-25  9:28           ` Krzysztof Kozlowski
2023-09-26  2:45             ` Jason-JH Lin (林睿祥)
     [not found] ` <20230918192204.32263-4-jason-jh.lin@mediatek.com>
2023-09-23 18:02   ` [PATCH 03/15] soc: mailbox: Add SPR definition for GCE Krzysztof Kozlowski
2023-09-25  5:08     ` Jason-JH Lin (林睿祥)
2023-09-25  6:42       ` Krzysztof Kozlowski
2023-09-25 10:24         ` Jason-JH Lin (林睿祥)
     [not found] ` <20230918192204.32263-8-jason-jh.lin@mediatek.com>
2023-09-23 18:03   ` [PATCH 07/15] mailbox: mediatek: Add loop pkt flag and irq handling for loop command Krzysztof Kozlowski
2023-09-25  5:21     ` Jason-JH Lin (林睿祥)
2023-09-25  6:44       ` Krzysztof Kozlowski
2023-09-26  3:20         ` Jason-JH Lin (林睿祥)
2023-09-26 20:32           ` Krzysztof Kozlowski
     [not found] ` <20230918192204.32263-9-jason-jh.lin@mediatek.com>
2023-09-19  1:38   ` [PATCH 08/15] soc: mediatek: Add cmdq_pkt_finalize_loop to CMDQ driver CK Hu (胡俊光)
2023-09-21 14:25     ` Jason-JH Lin (林睿祥) [this message]
2023-09-23 18:04   ` Krzysztof Kozlowski
2023-09-23 18:08   ` Krzysztof Kozlowski
2023-09-25  6:04     ` Jason-JH Lin (林睿祥)
2023-09-25  6:40       ` Krzysztof Kozlowski
     [not found] ` <20230918192204.32263-7-jason-jh.lin@mediatek.com>
2023-09-19  1:24   ` [PATCH 06/15] mailbox: mediatek: Add cmdq_mbox_stop to disable GCE thread CK Hu (胡俊光)
2023-09-21 14:15     ` Jason-JH Lin (林睿祥)
2023-09-23 18:02   ` Krzysztof Kozlowski
2023-09-25  5:10     ` Jason-JH Lin (林睿祥)
2023-09-23 18:07   ` Krzysztof Kozlowski
2023-09-25  5:25     ` Jason-JH Lin (林睿祥)
     [not found] ` <20230918192204.32263-15-jason-jh.lin@mediatek.com>
2023-09-23 18:08   ` [PATCH 14/15] mailbox: mediatek: Add mt8195 support for CMDQ secure driver Krzysztof Kozlowski
2023-09-25  5:48     ` Jason-JH Lin (林睿祥)
     [not found] ` <20230918192204.32263-14-jason-jh.lin@mediatek.com>
2023-09-23 18:09   ` [PATCH 13/15] mailbox: mediatek: Add mt8188 " Krzysztof Kozlowski
2023-09-25  6:01     ` Jason-JH Lin (林睿祥)
2023-09-25  6:45       ` Krzysztof Kozlowski
2023-09-25  9:02         ` Jason-JH Lin (林睿祥)

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=6a80acb293cbc7e1b544f85b22800b5343a931b0.camel@mediatek.com \
    --to=jason-jh.lin@mediatek.com \
    --cc=Elvis.Wang@mediatek.com \
    --cc=Jason-ch.Chen@mediatek.com \
    --cc=Johnson.Wang@mediatek.com \
    --cc=Nancy.Lin@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=Shawn.Sung@mediatek.com \
    --cc=Singo.Chang@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=ck.hu@mediatek.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --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+dt@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

all inboxes | Powered by JetHome®