All of lore.kernel.org
 help / color / mirror / Atom feed
From: "GUO Ren (XuanTie)" <guoren@kernel.org>
To: Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	 Daniel Lezcano <daniel.lezcano@kernel.org>,
	 Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>,
	 Anup Patel <anup@brainfault.org>,
	Tiffany Lin <tiffany.lin@mediatek.com>,
	 Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	 Yunfei Dong <yunfei.dong@mediatek.com>,
	 Minghsiu Tsai <minghsiu.tsai@mediatek.com>,
	 Houlong Wei <houlong.wei@mediatek.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Matthias Brugger <matthias.bgg@gmail.com>,
	 AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	 linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-mediatek@lists.infradead.org,
	Nathan Chancellor <nathan@kernel.org>,
	 "GUO Ren (XuanTie)" <guoren@kernel.org>
Subject: [PATCH v2 6/6] media: mtk-vpu: rename IPI_MAX to IPI_VPU_MAX
Date: Fri, 11 Sep 2026 03:27:14 +0000	[thread overview]
Message-ID: <20260911-ipi_max-v2-6-a77826ff189e@kernel.org> (raw)
In-Reply-To: <20260911-ipi_max-v2-0-a77826ff189e@kernel.org>

The last enumerator of this driver's firmware IPI id list is a bound
for the VPU mailbox protocol, not a generic host IPI limit. Follow the
existing naming in this header: IPI_VPU_INIT already carries a VPU
prefix, so the terminator should match.

The same convention is used by the SCP IPI enum, which ends with a
prefixed SCP_IPI_MAX rather than a bare IPI_MAX.

Rename IPI_MAX to IPI_VPU_MAX and update the descriptor table bounds
and range checks. No functional change.

Link: https://lore.kernel.org/linux-riscv/20260908222349.GA2324870@ax162
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: GUO Ren (XuanTie) <guoren@kernel.org>
---
 drivers/media/platform/mediatek/vpu/mtk_vpu.c | 12 ++++++------
 drivers/media/platform/mediatek/vpu/mtk_vpu.h |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
index 8d8319f0cd22..b3e9f8c4ab7a 100644
--- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c
+++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
@@ -211,7 +211,7 @@ struct mtk_vpu {
 	struct vpu_regs reg;
 	struct vpu_run run;
 	struct vpu_wdt wdt;
-	struct vpu_ipi_desc ipi_desc[IPI_MAX];
+	struct vpu_ipi_desc ipi_desc[IPI_VPU_MAX];
 	struct share_obj __iomem *recv_buf;
 	struct share_obj __iomem *send_buf;
 	struct device *dev;
@@ -221,7 +221,7 @@ struct mtk_vpu {
 	struct mutex vpu_mutex; /* for protecting vpu data data structure */
 	u32 wdt_refcnt;
 	wait_queue_head_t ack_wq;
-	bool ipi_id_ack[IPI_MAX];
+	bool ipi_id_ack[IPI_VPU_MAX];
 };
 
 static inline void vpu_cfg_writel(struct mtk_vpu *vpu, u32 val, u32 offset)
@@ -296,7 +296,7 @@ int vpu_ipi_register(struct platform_device *pdev,
 		return -EPROBE_DEFER;
 	}
 
-	if (id < IPI_MAX && handler) {
+	if (id < IPI_VPU_MAX && handler) {
 		ipi_desc = vpu->ipi_desc;
 		ipi_desc[id].name = name;
 		ipi_desc[id].handler = handler;
@@ -319,7 +319,7 @@ int vpu_ipi_send(struct platform_device *pdev,
 	unsigned long timeout;
 	int ret = 0;
 
-	if (id <= IPI_VPU_INIT || id >= IPI_MAX ||
+	if (id <= IPI_VPU_INIT || id >= IPI_VPU_MAX ||
 	    len > sizeof(send_obj->share_buf) || !buf) {
 		dev_err(vpu->dev, "failed to send ipi message\n");
 		return -EINVAL;
@@ -748,7 +748,7 @@ static void vpu_ipi_handler(struct mtk_vpu *vpu)
 	s32 id = readl(&rcv_obj->id);
 
 	memcpy_fromio(data, rcv_obj->share_buf, sizeof(data));
-	if (id < IPI_MAX && ipi_desc[id].handler) {
+	if (id < IPI_VPU_MAX && ipi_desc[id].handler) {
 		ipi_desc[id].handler(data, readl(&rcv_obj->len),
 				     ipi_desc[id].priv);
 		if (id > IPI_VPU_INIT) {
@@ -934,7 +934,7 @@ static int mtk_vpu_probe(struct platform_device *pdev)
 #ifdef CONFIG_DEBUG_FS
 	debugfs_remove(vpu_debugfs);
 #endif
-	memset(vpu->ipi_desc, 0, sizeof(struct vpu_ipi_desc) * IPI_MAX);
+	memset(vpu->ipi_desc, 0, sizeof(struct vpu_ipi_desc) * IPI_VPU_MAX);
 vpu_mutex_destroy:
 	mutex_destroy(&vpu->vpu_mutex);
 disable_vpu_clk:
diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.h b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
index 3951547e9ec5..44ab631ec904 100644
--- a/drivers/media/platform/mediatek/vpu/mtk_vpu.h
+++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
@@ -49,7 +49,7 @@ typedef void (*ipi_handler_t) (void *data,
  *			 handle VP8 video encoder job,, and vice versa.
  * @IPI_MDP:		 The interrupt from vpu is to notify kernel to
  *			 handle MDP (Media Data Path) job, and vice versa.
- * @IPI_MAX:		 The maximum IPI number
+ * @IPI_VPU_MAX:	 The maximum VPU IPI number
  */
 
 enum ipi_id {
@@ -60,7 +60,7 @@ enum ipi_id {
 	IPI_VENC_H264,
 	IPI_VENC_VP8,
 	IPI_MDP,
-	IPI_MAX,
+	IPI_VPU_MAX,
 };
 
 /**

-- 
2.43.0



WARNING: multiple messages have this Message-ID (diff)
From: "GUO Ren (XuanTie)" <guoren@kernel.org>
To: Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	 Daniel Lezcano <daniel.lezcano@kernel.org>,
	 Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>,
	 Anup Patel <anup@brainfault.org>,
	Tiffany Lin <tiffany.lin@mediatek.com>,
	 Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	 Yunfei Dong <yunfei.dong@mediatek.com>,
	 Minghsiu Tsai <minghsiu.tsai@mediatek.com>,
	 Houlong Wei <houlong.wei@mediatek.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Matthias Brugger <matthias.bgg@gmail.com>,
	 AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	 linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-mediatek@lists.infradead.org,
	Nathan Chancellor <nathan@kernel.org>,
	 "GUO Ren (XuanTie)" <guoren@kernel.org>
Subject: [PATCH v2 6/6] media: mtk-vpu: rename IPI_MAX to IPI_VPU_MAX
Date: Fri, 11 Sep 2026 03:27:14 +0000	[thread overview]
Message-ID: <20260911-ipi_max-v2-6-a77826ff189e@kernel.org> (raw)
In-Reply-To: <20260911-ipi_max-v2-0-a77826ff189e@kernel.org>

The last enumerator of this driver's firmware IPI id list is a bound
for the VPU mailbox protocol, not a generic host IPI limit. Follow the
existing naming in this header: IPI_VPU_INIT already carries a VPU
prefix, so the terminator should match.

The same convention is used by the SCP IPI enum, which ends with a
prefixed SCP_IPI_MAX rather than a bare IPI_MAX.

Rename IPI_MAX to IPI_VPU_MAX and update the descriptor table bounds
and range checks. No functional change.

Link: https://lore.kernel.org/linux-riscv/20260908222349.GA2324870@ax162
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: GUO Ren (XuanTie) <guoren@kernel.org>
---
 drivers/media/platform/mediatek/vpu/mtk_vpu.c | 12 ++++++------
 drivers/media/platform/mediatek/vpu/mtk_vpu.h |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
index 8d8319f0cd22..b3e9f8c4ab7a 100644
--- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c
+++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
@@ -211,7 +211,7 @@ struct mtk_vpu {
 	struct vpu_regs reg;
 	struct vpu_run run;
 	struct vpu_wdt wdt;
-	struct vpu_ipi_desc ipi_desc[IPI_MAX];
+	struct vpu_ipi_desc ipi_desc[IPI_VPU_MAX];
 	struct share_obj __iomem *recv_buf;
 	struct share_obj __iomem *send_buf;
 	struct device *dev;
@@ -221,7 +221,7 @@ struct mtk_vpu {
 	struct mutex vpu_mutex; /* for protecting vpu data data structure */
 	u32 wdt_refcnt;
 	wait_queue_head_t ack_wq;
-	bool ipi_id_ack[IPI_MAX];
+	bool ipi_id_ack[IPI_VPU_MAX];
 };
 
 static inline void vpu_cfg_writel(struct mtk_vpu *vpu, u32 val, u32 offset)
@@ -296,7 +296,7 @@ int vpu_ipi_register(struct platform_device *pdev,
 		return -EPROBE_DEFER;
 	}
 
-	if (id < IPI_MAX && handler) {
+	if (id < IPI_VPU_MAX && handler) {
 		ipi_desc = vpu->ipi_desc;
 		ipi_desc[id].name = name;
 		ipi_desc[id].handler = handler;
@@ -319,7 +319,7 @@ int vpu_ipi_send(struct platform_device *pdev,
 	unsigned long timeout;
 	int ret = 0;
 
-	if (id <= IPI_VPU_INIT || id >= IPI_MAX ||
+	if (id <= IPI_VPU_INIT || id >= IPI_VPU_MAX ||
 	    len > sizeof(send_obj->share_buf) || !buf) {
 		dev_err(vpu->dev, "failed to send ipi message\n");
 		return -EINVAL;
@@ -748,7 +748,7 @@ static void vpu_ipi_handler(struct mtk_vpu *vpu)
 	s32 id = readl(&rcv_obj->id);
 
 	memcpy_fromio(data, rcv_obj->share_buf, sizeof(data));
-	if (id < IPI_MAX && ipi_desc[id].handler) {
+	if (id < IPI_VPU_MAX && ipi_desc[id].handler) {
 		ipi_desc[id].handler(data, readl(&rcv_obj->len),
 				     ipi_desc[id].priv);
 		if (id > IPI_VPU_INIT) {
@@ -934,7 +934,7 @@ static int mtk_vpu_probe(struct platform_device *pdev)
 #ifdef CONFIG_DEBUG_FS
 	debugfs_remove(vpu_debugfs);
 #endif
-	memset(vpu->ipi_desc, 0, sizeof(struct vpu_ipi_desc) * IPI_MAX);
+	memset(vpu->ipi_desc, 0, sizeof(struct vpu_ipi_desc) * IPI_VPU_MAX);
 vpu_mutex_destroy:
 	mutex_destroy(&vpu->vpu_mutex);
 disable_vpu_clk:
diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.h b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
index 3951547e9ec5..44ab631ec904 100644
--- a/drivers/media/platform/mediatek/vpu/mtk_vpu.h
+++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
@@ -49,7 +49,7 @@ typedef void (*ipi_handler_t) (void *data,
  *			 handle VP8 video encoder job,, and vice versa.
  * @IPI_MDP:		 The interrupt from vpu is to notify kernel to
  *			 handle MDP (Media Data Path) job, and vice versa.
- * @IPI_MAX:		 The maximum IPI number
+ * @IPI_VPU_MAX:	 The maximum VPU IPI number
  */
 
 enum ipi_id {
@@ -60,7 +60,7 @@ enum ipi_id {
 	IPI_VENC_H264,
 	IPI_VENC_VP8,
 	IPI_MDP,
-	IPI_MAX,
+	IPI_VPU_MAX,
 };
 
 /**

-- 
2.43.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2026-09-11  3:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  3:27 [PATCH v2 0/6] riscv: Make IPI_MAX visible and use it consistently Guo Ren
2026-09-11  3:27 ` Guo Ren
2026-09-11  3:27 ` [PATCH v2 1/6] riscv: smp: Move enum ipi_message_type to asm/smp.h Guo Ren
2026-09-11  3:27   ` Guo Ren
2026-09-11  3:27 ` [PATCH v2 2/6] riscv: sbi: Use IPI_MAX for SBI IPI muxing Guo Ren
2026-09-11  3:27   ` Guo Ren
2026-09-11  3:27 ` [PATCH v2 3/6] clocksource: clint: Use IPI_MAX for " GUO Ren (XuanTie)
2026-09-11  3:27   ` GUO Ren (XuanTie)
2026-09-11  3:27 ` [PATCH v2 4/6] irqchip/aclint-sswi: " GUO Ren (XuanTie)
2026-09-11  3:27   ` GUO Ren (XuanTie)
2026-09-11  3:27 ` [PATCH v2 5/6] irqchip/imsic: Use IPI_MAX instead of IMSIC_NR_IPI GUO Ren (XuanTie)
2026-09-11  3:27   ` GUO Ren (XuanTie)
2026-09-11  3:27 ` GUO Ren (XuanTie) [this message]
2026-09-11  3:27   ` [PATCH v2 6/6] media: mtk-vpu: rename IPI_MAX to IPI_VPU_MAX GUO Ren (XuanTie)
2026-09-13 19:53 ` [PATCH v2 0/6] riscv: Make IPI_MAX visible and use it consistently Radu Rendec
2026-09-13 19:53   ` Radu Rendec

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=20260911-ipi_max-v2-6-a77826ff189e@kernel.org \
    --to=guoren@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=daniel.lezcano@kernel.org \
    --cc=houlong.wei@mediatek.com \
    --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=linux-riscv@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=minghsiu.tsai@mediatek.com \
    --cc=nathan@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=radu@rendec.net \
    --cc=tglx@kernel.org \
    --cc=tiffany.lin@mediatek.com \
    --cc=yunfei.dong@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.