Linux-mediatek Archive on lore.kernel.org
 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>,
	"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>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH RESEND,v6 8/8] soc: mediatek: mtk-cmdq: Add secure cmdq_pkt APIs
Date: Wed, 29 May 2024 14:49:04 +0000	[thread overview]
Message-ID: <4ad87d6caf7788de5cfae82d5bdfa3ddd2040745.camel@mediatek.com> (raw)
In-Reply-To: <9959dc856288b30698c8990695b2ad50376dd21f.camel@mediatek.com>

Hi CK,

On Wed, 2024-05-29 at 01:58 +0000, CK Hu (胡俊光) wrote:
> Hi, Jason:
> 
> On Tue, 2024-05-28 at 15:33 +0000, Jason-JH Lin (林睿祥) wrote:
> > Hi CK,
> > 
> > On Tue, 2024-05-28 at 03:01 +0000, CK Hu (胡俊光) wrote:
> > > Hi, Jason:
> > > 
> > > On Sun, 2024-05-26 at 22:44 +0800, Jason-JH.Lin wrote:
> > > > Open secure cmdq_pkt APIs to support executing commands in
> > > > secure
> > > > world.
> > > > 
> > > > 1. Add cmdq_sec_pkt_alloc_sec_data(),
> > > > cmdq_sec_pkt_free_sec_data()
> > > > and
> > > >    cmdq_sec_pkt_set_data() to prepare the sec_data in cmdq_pkt
> > > > that
> > > > will
> > > >    be referenced in the secure world.
> > > > 
> > > > 2. Add cmdq_sec_insert_backup_cookie() and cmdq_sec_pkt_write()
> > > > to
> > > >    generate commands that need to be executed in the secure
> > > > world.
> > > >    In cmdq_sec_pkt_write(), we need to prepare the metadata to
> > > > store
> > > >    buffer offset of the secure buffer handle because secure
> > > > world
> > > > can
> > > >    only translate the start address of secure buffer by secure
> > > > handle.
> > > > 
> > > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > > > Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
> > > > ---
> > > 
> > > [snip]
> > > 
> > > > +
> > > > +int cmdq_sec_pkt_set_data(struct cmdq_pkt *pkt, enum
> > > > cmdq_sec_scenario scenario)
> > > > +{
> > > > +	struct cmdq_sec_data *sec_data;
> > > > +	int ret;
> > > > +
> > > > +	if (!pkt) {
> > > > +		pr_err("invalid pkt:%p", pkt);
> > > > +		return -EINVAL;
> > > > +	}
> > > > +
> > > > +	ret = cmdq_sec_pkt_alloc_sec_data(pkt);
> > > > +	if (ret < 0)
> > > > +		return ret;
> > > > +
> > > > +	pr_debug("[%s %d] pkt:%p sec_data:%p scen:%u",
> > > > +		 __func__, __LINE__, pkt, pkt->sec_data,
> > > > scenario);
> > > > +
> > > > +	sec_data = (struct cmdq_sec_data *)pkt->sec_data;
> > > > +	sec_data->scenario = scenario;
> > > > +
> > > > +	return 0;
> > > > +}
> > > 
> > > What does cmdq_sec_pkt_set_data() exactly do? It seems to
> > > enable/disable protection on hardware of certain pipeline.
> > > In future, you would use secure GCE for normal video and secure
> > > video.
> > > Would you also use secure display pipeline for both normal video
> > > and
> > > secure video?
> > 
> > I think I won't do that.
> > 
> > > If so, I think we could drop this function because the hardware
> > > is
> > > always protected.
> > > 
> > 
> > But we will use ENABLE and DISABLE scenario to notify secure world
> > to
> > enable/disable the protection of secure buffer and register by
> > setting
> > larb port and DAPC.
> > 
> > If there is secure memory output scenario (WiFi Display scenario)
> > in
> > the same display pipeline as main display scenario, we will need to
> > use
> > this scenario to differentiate them.
> 
> This API looks no relation with CMDQ. All the job is that display
> control larb, dapc to turn on/off protection.
> All the process is done by CPU not GCE, right?

We nee to make sure all the settings are finished during vblanking, so
all processes are done by GCE, we will insert the settings of larb and
dapc by referencing to the other instruction for display HW and also
the scenario here.

> If so, this API should be provided by display TA not CMDQ TA.
> 
Maybe we could parsing OVL layer control and WDMA instructions to
decide to on/off the larb and dapc settings and also the scenario in
secure world.

I would try to remove this as well, then we only need to pass the
command buffer and metadata list for buffer handle and its offset to
the secure world.

Regards,
Jason-JH.Lin

> Regards,
> CK
> 
> > 
> > Regards,
> > Jason-JH.Lin
> > 
> > > Regards,
> > > CK
> > > 
> > > > +EXPORT_SYMBOL_GPL(cmdq_sec_pkt_set_data);
> > > > +

  reply	other threads:[~2024-05-29 14:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-26 14:44 [PATCH RESEND,v6 0/8] Add CMDQ secure driver for SVP Jason-JH.Lin
2024-05-26 14:44 ` [PATCH RESEND,v6 1/8] dt-bindings: gce: mt8195: Add CMDQ_SYNC_TOKEN_SECURE_THR_EOF event id Jason-JH.Lin
2024-05-26 14:44 ` [PATCH RESEND,v6 2/8] dt-bindings: mailbox: Add property for CMDQ secure driver Jason-JH.Lin
2024-05-26 16:13   ` Rob Herring (Arm)
2024-05-27  5:21     ` Jason-JH Lin (林睿祥)
2024-05-27 17:36   ` Conor Dooley
2024-05-28 14:38     ` Jason-JH Lin (林睿祥)
2024-05-28 14:59       ` Conor Dooley
2024-05-28 15:10         ` Jason-JH Lin (林睿祥)
2024-05-26 14:44 ` [PATCH RESEND,v6 3/8] soc: mediatek: cmdq: Add cmdq_pkt_logic_command to support math operation Jason-JH.Lin
2024-05-26 14:44 ` [PATCH RESEND,v6 4/8] mailbox: mtk-cmdq: Support GCE loop packets in interrupt handler Jason-JH.Lin
2024-05-26 14:44 ` [PATCH RESEND,v6 5/8] mailbox: mediatek: Move reuseable definition to header for secure driver Jason-JH.Lin
2024-05-26 14:44 ` [PATCH RESEND,v6 6/8] mailbox: mediatek: Add CMDQ secure mailbox driver Jason-JH.Lin
2024-05-27  3:44   ` [PATCH RESEND, v6 " CK Hu (胡俊光)
2024-05-27  5:04     ` Jason-JH Lin (林睿祥)
2024-05-28  2:19   ` CK Hu (胡俊光)
2024-05-29 14:33     ` Jason-JH Lin (林睿祥)
2024-05-28  3:17   ` CK Hu (胡俊光)
2024-05-28 15:33     ` Jason-JH Lin (林睿祥)
2024-06-17  7:18   ` CK Hu (胡俊光)
2024-05-26 14:44 ` [PATCH RESEND,v6 7/8] mailbox: mediatek: Add secure CMDQ driver support for CMDQ driver Jason-JH.Lin
2024-05-26 14:44 ` [PATCH RESEND,v6 8/8] soc: mediatek: mtk-cmdq: Add secure cmdq_pkt APIs Jason-JH.Lin
2024-05-28  3:01   ` CK Hu (胡俊光)
2024-05-28 15:33     ` Jason-JH Lin (林睿祥)
2024-05-29  1:58       ` CK Hu (胡俊光)
2024-05-29 14:49         ` Jason-JH Lin (林睿祥) [this message]
2024-06-13 10:58 ` [PATCH RESEND,v6 0/8] Add CMDQ secure driver for SVP Pavel Machek

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=4ad87d6caf7788de5cfae82d5bdfa3ddd2040745.camel@mediatek.com \
    --to=jason-jh.lin@mediatek.com \
    --cc=Jason-ch.Chen@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