Skip to content

drm/msm: DMABUF_DEBUG fixes

Rob Clark dri-devel linux-arm-msm lkml 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 0 repliesNew
  2. v36 patches 3 repliesSuperseded
  3. v25 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v15 patches6 repliesSuperseded

Changes in v4 from the cover letter

- Fix get_pages() error path
- Link to v3: https://lore.kernel.org/all/[email protected]/

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6drm/msm: Cleanup if pages_to_sg() failsdrivers/gpu/drm/msm/msm_gem.c+23 -180 replies
2/6drm/msm/gem: dma_map/unmap_sgtable()drivers/gpu/drm/msm/msm_gem.c+28 -370 replies
3/6drm/msm: Extract out map/unmap helpersdrivers/gpu/drm/msm/msm_iommu.c+103 -560 replies
4/6drm/msm: Convert iommu map/unmap to helpersdrivers/gpu/drm/msm/msm_iommu.c+32 -110 replies
5/6drm/msm: Convert map helper to use dma-addressdrivers/gpu/drm/msm/msm_iommu.c+3 -30 replies
6/6drm/msm: Treat !mapped as an errordrivers/gpu/drm/msm/msm_iommu.c+4 -00 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by.

PatchJianfeng Liu
1/6T-b
2/6T-b
3/6T-b
4/6T-b
5/6T-b
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/6] drm/msm: DMABUF_DEBUG fixes

With DMABUF_DEBUG=y, the page information is stripped from the sgt that we get for an externally allocated buffer that is dma-buf imported (as opposed to an exported GEM buffer that is re-imported). This is a bit unfortunate, since we need that information for mapping the buffer in both paths:

1. Userspace GPU pgtables (TTBR0), where we use io_pgtable directly. Fortunately this we can fix ourselves easily.

2. Iommu managed pgtables (scanout, kernel GPU buffers (TTBR1)). In normal usage that iommu subsystem envisions the dma-mapping and iommu-mapping are combined. We can't really work around this but we can stop trying to pretend to be a normal iommu user and just go directly to the iommu_domain_ops.

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.

Note, for older pre-arm-smmu devices, this iommu series is a dependency:
https://lore.kernel.org/all/[email protected]/

v4:
- Fix get_pages() error path
- Link to v3: https://lore.kernel.org/all/[email protected]/

v3:
- Fixing missing tlb flushes in error paths harder
- Do a single dma_map/unmap_sgtable()
- More paranoid error checking on map path
- Link to v2: https://lore.kernel.org/all/[email protected]/

v2:
- Fix missing tlb flushes in error paths
- Link to v1: https://lore.kernel.org/all/[email protected]/

Rob Clark (6):
drm/msm: Cleanup if pages_to_sg() fails
drm/msm/gem: dma_map/unmap_sgtable()
drm/msm: Extract out map/unmap helpers
drm/msm: Convert iommu map/unmap to helpers
drm/msm: Convert map helper to use dma-address
drm/msm: Treat !mapped as an error

 drivers/gpu/drm/msm/msm_gem.c   |  96 +++++++--------
 drivers/gpu/drm/msm/msm_iommu.c | 210 +++++++++++++++++++++-----------
 2 files changed, 187 insertions(+), 119 deletions(-)
Signature · 1 line
2.56.0