From: Jason-JH Lin <jason-jh.lin@mediatek.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>,
Jason-JH Lin <jason-jh.lin@mediatek.com>,
Paul-PL Chen <paul-pl.chen@mediatek.com>,
Zi-Hao Huang <zi-hao.huang@mediatek.com>,
Olivia Wen <olivia.wen@mediatek.com>,
Fei Shao <fshao@chromium.org>, Chen-yu Tsai <wenst@chromium.org>,
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
<linux-kernel@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>, <stable@vger.kernel.org>
Subject: [PATCH 1/1] soc: mediatek: mtk-cmdq: Fold the PA low half in write_pa helpers
Date: Tue, 1 Dec 2026 19:23:23 +0800 [thread overview]
Message-ID: <20261201112523.643035-1-jason-jh.lin@mediatek.com> (raw)
From: Jason-jh Lin <jason-jh.lin@mediatek.com>
cmdq_pkt_write_pa() and cmdq_pkt_write_mask_pa() build the WRITE_S
target address as SPR << 16 | (arg & ~BIT(1)), but only load the SPR
with CMDQ_ADDR_HIGH(pa_base) and pass only the register offset as the
WRITE_S argument. When pa_base is not 64K aligned, its low 16 bits are
lost and the write lands at (pa_base & ~0xffff) + offset, while the
packet still runs to EOC without error.
Fold pa_base + offset into both halves, so the SPR gets
CMDQ_ADDR_HIGH(pa_base + offset) and the WRITE_S argument gets
CMDQ_ADDR_LOW(pa_base + offset).
Fixes: 40dc5bbad63b ("soc: mediatek: mtk-cmdq: Extend cmdq_pkt_write API for SoCs without subsys ID")
Cc: stable@vger.kernel.org
Signed-off-by: Jason-jh Lin <jason-jh.lin@mediatek.com>
---
drivers/soc/mediatek/mtk-cmdq-helper.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c
index fb82f2a85a21..99d5750b6dc4 100644
--- a/drivers/soc/mediatek/mtk-cmdq-helper.c
+++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
@@ -247,11 +247,12 @@ int cmdq_pkt_write_pa(struct cmdq_pkt *pkt, u8 subsys /*unused*/, u32 pa_base,
{
int err;
- err = cmdq_pkt_assign(pkt, CMDQ_THR_SPR_IDX0, CMDQ_ADDR_HIGH(pa_base));
+ err = cmdq_pkt_assign(pkt, CMDQ_THR_SPR_IDX0, CMDQ_ADDR_HIGH(pa_base + offset));
if (err < 0)
return err;
- return cmdq_pkt_write_s_value(pkt, CMDQ_THR_SPR_IDX0, CMDQ_ADDR_LOW(offset), value);
+ return cmdq_pkt_write_s_value(pkt, CMDQ_THR_SPR_IDX0,
+ CMDQ_ADDR_LOW(pa_base + offset), value);
}
EXPORT_SYMBOL(cmdq_pkt_write_pa);
@@ -284,12 +285,12 @@ int cmdq_pkt_write_mask_pa(struct cmdq_pkt *pkt, u8 subsys /*unused*/, u32 pa_ba
{
int err;
- err = cmdq_pkt_assign(pkt, CMDQ_THR_SPR_IDX0, CMDQ_ADDR_HIGH(pa_base));
+ err = cmdq_pkt_assign(pkt, CMDQ_THR_SPR_IDX0, CMDQ_ADDR_HIGH(pa_base + offset));
if (err < 0)
return err;
return cmdq_pkt_write_s_mask_value(pkt, CMDQ_THR_SPR_IDX0,
- CMDQ_ADDR_LOW(offset), value, mask);
+ CMDQ_ADDR_LOW(pa_base + offset), value, mask);
}
EXPORT_SYMBOL(cmdq_pkt_write_mask_pa);
--
2.43.0
next reply other threads:[~2026-12-01 11:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 11:23 Jason-JH Lin [this message]
2026-12-01 15:22 ` Roman Vivchar
2026-12-02 4:15 ` Fei Shao
2026-12-02 10:01 ` 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=20261201112523.643035-1-jason-jh.lin@mediatek.com \
--to=jason-jh.lin@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=fshao@chromium.org \
--cc=jassisinghbrar@gmail.com \
--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=olivia.wen@mediatek.com \
--cc=paul-pl.chen@mediatek.com \
--cc=stable@vger.kernel.org \
--cc=wenst@chromium.org \
--cc=zi-hao.huang@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 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®