Skip to content

dma-buf: heaps: cma: respect the importer's maximum segment size

Karl Mehltretter dri-devel linux-media linux-tegra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3media: tegra-vde: set an unlimited DMA segment sizedrivers/media/platform/nvidia/tegra-vde/vde.c+2 -00 replies
2/3drm/armada: set an unlimited DMA segment sizedrivers/gpu/drm/armada/armada_drv.c+3 -00 replies
3/3dma-buf: heaps: cma: respect the device's maximum segment sizedrivers/dma-buf/heaps/cma_heap.c+10 -41 reply

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/3] dma-buf: heaps: cma: respect the importer's maximum segment size

The CMA heap builds attachment scatterlists without considering the importing device's maximum DMA segment size. When an entry exceeds that limit, DMA_API_DEBUG reports "mapping sg segment longer than device claims to support". Patch 3 uses the importer's limit. A corresponding udmabuf fix was posted in [1].

With patch 3, an importer that keeps the 64 KiB default gets a larger buffer in several entries. Two in-tree importers require a single entry and never set a limit: tegra-vde without an IOMMU domain, and armada. Patches 1 and 2 set an unlimited segment size there. I found them by searching the importers for checks on the number of entries and on the length of the first entry. etnaviv has a fast path for single-entry buffers but already declares a 2 GiB limit.

Patches 1 and 2 are valid on their own and can go through their own trees. Patch 3 should only be applied after them, and is marked stable+noautosel for that reason.

Tested in QEMU only, not on real hardware: patch 3 on a custom model of the SAM9X75 Curiosity, and all three patches on xilinx-zynq-a9 with tegra-vde and armada probing from stub device tree nodes. The notes of each patch have the details.

[1] https://lore.kernel.org/r/[email protected]/

Karl Mehltretter (3):
media: tegra-vde: set an unlimited DMA segment size drm/armada: set an unlimited DMA segment size
dma-buf: heaps: cma: respect the device's maximum segment size

 drivers/dma-buf/heaps/cma_heap.c              | 14 ++++++++++----
 drivers/gpu/drm/armada/armada_drv.c           |  3 +++
 drivers/media/platform/nvidia/tegra-vde/vde.c |  2 ++
 3 files changed, 15 insertions(+), 4 deletions(-)

base-commit: fe2ec83746e501645709761605c2464a44fd2929

Signature · 1 line
2.53.0