On Thu, Nov 26, 2026 at 04:19:42PM +0200, Vladimir Zapolskiy wrote:
> The DSI 6G TX buffer is allocated by msm_gem_kernel_new(), which pins
> the buffer object in the KMS address space and returns its IOVA, but the
> returned IOVA is ignored. Instead dsi_dma_base_get_6g() calls
> msm_gem_get_and_pin_iova() on every DSI command transfer to get the TX
> buffer address, and the buffer is never unpinned after the transfer.
>
> As a result the pin count of the TX buffer object grows with every
> transmitted DSI command, and when the buffer is freed by
> msm_gem_kernel_put(), which drops only the pin taken on allocation,
> the object is freed while still pinned:
>
> msm_obj->pin_count
> WARNING: drivers/gpu/drm/msm/msm_gem.c:173 at update_lru_locked+0x90/0x98
> Call trace:
> update_lru_locked+0x90/0x98 (P)
> put_pages+0x8c/0x104
> msm_gem_free_object+0x1bc/0x244
> drm_gem_object_free+0x1c/0x30
> msm_gem_kernel_put+0xa4/0xb8
> msm_dsi_tx_buf_free+0x2c/0x64
> dsi_unbind+0x20/0x40
>
> Save the IOVA returned on the TX buffer allocation and use it as the DMA
> base of command transfers without pinning the buffer again.
>
> Fixes: 9fe041f6fdfe ("drm/msm: Add msm_gem_get_and_pin_iova()")
> Signed-off-by: Vladimir Zapolskiy <[email protected]>
> ---
> drivers/gpu/drm/msm/dsi/dsi_host.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <[email protected]>
--
With best wishes
Dmitry