mailbox: mtk-cmdq: Refine DMA address handling for the command buffer
authorJason-JH Lin <jason-jh.lin@mediatek.com>
Wed, 22 Oct 2025 17:16:30 +0000 (01:16 +0800)
committerJassi Brar <jassisinghbrar@gmail.com>
Fri, 28 Nov 2025 15:31:53 +0000 (09:31 -0600)
commita195c7ccfb7a21b8118139835e25936ec8722596
tree11c4b59ec59d236f3fdc1340341124ef21a51fc1
parent3acf1028f5003731977f750a7070f3321a9cb740
mailbox: mtk-cmdq: Refine DMA address handling for the command buffer

GCE can only fetch the command buffer address from a 32-bit register.
Some SoCs support a 35-bit command buffer address for GCE, which
requires a right shift of 3 bits before setting the address into
the 32-bit register. A comment has been added to the header of
cmdq_get_shift_pa() to explain this requirement.

To prevent the GCE command buffer address from being DMA mapped beyond
its supported bit range, the DMA bit mask for the device is set during
initialization.

Additionally, to ensure the correct shift is applied when setting or
reading the register that stores the GCE command buffer address,
new APIs, cmdq_convert_gce_addr() and cmdq_revert_gce_addr(), have
been introduced for consistent operations on this register.

The variable type for the command buffer address has been standardized
to dma_addr_t to prevent handling issues caused by type mismatches.

Fixes: 0858fde496f8 ("mailbox: cmdq: variablize address shift in platform")
Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
drivers/mailbox/mtk-cmdq-mailbox.c
include/linux/mailbox/mtk-cmdq-mailbox.h