drm/xe/kunit: fix link failure with built-in xe
authorArnd Bergmann <arnd@arndb.de>
Mon, 26 Feb 2024 12:46:36 +0000 (13:46 +0100)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 4 Mar 2024 14:41:11 +0000 (08:41 -0600)
When the driver is built-in but the tests are in loadable modules,
the helpers don't actually get put into the driver:

ERROR: modpost: "xe_kunit_helper_alloc_xe_device" [drivers/gpu/drm/xe/tests/xe_test.ko] undefined!

Change the Makefile to ensure they are always part of the driver
even when the rest of the kunit tests are in loadable modules.

Fixes: 5095d13d758b ("drm/xe/kunit: Define helper functions to allocate fake xe device")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240226124736.1272949-1-arnd@kernel.org
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
(cherry picked from commit 0e6fec6da25167a568fbaeb8401d8172069124ad)
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/Kconfig
drivers/gpu/drm/xe/Kconfig.debug
drivers/gpu/drm/xe/Makefile

index 0e31dfb8989e929ba2786c56e26e2c3edf8d8d0c..1a556d087e63c30f62e8afe355ece1913b0b7741 100644 (file)
@@ -10,6 +10,7 @@ config DRM_XE
        select DRM_BUDDY
        select DRM_EXEC
        select DRM_KMS_HELPER
+       select DRM_KUNIT_TEST_HELPERS if DRM_XE_KUNIT_TEST != n
        select DRM_PANEL
        select DRM_SUBALLOC_HELPER
        select DRM_DISPLAY_DP_HELPER
index 549065f57a78e63ffcf52bc01c1cf25ebae52120..df02e5d17d26fb9b16c69b8f4c4aef38de2387fa 100644 (file)
@@ -76,7 +76,6 @@ config DRM_XE_KUNIT_TEST
        depends on DRM_XE && KUNIT && DEBUG_FS
        default KUNIT_ALL_TESTS
        select DRM_EXPORT_FOR_TESTS if m
-       select DRM_KUNIT_TEST_HELPERS
        help
          Choose this option to allow the driver to perform selftests under
          the kunit framework
index c531210695db0a775320d33da59efbcbfcca1245..1a59c15f4d6661a04dd2accf98a14df7544a5fe0 100644 (file)
@@ -158,8 +158,10 @@ xe-$(CONFIG_PCI_IOV) += \
        xe_lmtt_2l.o \
        xe_lmtt_ml.o
 
-xe-$(CONFIG_DRM_XE_KUNIT_TEST) += \
-       tests/xe_kunit_helpers.o
+# include helpers for tests even when XE is built-in
+ifdef CONFIG_DRM_XE_KUNIT_TEST
+xe-y += tests/xe_kunit_helpers.o
+endif
 
 # i915 Display compat #defines and #includes
 subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \