mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
To: "robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"jassisinghbrar@gmail.com" <jassisinghbrar@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
	"mchehab@kernel.org" <mchehab@kernel.org>
Cc: "pual-pl.chen@mediatek.com" <pual-pl.chen@mediatek.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"Sirius Wang (王皓昱)" <Sirius.Wang@mediatek.com>,
	"Moudy Ho (何宗原)" <Moudy.Ho@mediatek.com>,
	"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
	"Xiandong Wang (王先冬)" <Xiandong.Wang@mediatek.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.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-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"fshao@chromium.org" <fshao@chromium.org>,
	"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
	"wenst@chromium.org" <wenst@chromium.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"Xavier Chang (張獻文)" <Xavier.Chang@mediatek.com>
Subject: Re: [PATCH v5 03/19] mailbox: mtk-cmdq: Add cmdq private data to cmdq_pkt for generating instruction
Date: Mon, 28 Apr 2025 06:13:06 +0000	[thread overview]
Message-ID: <6a6aee9658dc467fe7bf9b96e8a8a3f3ac6f182a.camel@mediatek.com> (raw)
In-Reply-To: <20250425093237.1543918-4-jason-jh.lin@mediatek.com>

On Fri, 2025-04-25 at 17:28 +0800, Jason-JH Lin wrote:
> Add the cmdq_mbox_priv structure to store the private data of GCE,
> such as the shift bits of the physical address. Then, include the
> cmdq_mbox_priv structure within the cmdq_pkt structure.
> 
> This allows CMDQ users to utilize the private data in cmdq_pkt to
> generate GCE instructions when needed. Additionally, having
> cmdq_mbox_priv makes it easier to expand and reference other GCE
> private data in the future.
> 
> Add cmdq_get_mbox_priv() for CMDQ users to get all the private data
> into the cmdq_mbox_priv of the cmdq_pkt.
> 
> Fixes: 0858fde496f8 ("mailbox: cmdq: variablize address shift in
> platform")
> Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
> ---
>  drivers/mailbox/mtk-cmdq-mailbox.c       |  6 +++---
>  include/linux/mailbox/mtk-cmdq-mailbox.h | 18 ++++++++++++------
>  2 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c
> b/drivers/mailbox/mtk-cmdq-mailbox.c
> index a3d94f1eb1a3..b18808855680 100644
> --- a/drivers/mailbox/mtk-cmdq-mailbox.c
> +++ b/drivers/mailbox/mtk-cmdq-mailbox.c
> @@ -102,13 +102,13 @@ static inline dma_addr_t
> cmdq_reg_revert_addr(u32 addr, const struct gce_plat *p
>  	return ((dma_addr_t)addr << pdata->shift);
>  }
>  
> -u8 cmdq_get_shift_pa(struct mbox_chan *chan)
> +void cmdq_get_mbox_priv(struct mbox_chan *chan, struct
> cmdq_mbox_priv *priv)
>  {
>  	struct cmdq *cmdq = container_of(chan->mbox, struct cmdq,
> mbox);
>  
> -	return cmdq->pdata->shift;
> +	priv->shift_pa = cmdq->pdata->shift;
>  }
> -EXPORT_SYMBOL(cmdq_get_shift_pa);
> +EXPORT_SYMBOL(cmdq_get_mbox_priv);
>  
>  static void cmdq_gctl_value_toggle(struct cmdq *cmdq, bool
> ddr_enable)
>  {
> diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h
> b/include/linux/mailbox/mtk-cmdq-mailbox.h
> index e1555e06e7e5..822958f92135 100644
> --- a/include/linux/mailbox/mtk-cmdq-mailbox.h
> +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h
> @@ -70,23 +70,29 @@ struct cmdq_cb_data {
>  	struct cmdq_pkt		*pkt;
>  };
>  
> +struct cmdq_mbox_priv {
> +	u8 shift_pa;
> +};
> +
>  struct cmdq_pkt {
>  	void			*va_base;
>  	dma_addr_t		pa_base;
>  	size_t			cmd_buf_size; /* command occupied
> size */
>  	size_t			buf_size; /* real buffer size */
> +	struct cmdq_mbox_priv	priv; /* for generating instruction
> */
>  };
>  
>  /**
> - * cmdq_get_shift_pa() - get the shift bits of physical address
> + * cmdq_get_mbox_priv() - get the private data of mailbox channel
>   * @chan: mailbox channel
> + * @priv: pointer to store the private data of mailbox channel
>   *
> - * GCE can only fetch the command buffer address from a 32-bit
> register.
> - * Some SOCs support more than 32-bit command buffer address for
> GCE, which
> - * requires some shift bits to make the address fit into the 32-bit
> register.
> + * While generating the GCE instruction to command buffer, the
> private data
> + * of GCE hardware may need to be referenced, such as the shift bits
> of
> + * physical address.
>   *
> - * Return: the shift bits of physical address
> + * This function should be called before generating the GCE
> instruction.
>   */
> -u8 cmdq_get_shift_pa(struct mbox_chan *chan);

Sorry, I realize that I cannot remove this API directly.

I need to remove it after no one using it, which means [PATCH v5 8/19].
I'll fix this in the next version.

Regards,
Jason-JH Lin

> +void cmdq_get_mbox_priv(struct mbox_chan *chan, struct
> cmdq_mbox_priv *priv);
>  
>  #endif /* __MTK_CMDQ_MAILBOX_H__ */


  reply	other threads:[~2025-04-28  6:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25  9:28 [PATCH v5 00/19] Add GCE support for MT8196 Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 01/19] arm64: dts: mediatek: Add GCE header " Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 02/19] mailbox: mtk-cmdq: Refine DMA address handling for the command buffer Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 03/19] mailbox: mtk-cmdq: Add cmdq private data to cmdq_pkt for generating instruction Jason-JH Lin
2025-04-28  6:13   ` Jason-JH Lin (林睿祥) [this message]
2025-04-25  9:28 ` [PATCH v5 04/19] soc: mediatek: mtk-cmdq: Add cmdq_get_mbox_priv() in cmdq_pkt_create() Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 05/19] soc: mediatek: mtk-cmdq: Add cmdq_pkt_jump_rel_temp() for removing shift_pa Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 06/19] media: platform: mtk-mdp3: Change cmdq_pkt_jump_rel() to cmdq_pkt_jump_rel_temp() Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 07/19] soc: mediatek: mtk-cmdq: Remove shift_pa parameter from cmdq_pkt_jump() Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 08/19] media: platform: mtk-mdp3: Use cmdq_pkt_jump_rel() without shift_pa Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 09/19] soc: mediatek: mtk-cmdq: Remove cmdq_pkt_jump() and cmdq_pkt_jump_rel_temp() Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 10/19] mailbox: mtk-cmdq: Add GCE hardware virtualization configuration Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 11/19] mailbox: mtk-cmdq: Add mminfra_offset configuration for DRAM transaction Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 12/19] mailbox: mtk-cmdq: Add driver data to support for MT8196 Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 13/19] soc: mediatek: mtk-cmdq: Add pa_base parsing for hardware without subsys ID support Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 14/19] soc: mediatek: mtk-cmdq: Add new APIs to replace cmdq_pkt_write() and cmdq_pkt_write_mask() Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 15/19] soc: mediatek: mtk-cmdq: Add mminfra_offset adjustment for DRAM addresses Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 16/19] soc: mediatek: Add programming flow for unsupported subsys ID hardware Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 17/19] drm/mediatek: " Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 18/19] media: mediatek: mdp3: " Jason-JH Lin
2025-04-25  9:28 ` [PATCH v5 19/19] soc: mediatek: mtk-cmdq: Remove cmdq_pkt_write() and cmdq_pkt_write_mask() 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=6a6aee9658dc467fe7bf9b96e8a8a3f3ac6f182a.camel@mediatek.com \
    --to=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=Sirius.Wang@mediatek.com \
    --cc=Xavier.Chang@mediatek.com \
    --cc=Xiandong.Wang@mediatek.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=fshao@chromium.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=pual-pl.chen@mediatek.com \
    --cc=robh@kernel.org \
    --cc=wenst@chromium.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®