aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
diff options
context:
space:
mode:
authorKarolina Stolarek <karolina.stolarek@intel.com>2023-08-08 11:51:12 +0200
committerChristian König <christian.koenig@amd.com>2023-08-09 18:04:22 +0200
commite3912d09bf8ddd8e274118d4c9cc550d9665115d (patch)
tree8e882209309bfafca84da0332e31574e55bd5148 /drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
parentaccel/ivpu: Add initial support for VPU 4 (diff)
downloadwireguard-linux-e3912d09bf8ddd8e274118d4c9cc550d9665115d.tar.xz
wireguard-linux-e3912d09bf8ddd8e274118d4c9cc550d9665115d.zip
drm/ttm: Introduce KUnit test
Add the initial version of unit tests for ttm_device struct, together with helper functions. Signed-off-by: Karolina Stolarek <karolina.stolarek@intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/3d1cc45c8a0cf536b92a850e0025f6c555de0169.1691487006.git.karolina.stolarek@intel.com Signed-off-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to '')
-rw-r--r--drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
new file mode 100644
index 000000000000..f9f5bc03e93a
--- /dev/null
+++ b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 AND MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+#ifndef TTM_KUNIT_HELPERS_H
+#define TTM_KUNIT_HELPERS_H
+
+#include <drm/drm_drv.h>
+#include <drm/ttm/ttm_device.h>
+
+#include <drm/drm_kunit_helpers.h>
+#include <kunit/test.h>
+
+extern struct ttm_device_funcs ttm_dev_funcs;
+
+struct ttm_test_devices {
+ struct drm_device *drm;
+ struct device *dev;
+ struct ttm_device *ttm_dev;
+};
+
+/* Building blocks for test-specific init functions */
+int ttm_device_kunit_init(struct ttm_test_devices *priv,
+ struct ttm_device *ttm,
+ bool use_dma_alloc,
+ bool use_dma32);
+
+struct ttm_test_devices *ttm_test_devices_basic(struct kunit *test);
+struct ttm_test_devices *ttm_test_devices_all(struct kunit *test);
+
+void ttm_test_devices_put(struct kunit *test, struct ttm_test_devices *devs);
+
+/* Generic init/fini for tests that only need DRM/TTM devices */
+int ttm_test_devices_init(struct kunit *test);
+void ttm_test_devices_fini(struct kunit *test);
+
+#endif // TTM_KUNIT_HELPERS_H