dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/tests: shmem: Fix intermittent DMA overflow on ppc64le/s390x
@ 2026-07-03  6:34 José Expósito
  2026-07-03  6:34 ` [PATCH 1/2] drm/tests: shmem: Set DMA mask to 64-bit in drm_gem_shmem_test_get_pages_sgt José Expósito
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: José Expósito @ 2026-07-03  6:34 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-kernel, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona, boris.brezillon, kees, José Expósito

Two drm_gem_shmem KUnit tests, drm_gem_shmem_test_get_pages_sgt() and
drm_gem_shmem_test_purge(), intermittently fail on ppc64le and s390x CI
with a DMA address overflow warning followed by -EIO:

  DMA addr 0x00000001130b0000+65536 overflow (mask ffffffff, bus limit 0).
  Expected sgt is not error, but is: -5

Both tests call `drm_gem_shmem_get_pages_sgt()`, which internally pins
backing pages and DMA-maps them via `dma_map_sgtable()`. The DMA mapping
path is:

  drm_gem_shmem_test_purge()
    drm_gem_shmem_get_pages_sgt()
      drm_gem_shmem_get_pages_sgt_locked() [drm_gem_shmem_helper.c]
        dma_map_sgtable()                  [mapping.c]
          __dma_map_sg_attrs()
            dma_direct_map_sg()            [direct.c]
              dma_direct_map_phys()        [kernel/dma/direct.h]
                dma_capable()              Checks addr against DMA mask
                  -> FAILS: addr > 0xFFFFFFFF

KUnit devices are initialized with a 32-bit DMA mask
(`DMA_BIT_MASK(32)`) in `lib/kunit/device.c`. On systems where the kernel
allocates backing pages at physical addresses above 4GB, `dma_capable()`
returns false because the address exceeds the 32-bit mask. The `dma_set_mask()`
function updates `*dev->dma_mask` to the given value; setting it to
`DMA_BIT_MASK(64)` allows any physical address to pass the check.

The failure is intermittent because pages may or may not be allocated
above 4GB on any given run depend on memory pressure.

A third test in the same suite, `drm_gem_shmem_test_obj_create_private`,
already calls `dma_set_mask(drm_dev->dev, DMA_BIT_MASK(64))` before its
DMA mapping. This series applies the same fix to the two remaining tests.

José Expósito (2):
  drm/tests: shmem: Set DMA mask to 64-bit in
    drm_gem_shmem_test_get_pages_sgt
  drm/tests: shmem: Set DMA mask to 64-bit in drm_gem_shmem_test_purge

 drivers/gpu/drm/tests/drm_gem_shmem_test.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-07-03 14:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-03  6:34 [PATCH 0/2] drm/tests: shmem: Fix intermittent DMA overflow on ppc64le/s390x José Expósito
2026-07-03  6:34 ` [PATCH 1/2] drm/tests: shmem: Set DMA mask to 64-bit in drm_gem_shmem_test_get_pages_sgt José Expósito
2026-07-03  6:34 ` [PATCH 2/2] drm/tests: shmem: Set DMA mask to 64-bit in drm_gem_shmem_test_purge José Expósito
2026-07-03  6:53 ` [PATCH 0/2] drm/tests: shmem: Fix intermittent DMA overflow on ppc64le/s390x Thomas Zimmermann
2026-07-03  9:00   ` José Expósito
2026-07-03 10:32     ` Thomas Zimmermann
2026-07-03 14:30       ` José Expósito

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox