devicetree.vger.kernel.org archive mirror
 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>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
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>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Jason-ch Chen (陳建豪)" <Jason-ch.Chen@mediatek.com>,
	"Shawn Sung (宋孝謙)" <Shawn.Sung@mediatek.com>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
	"conor+dt@kernel.org" <conor+dt@kernel.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 v3 8/9] mailbox: mediatek: Add CMDQ secure mailbox driver
Date: Wed, 3 Jan 2024 07:14:54 +0000	[thread overview]
Message-ID: <519df4d65db2904f3c9c27f73b47b9268c9ec049.camel@mediatek.com> (raw)
In-Reply-To: <1b21f5bfa561b049193742804de42a1c03500a73.camel@mediatek.com>

On Fri, 2023-12-29 at 01:27 +0000, CK Hu (胡俊光) wrote:
> Hi, Jason:
> 
> On Fri, 2023-12-22 at 12:52 +0800, Jason-JH.Lin wrote:
> > To support secure video path feature, GCE have to read/write
> > registgers
> > in the secure world. GCE will enable the secure access permission
> > to
> > the
> > HW who wants to access the secure content buffer.
> > 
> > Add CMDQ secure mailbox driver to make CMDQ client user is able to
> > sending their HW settings to the secure world. So that GCE can
> > execute
> > all instructions to configure HW in the secure world.
> > 
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > ---
> 
> [snip]
> 
> > +
> > +static int cmdq_sec_session_send(struct cmdq_sec_context *context,
> > +				 struct cmdq_sec_task *sec_task, const
> > u32 iwc_cmd,
> > +				 const u32 thrd_idx, struct cmdq_sec
> > *cmdq)
> > +{
> > +	int err = 0;
> > +	u64 cost;
> > +	struct iwc_cmdq_message_t *iwc_msg = NULL;
> > +
> > +	iwc_msg = (struct iwc_cmdq_message_t *)context->iwc_msg;
> > +
> > +	memset(iwc_msg, 0, sizeof(*iwc_msg));
> > +	iwc_msg->cmd = iwc_cmd;
> > +	iwc_msg->cmdq_id = cmdq->pdata->hwid;
> > +	iwc_msg->command.thread = thrd_idx;
> > +
> > +	switch (iwc_cmd) {
> > +	case CMD_CMDQ_IWC_SUBMIT_TASK:
> > +		err = cmdq_sec_fill_iwc_msg(context, sec_task,
> > thrd_idx);
> > +		if (err)
> > +			return err;
> > +		break;
> > +	case CMD_CMDQ_IWC_CANCEL_TASK:
> > +		iwc_msg->cancel_task.wait_cookie = sec_task-
> > > wait_cookie;
> > 
> > +		iwc_msg->cancel_task.thread = thrd_idx;
> > +		break;
> > +	case CMD_CMDQ_IWC_PATH_RES_ALLOCATE:
> > +		if (!cmdq->shared_mem || !cmdq->shared_mem->va) {
> > +			dev_err(cmdq->mbox.dev, "%s %d: shared_mem is
> > NULL", __func__, __LINE__);
> > +			return -EFAULT;
> > +		}
> > +		iwc_msg->path_resource.size = cmdq->shared_mem->size;
> > +		iwc_msg->path_resource.share_memoy_pa = cmdq-
> > > shared_mem->pa;
> > 
> > +		iwc_msg->path_resource.use_normal_irq = 1;
> > +		break;
> > +	default:
> > +		break;
> > +	}
> > +
> > +	cmdq->sec_invoke = sched_clock();
> > +	dev_dbg(cmdq->mbox.dev, "%s execute cmdq:%p sec_task:%p
> > command:%u thread:%u cookie:%d",
> > +		__func__, cmdq, sec_task, iwc_cmd, thrd_idx,
> > +		sec_task ? sec_task->wait_cookie : -1);
> > +
> > +	/* send message */
> > +	err = cmdq_sec_execute_session(&context->tee_ctx, iwc_cmd,
> > CMDQ_TIMEOUT_DEFAULT);
> > +
> > +	cmdq->sec_done = sched_clock();
> > +	cost = div_u64(cmdq->sec_done - cmdq->sec_invoke, 1000000);
> > +	if (cost >= CMDQ_TIMEOUT_DEFAULT)
> 
> Maybe for some client driver, 1 ms is too long, and for some client
> driver 1 second is not long. So I think the timeout detection should
> be
> done by client driver. And the execution time depend on the command
> buffer generated by client driver, so only client driver has the
> ability to debug the command buffer it generated. So it's not
> necessary
> to detect timeout in cmdq driver.
> 
> Regards,
> CK
> 

OK, I'll remove this timeout detection in cmdq driver.

Regards,
Jason-JH.Lin

> > +		dev_err(cmdq->mbox.dev, "%s execute timeout cmdq:%p
> > sec_task:%p cost:%lluus",
> > +			__func__, cmdq, sec_task, cost);
> > +	else
> > +		dev_dbg(cmdq->mbox.dev, "%s execute done cmdq:%p
> > sec_task:%p cost:%lluus",
> > +			__func__, cmdq, sec_task, cost);
> > +
> > +	if (err)
> > +		return err;
> > +
> > +	context->state = IWC_SES_ON_TRANSACTED;
> > +	return 0;
> > +}
> > +

  reply	other threads:[~2024-01-03  7:15 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22  4:52 [PATCH v3 0/9] Add CMDQ secure driver for SVP Jason-JH.Lin
2023-12-22  4:52 ` [PATCH v3 1/9] dt-bindings: gce: mt8195: Add CMDQ_SYNC_TOKEN_SECURE_THR_EOF event id Jason-JH.Lin
2023-12-22  4:52 ` [PATCH v3 2/9] dt-bindings: mailbox: Add mboxes property for CMDQ secure driver Jason-JH.Lin
2023-12-22 15:07   ` Conor Dooley
2023-12-23 18:38     ` Jason-JH Lin (林睿祥)
2023-12-22  4:52 ` [PATCH v3 3/9] soc: mediatek: cmdq: Add cmdq_pkt_logic_command to support math operation Jason-JH.Lin
2023-12-22  4:52 ` [PATCH v3 4/9] soc: mediatek: cmdq: Add cmdq_pkt_write_s_reg_value to support write value to reg Jason-JH.Lin
2023-12-22  4:52 ` [PATCH v3 5/9] mailbox: mtk-cmdq: Support GCE loop packets in interrupt handler Jason-JH.Lin
2023-12-22  4:52 ` [PATCH v3 6/9] soc: mediatek: cmdq: Add cmdq_pkt_finalize_loop for looping cmd with irq Jason-JH.Lin
2023-12-22  4:52 ` [PATCH v3 7/9] mailbox: mediatek: Move reuseable definition to header for secure driver Jason-JH.Lin
2023-12-22  4:52 ` [PATCH v3 8/9] mailbox: mediatek: Add CMDQ secure mailbox driver Jason-JH.Lin
2023-12-26  6:15   ` CK Hu (胡俊光)
2023-12-27  3:40     ` Jason-JH Lin (林睿祥)
2023-12-26  6:46   ` CK Hu (胡俊光)
2023-12-27  6:13     ` Jason-JH Lin (林睿祥)
2023-12-28  2:02       ` CK Hu (胡俊光)
2024-01-03  6:51         ` Jason-JH Lin (林睿祥)
2023-12-26  7:57   ` CK Hu (胡俊光)
2023-12-27  6:15     ` Jason-JH Lin (林睿祥)
2023-12-26  8:28   ` CK Hu (胡俊光)
2023-12-27  7:26     ` Jason-JH Lin (林睿祥)
2023-12-26  8:58   ` CK Hu (胡俊光)
2023-12-27  7:25     ` Jason-JH Lin (林睿祥)
2023-12-28  1:38       ` CK Hu (胡俊光)
2024-01-03  6:53         ` Jason-JH Lin (林睿祥)
2023-12-26  9:18   ` CK Hu (胡俊光)
2023-12-27  7:20     ` Jason-JH Lin (林睿祥)
2023-12-28  5:31   ` CK Hu (胡俊光)
2024-01-03  6:54     ` Jason-JH Lin (林睿祥)
2023-12-28  7:35   ` CK Hu (胡俊光)
2024-01-03  6:55     ` Jason-JH Lin (林睿祥)
2023-12-28  7:37   ` CK Hu (胡俊光)
2024-01-03  7:03     ` Jason-JH Lin (林睿祥)
2024-01-04  5:42       ` CK Hu (胡俊光)
2024-01-05  6:37         ` Jason-JH Lin (林睿祥)
2023-12-29  1:27   ` CK Hu (胡俊光)
2024-01-03  7:14     ` Jason-JH Lin (林睿祥) [this message]
2023-12-22  4:52 ` [PATCH v3 9/9] mailbox: mediatek: Add secure CMDQ driver support for CMDQ driver 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=519df4d65db2904f3c9c27f73b47b9268c9ec049.camel@mediatek.com \
    --to=jason-jh.lin@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=jassisinghbrar@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).