mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"jassisinghbrar@gmail.com" <jassisinghbrar@gmail.com>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"AngeloGioacchino Del Regno"
	<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>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"Moudy Ho (何宗原)" <Moudy.Ho@mediatek.com>,
	"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 4/8] soc: mediatek: mtk-cmdq: Add unsupported subsys ID programing flow
Date: Thu, 21 Nov 2024 07:10:55 +0000	[thread overview]
Message-ID: <89d7718e29dd7ec80a2b457bca9a6f9cae888bac.camel@mediatek.com> (raw)
In-Reply-To: <f637f72960e84efb88dc6ed8482ea7a0d6bfcd25.camel@mediatek.com>

Hi, Jason:

On Thu, 2024-11-21 at 14:38 +0800, CK Hu wrote:
> Hi, Jason:
> 
> On Thu, 2024-11-21 at 12:25 +0800, Jason-JH.Lin wrote:
> > When GCE executes instructions, the corresponding hardware register
> > can be found through the subsys ID.
> > For unsupported subsys ID hardware, the physical address need to be used
> > to generate GCE instructions.
> > 
> > Add the pa_base interface to the instruction programming flow for these
> > unsupported subsys ID hardware.
> > 
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > ---
> 
> [snip]
> 
> > -int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value)
> > +int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u32 pa_base, u16 offset, u32 value)
> >  {
> > +	struct cmdq_client *cl = (struct cmdq_client *)pkt->cl;
> >  	struct cmdq_instruction inst = {
> >  		.op = CMDQ_CODE_WRITE,
> >  		.value = value,
> >  		.offset = offset,
> >  		.subsys = subsys
> >  	};
> > -	return cmdq_pkt_append_command(pkt, inst);
> > +	int err;
> > +
> > +	if (!cl) {
> > +		pr_err("%s %d: pkt->cl is NULL!\n", __func__, __LINE__);
> > +		return -EINVAL;
> > +	}
> > +
> > +	if (cmdq_subsys_is_valid(cl->chan, subsys)) {
> 
> I would like to have a new API for no subsys. Maybe cmdq_pkt_write_pa().
> If some client driver always have subsys, it could use cmdq_pkt_write().
> If some client driver have no subsys, it could use cmdq_pkt_write_pa().
> This would prevent frequently conditional jump in this function.
> If some client driver have subsys in some SoC and have no subsys in other SoC,
> let the conditional jump happen in that client driver.
> (The client driver could use 'likely' or 'unlikely' to uptimize)
> In the view point to let client driver have fine-grained control,
> maybe client could use cmdq_pkt_assign() and cmdq_pkt_write_s_value() to achieve this so it's not necessary to invent new API.

For a client driver, the high address is usually a constant value.
So the client could have command like:

cmdq_pkt_assign(pkt, 0, CMDQ_ADDR_HIGH(pa_base));

cmdq_pkt_write_s_value(pkt, 0, CMDQ_ADDR_LOW(offset1), value1);
cmdq_pkt_write_s_value(pkt, 0, CMDQ_ADDR_LOW(offset2), value2);
cmdq_pkt_write_s_value(pkt, 0, CMDQ_ADDR_LOW(offset3), value3);
cmdq_pkt_write_s_value(pkt, 0, CMDQ_ADDR_LOW(offset4), value4);
cmdq_pkt_write_s_value(pkt, 0, CMDQ_ADDR_LOW(offset5), value5);
cmdq_pkt_write_s_value(pkt, 0, CMDQ_ADDR_LOW(offset6), value6);

This would reduce the command size.
GCE would execute more quickly.

Regards,
CK

> 
> Regards,
> CK
> 
> > +		err = cmdq_pkt_append_command(pkt, inst);
> > +	} else {
> > +		err = cmdq_pkt_assign(pkt, 0, CMDQ_ADDR_HIGH(pa_base));
> > +		if (err < 0)
> > +			return err;
> > +
> > +		err = cmdq_pkt_write_s_value(pkt, 0, CMDQ_ADDR_LOW(offset), value);
> > +	}
> > +
> > +	return err;
> >  }
> >  EXPORT_SYMBOL(cmdq_pkt_write);
> >  
> 
> 

  reply	other threads:[~2024-11-21  7:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-21  4:25 [PATCH 0/8] Add GCE support for MT8196 Jason-JH.Lin
2024-11-21  4:25 ` [PATCH 1/8] dt-bindings: mailbox: mediatek: Add GCE header file " Jason-JH.Lin
2024-11-21  8:42   ` Krzysztof Kozlowski
2024-11-21 10:51     ` Jason-JH Lin (林睿祥)
2024-11-21 11:48       ` Krzysztof Kozlowski
2024-11-21 15:47         ` Jason-JH Lin (林睿祥)
2024-11-21  4:25 ` [PATCH 2/8] dt-bindings: mailbox: mediatek: Add MT8196 support for gce-mailbox Jason-JH.Lin
2024-11-21  4:25 ` [PATCH 3/8] mailbox: mtk-cmdq: Add driver data to support for MT8196 Jason-JH.Lin
2024-11-21  4:25 ` [PATCH 4/8] soc: mediatek: mtk-cmdq: Add unsupported subsys ID programing flow Jason-JH.Lin
2024-11-21  6:38   ` CK Hu (胡俊光)
2024-11-21  7:10     ` CK Hu (胡俊光) [this message]
2024-11-21 10:41       ` Jason-JH Lin (林睿祥)
2024-11-21  4:25 ` [PATCH 5/8] soc: mediatek: mtk-cmdq: Add mminfra_offset compatibility for DRAM address Jason-JH.Lin
2024-11-21  4:26 ` [PATCH 6/8] soc: mediatek: Add pa_base due to CMDQ API change Jason-JH.Lin
2024-11-21  4:26 ` [PATCH 7/8] drm/mediatek: " Jason-JH.Lin
2024-11-21  4:26 ` [PATCH 8/8] media: mediatek: mdp3: " Jason-JH.Lin
2024-11-21  8:55 ` [PATCH 0/8] Add GCE support for MT8196 AngeloGioacchino Del Regno
2024-11-21 11:21   ` 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=89d7718e29dd7ec80a2b457bca9a6f9cae888bac.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=Jason-JH.Lin@mediatek.com \
    --cc=Moudy.Ho@mediatek.com \
    --cc=Nancy.Lin@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=Singo.Chang@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=krzk+dt@kernel.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@kernel.org \
    --cc=simona@ffwll.ch \
    /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®