diff mbox series

[v11,03/10] drm/ttm/tests: Set DMA mask in KUnit device

Message ID b73b911c18c2d1a0eab954e6dc53cbc10461758c.1713357042.git.karolina.stolarek@intel.com (mailing list archive)
State New, archived
Headers show
Series Improve test coverage of TTM | expand

Commit Message

Karolina Stolarek April 17, 2024, 1:03 p.m. UTC
In commit d393acce7b3f ("drm/tests: Switch to kunit devices"),
DRM test helpers migrated away from using a dummy platform driver
in favour of KUnit device. This means that DMA masks for the device
are not set but are required by ttm_pool_alloc tests.

Set the DMA mask for coherent mappings to unblock testing.

Signed-off-by: Karolina Stolarek <karolina.stolarek@intel.com>
---
 drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Nirmoy Das April 17, 2024, 1:54 p.m. UTC | #1
On 4/17/2024 3:03 PM, Karolina Stolarek wrote:
> In commit d393acce7b3f ("drm/tests: Switch to kunit devices"),
> DRM test helpers migrated away from using a dummy platform driver
> in favour of KUnit device. This means that DMA masks for the device
> are not set but are required by ttm_pool_alloc tests.
>
> Set the DMA mask for coherent mappings to unblock testing.
>
> Signed-off-by: Karolina Stolarek <karolina.stolarek@intel.com>
> ---
>   drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
> index 7b7c1fa805fc..cb1cd676f8ae 100644
> --- a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
> +++ b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
> @@ -98,6 +98,9 @@ struct ttm_test_devices *ttm_test_devices_basic(struct kunit *test)
>   	devs->dev = drm_kunit_helper_alloc_device(test);
>   	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, devs->dev);
>   
> +	/* Set mask for alloc_coherent mappings to enable ttm_pool_alloc testing */
> +	devs->dev->coherent_dma_mask = -1;

DMA_BIT_MASK() would be nice here. I wonder if it make sense to move 
that to kunit device related calls,  anyway this is:

Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>

> +
>   	devs->drm = __drm_kunit_helper_alloc_drm_device(test, devs->dev,
>   							sizeof(*devs->drm), 0,
>   							DRIVER_GEM);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
index 7b7c1fa805fc..cb1cd676f8ae 100644
--- a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
+++ b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
@@ -98,6 +98,9 @@  struct ttm_test_devices *ttm_test_devices_basic(struct kunit *test)
 	devs->dev = drm_kunit_helper_alloc_device(test);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, devs->dev);
 
+	/* Set mask for alloc_coherent mappings to enable ttm_pool_alloc testing */
+	devs->dev->coherent_dma_mask = -1;
+
 	devs->drm = __drm_kunit_helper_alloc_drm_device(test, devs->dev,
 							sizeof(*devs->drm), 0,
 							DRIVER_GEM);