Skip to content

drm/msm: followup - map page-less imported sg_tables

Jianfeng Liu dri-devel linux-arm-msm linux-iommu linux-media lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2iommu: export iommu_get_dma_domain()drivers/iommu/iommu.c+1 -02 replies
2/2drm/msm: map page-less imported sg_tables from their DMA addressesdrivers/gpu/drm/msm/msm_gem_vma.c drivers/gpu/drm/msm/msm_iommu.c drivers/gpu/drm/msm/msm_mmu.h+110 -22 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/2] drm/msm: followup - map page-less imported sg_tables

Hi Rob,

this is the follow-up I promised: it fixes the two remaining map paths that still consume struct page/sg->length of imported sg_tables, and therefore completes the DMABUF_DEBUG=y story when applied on top of your series [1].

Test results on x1e78100 (Snapdragon X1E78100, DMABUF_DEBUG=y, kernel v7.3-rc4 based), which is the machine that originally reported the UCHE translation faults and the one hardware test environment for imports of buffers not first exported by drm/msm:

- v7.3-rc4 stock: arm-smmu UCHE translation faults during hardware video decode in clapper/chromium (bisected to 143755bdabaa9)

- your series alone: video plays via the userspace copy fallback, zero GPU faults, but a WARN storm from __arm_lpae_unmap() (472 traces within a minute of video playback) - every map of a page-less sg_table silently maps nothing, so the matching unmap finds no PTE and WARNs. This matches your cover letter saying the map paths are not addressed by the series. Your patch 2 ("mmap imported dma-bufs via the exporter") in particular works:
a test importing a linux,cma-heap buffer via DRM_IOCTL_PRIME_FD_TO_HANDLE and mmaps it both through the heap fd and through msm's GEM mmap sees the same memory through both mappings, including writes visible in both directions.

- your series + this series: zero arm-smmu faults, zero io-pgtable WARNs, and hardware video decode displays correctly in clapper and chromium. The GPU per-process pagetable path is exercised with real decoder capture buffers (videobuf2-dma-contig, 2MB frames) and maps them from their DMA addresses.

Patch 1 exports iommu_get_dma_domain(), which msm needs to look up the dma_addr -> phys mapping of imported buffers through the msm drm device's DMA-API domain. On platforms where the drm device is direct mapped (like mine: ae01000.display-controller is in no iommu_group) the lookup degenerates to the identity; on platforms where it sits behind a translated IOMMU the translation is needed.

Happy to rebase on whatever your tree looks like - and I can rerun the full test matrix (WARN count, fault count, kmssink scanout of real V4L2 frames, chromium/clapper hardware decode) on any revision.

[1] <[email protected]>

Jianfeng Liu (2):
iommu: export iommu_get_dma_domain()
drm/msm: map page-less imported sg_tables from their DMA addresses

 drivers/gpu/drm/msm/msm_gem_vma.c |  9 ++++
 drivers/gpu/drm/msm/msm_iommu.c   | 90 ++++++++++++++++++++++++++++++-
 drivers/gpu/drm/msm/msm_mmu.h     | 13 +++++
 drivers/iommu/iommu.c             |  1 +
 4 files changed, 111 insertions(+), 2 deletions(-)

---
base-commit: d6882ed4e5b3970a13d721a07d2737c4831cdced
branch: msm-map-followup-v1

Signature · 1 line
2.47.3