[PATCH 2/3] drm/armada: set an unlimited DMA segment size

From: Karl Mehltretter

Date: Mon Oct 05 2026 - 02:47:59 EST


The driver never sets a maximum DMA segment size, so the device claims
the 64 KiB default. With DMA_API_DEBUG, importing a larger contiguous
dma-buf reports:

DMA-API: armada-drm armada-drm: mapping sg segment longer than
device claims to support [len=1228800] [max=65536]

armada_gem_map_import() also needs the buffer as one entry. An exporter
that respects the 64 KiB claim has to split a larger buffer, and the
import fails with "dma_buf_map_attachment() returned an (unsupported)
scattered list".

Set the maximum segment size to UINT_MAX.

Verified with a QEMU stub. Not tested on real hardware.

Fixes: 96f60e37dc66 ("DRM: Armada: Add Armada DRM driver")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
---

Notes:
Tested on v7.3-rc4-70-gfe2ec83746e5 with DMA_API_DEBUG on QEMU's
xilinx-zynq-a9. The LCD controller probed from a stub device tree
node, so all registers read 0. A test module registered the
armada-drm platform device, because nothing in mainline registers it.

Creating a framebuffer from an imported 1228800-byte CMA heap buffer
works before and after this patch, with one segment-length report
before and none after. With patch 3 alone it fails. With patches 2
and 3 it works.

drivers/gpu/drm/armada/armada_drv.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index cae25ad66c74..42498fc77e54 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -6,6 +6,7 @@
#include <linux/aperture.h>
#include <linux/clk.h>
#include <linux/component.h>
+#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
@@ -101,6 +102,8 @@ static int armada_drm_bind(struct device *dev)

dev_set_drvdata(dev, &priv->drm);

+ dma_set_max_seg_size(dev, UINT_MAX);
+
/* Mode setting support */
drm_mode_config_init(&priv->drm);
priv->drm.mode_config.min_width = 320;
--
2.53.0