drm/xe: Fix build with KUNIT=m
authorLucas De Marchi <lucas.demarchi@intel.com>
Thu, 9 Nov 2023 17:51:32 +0000 (09:51 -0800)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:43:38 +0000 (11:43 -0500)
Due to the current integration between "live" xe kunit tests and kunit,
it's not possible to have a build with the following combination:

CONFIG_DRM_XE=y
CONFIG_KUNIT=m

... even if kconfig doesn't block it. The reason for the failure is that
some compilation units are pulled in xe.ko:

drivers/gpu/drm/xe/xe_bo.c:#include "tests/xe_bo.c"
drivers/gpu/drm/xe/xe_dma_buf.c:#include "tests/xe_dma_buf.c"
drivers/gpu/drm/xe/xe_migrate.c:#include "tests/xe_migrate.c"
drivers/gpu/drm/xe/xe_pci.c:#include "tests/xe_pci.c"

Those files shouldn't use symbols from kunit, which should be reserved
to the tests/*_test.c files. Detangling this dependency doesn't seem
very straightforward, so fix the immediate issue instructing kconfig to
block the problematic configuration.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20231109175132.3084142-3-lucas.demarchi@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/Kconfig

index cfa6420b9915a2f1ae383b72f3cdf326b5fb550a..46325c64ff22647a60c6b799ca105ceb72c94803 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_XE
        tristate "Intel Xe Graphics"
-       depends on DRM && PCI && MMU
+       depends on DRM && PCI && MMU && (m || (y && KUNIT=y))
        select INTERVAL_TREE
        # we need shmfs for the swappable backing store, and in particular
        # the shmem_readpage() which depends upon tmpfs