Skip to content

Commit 62b45ba

Browse files
airliedmripard
authored andcommitted
drm/test: fix the gem shmem test to map the sg table.
The test here creates an sg table, but never maps it, when we get to drm_gem_shmem_free, the helper tries to unmap and this causes warnings on some platforms and debug kernels. This also sets a 64-bit dma mask, as I see an swiotlb warning if I stick with the default 32-bit one. Fixes: 93032ae ("drm/test: add a test suite for GEM objects backed by shmem") Cc: [email protected] Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Michael J. Ruhl <[email protected]> Acked-by: Daniel Vetter <[email protected]> Reviewed-by: Marco Pagani <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Maxime Ripard <[email protected]>
1 parent 113fd63 commit 62b45ba

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/gpu/drm/tests/drm_gem_shmem_test.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ static void drm_gem_shmem_test_obj_create_private(struct kunit *test)
102102

103103
sg_init_one(sgt->sgl, buf, TEST_SIZE);
104104

105+
/*
106+
* Set the DMA mask to 64-bits and map the sgtables
107+
* otherwise drm_gem_shmem_free will cause a warning
108+
* on debug kernels.
109+
*/
110+
ret = dma_set_mask(drm_dev->dev, DMA_BIT_MASK(64));
111+
KUNIT_ASSERT_EQ(test, ret, 0);
112+
113+
ret = dma_map_sgtable(drm_dev->dev, sgt, DMA_BIDIRECTIONAL, 0);
114+
KUNIT_ASSERT_EQ(test, ret, 0);
115+
105116
/* Init a mock DMA-BUF */
106117
buf_mock.size = TEST_SIZE;
107118
attach_mock.dmabuf = &buf_mock;

0 commit comments

Comments
 (0)