Re: [PATCH 1/1] soc: mediatek: mtk-cmdq: Fold the PA low half in write_pa helpers
From: Jason-JH Lin (林睿祥)
Date: Wed Dec 02 2026 - 05:04:02 EST
On Wed, 2026-12-02 at 12:15 +0800, Fei Shao wrote:
> On Tue, Dec 1, 2026 at 7:25 PM Jason-JH Lin
> <jason-jh.lin@xxxxxxxxxxxx> wrote:
> >
> > From: Jason-jh Lin <jason-jh.lin@xxxxxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxx
> > Signed-off-by: Jason-jh Lin <jason-jh.lin@xxxxxxxxxxxx>
> > ---
> > drivers/soc/mediatek/mtk-cmdq-helper.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
>
> Reviewed-by: Fei Shao <fshao@xxxxxxxxxxxx>
Hi Fei, Roman,
Thank you for the reviews.
However, I found that callers already do the same thing on their side.
MDP3:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=307673410774d5708232d05a977f047c03e2a4bb
SOC:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=004361f01625fda9f6d4009d0dc5a59e32b7be7d
DDP(not applied):
https://patchwork.kernel.org/project/linux-mediatek/patch/20260325035836.2110757-4-jason-jh.lin@xxxxxxxxxxxx/
Base on the definition to this API, pa_base means the pure base address
of hardware MMIO.
I think the concept of this patch is correct, but I need to modify the
usage for all callers.
I'll send v2 including the callers parts.
If you have any suggestions. Please let me know. Thanks!
Regards,
Jason-JH Lin