linux/drivers/gpu/drm/tests
José Expósito b04a248cfa drm/tests: shmem: Set DMA mask to 64-bit in drm_gem_shmem
drm_gem_shmem_test_purge [1] and drm_gem_shmem_test_get_pages_sgt [2]
intermittently fail on ppc64le and s390x CI systems with a DMA address
overflow:

  DMA addr 0x0000000100307000+4096 overflow (mask ffffffff, bus limit 0)
  WARNING: kernel/dma/direct.h:114 dma_direct_map_sg+0x778/0x920

  drm_gem_shmem_test_purge: ASSERTION FAILED at
    drivers/gpu/drm/tests/drm_gem_shmem_test.c:330
    Expected sgt is not error, but is: -5

The call chain leading to the failure is:

  drm_gem_shmem_test_purge() / drm_gem_shmem_test_get_pages_sgt()
    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

The root cause is that KUnit devices are initialized with a 32-bit DMA
mask (DMA_BIT_MASK(32)) in lib/kunit/device.c. On ppc64le and s390x
systems with physical memory above 4GB, page allocations can land at
addresses that exceed this mask. When drm_gem_shmem_get_pages_sgt()
attempts to DMA-map these pages via dma_map_sgtable(), the DMA layer
rejects the mapping because the physical address overflows the 32-bit
mask.

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

Fix by setting a 64-bit DMA mask on the device before calling
drm_gem_shmem_get_pages_sgt() for all tests, following the same pattern
already used in drm_gem_shmem_test_obj_create_private().

[1] https://s3.amazonaws.com/arr-cki-prod-trusted-artifacts/trusted-artifacts/2643976103/test_s390x/15128551935/artifacts/jobwatch/logs/recipes/21561049/tasks/220716793/results/1014626315/logs/dmesg.log
[2] https://s3.amazonaws.com/arr-cki-prod-trusted-artifacts/trusted-artifacts/2643976103/test_ppc64le/15128551933/artifacts/jobwatch/logs/recipes/21561041/tasks/220716705/results/1014628163/logs/dmesg.log

Fixes: 93032ae634 ("drm/test: add a test suite for GEM objects backed by shmem")
Closes: https://datawarehouse.cki-project.org/issue/5345
Closes: https://datawarehouse.cki-project.org/issue/3184
Assisted-by: Claude:claude-4.6-opus
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: José Expósito <jose.exposito@redhat.com>
Link: https://patch.msgid.link/20260703150808.3832-1-jose.exposito89@gmail.com
2026-07-23 11:48:43 +02:00
..
.kunitconfig drm/tests: make sure drm_client_modeset tests are enabled 2025-09-16 20:20:21 +03:00
drm_atomic_commit_test.c drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_atomic_test.c
drm_bridge_test.c drm-misc-next for v7.2-rc1: 2026-05-08 14:16:04 +10:00
drm_client_modeset_test.c drm/tests: hdmi: check the infoframes behaviour 2026-01-19 13:10:35 +02:00
drm_cmdline_parser_test.c
drm_connector_test.c drm/display: hdmi: Use drm_output_color_format instead of hdmi_colorspace 2026-03-24 13:54:35 +01:00
drm_damage_helper_test.c
drm_dp_mst_helper_test.c
drm_exec_test.c drm/drm_exec: avoid indirect goto 2026-07-07 14:02:53 +02:00
drm_fixp_test.c drm/tests: Add a few tests around drm_fixed.h 2025-11-26 23:03:33 +01:00
drm_format_helper_test.c
drm_format_test.c
drm_framebuffer_test.c
drm_gem_shmem_test.c drm/tests: shmem: Set DMA mask to 64-bit in drm_gem_shmem 2026-07-23 11:48:43 +02:00
drm_hdmi_state_helper_test.c drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_kunit_edid.h drm/tests: hdmi: check the infoframes behaviour 2026-01-19 13:10:35 +02:00
drm_kunit_helpers.c drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00
drm_managed_test.c
drm_mm_test.c Merge drm/drm-next into drm-misc-next 2026-02-23 11:48:20 +01:00
drm_modes_test.c
drm_panic_test.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
drm_plane_helper_test.c
drm_probe_helper_test.c
drm_rect_test.c drm: Suppress intentional warning backtraces in scaling unit tests 2026-05-14 10:50:00 -06:00
drm_sysfb_modeset_test.c
Makefile drm: Rename struct drm_atomic_state to drm_atomic_commit 2026-05-04 14:05:04 +10:00