Re: [PATCH v3 5/6] drm/msm: Convert map helper to use dma-address

From: Rob Clark

Date: Tue Oct 27 2026 - 21:34:36 EST


On Tue, Oct 27, 2026 at 6:14 PM Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Oct 27, 2026 at 04:04:48PM -0700, Rob Clark wrote:
> > Now that we have everything unified in one path, switch over to using
> > dma addresses for setting up the mapping. This avoids issues with
> > CONFIG_DMABUF_DEBUG stripping the pages from the sgt.
> >
> > Tested-by: Jianfeng Liu <liujianfeng1994@xxxxxxxxx> # x1e78100 (Acer SFA14-11), v7.3-rc5 + this series, CONFIG_DMABUF_DEBUG=y
> > Signed-off-by: Rob Clark <robin.clark@xxxxxxxxxxxxxxxx>
> > ---
> > drivers/gpu/drm/msm/msm_iommu.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
>
> This commit seems to break GPU on db410c (which uses qcom_iommu).
>
> [ 104.954564] [drm:a3xx_idle] *ERROR* 03000600: timeout waiting for GPU
> to idle!
> [ 104.954932] msm_mdp 1a01000.display-controller: [drm:adreno_load_gpu]
> *ERROR* gpu hw init failed: -22
> [ 105.958559] [drm:a3xx_idle] *ERROR* 03000600: timeout waiting for GPU
> to idle!
> [ 109.082571] [drm:a3xx_idle] *ERROR* 03000600: timeout waiting for GPU
> to idle!
> [ 109.082670] msm_mdp 1a01000.display-controller: [drm:adreno_load_gpu]
> *ERROR* gpu hw init failed: -22
> [ 110.086572] [drm:a3xx_idle] *ERROR* 03000600: timeout waiting for GPU
> to idle!
> [ 111.098576] [drm:a3xx_idle] *ERROR* 03000600: timeout waiting for GPU
> to idle!
> [ 111.098674] msm_mdp 1a01000.display-controller: [drm:adreno_load_gpu]
> *ERROR* gpu hw init failed: -22
> c[ 112.102576] [drm:a3xx_idle] *ERROR* 03000600: timeout waiting for
> GPU to idle!

If that came down to this patch (and not the earlier msm_iommu.c
bits), then I'd look to the hint in the cover letter:

This all depends on being dma_map_direct() for the dma_map_sgtable()
to work. This should be the case on modern things that use arm-smmu.
It's less clear when it comes to older pre-arm-smmu hw. It's possible
that this series causes those things to catch fire. If so, look to
commit 0e764a01015d ("iommu/arm-smmu: Allow client devices to select
direct mapping") for inspiration.


BR,
-R

> >
> > diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
> > index 479e5450a4dc..c2950d32c507 100644
> > --- a/drivers/gpu/drm/msm/msm_iommu.c
> > +++ b/drivers/gpu/drm/msm/msm_iommu.c
> > @@ -153,9 +153,9 @@ __do_map(unsigned long pgsize_bitmap, u64 iova, struct sg_table *sgt, size_t off
> > u64 addr = iova;
> > unsigned int i;
> >
> > - for_each_sgtable_sg (sgt, sg, i) {
> > - size_t size = sg->length;
> > - phys_addr_t phys = sg_phys(sg);
> > + for_each_sgtable_dma_sg (sgt, sg, i) {
> > + size_t size = sg_dma_len(sg);
> > + phys_addr_t phys = sg_dma_address(sg);
> >
> > if (!len)
> > break;
> > --
> > 2.56.0
> >
>
> --
> With best wishes
> Dmitry