Skip to contentSkip to conversation

drm/xe: Allow building as kernel built-in

PATCH Superseded Harry Austen 3 participants 4 messages Apr 25, 2025 – Apr 30, 2025

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drm/xe: Allow building as kernel built-in

Fix Kconfig symbol dependency on KUNIT, which isn't actually required for XE to be built-in. However, if KUNIT is enabled, it must be built-in too.

Also, allow DRM_XE_DISPLAY to be built-in. But only as long as DRM_I915 isn't, since that results in duplicate symbol errors.

Fixes 08987a8b6820 ("drm/xe: Fix build with KUNIT=m")
Cc Lucas De Marchi <[email protected]>
Cc Thomas Hellström <[email protected]>
Cc Jani Nikula <[email protected]>

---
v3: Simplify KUNIT dependency, as suggested by Jani Nikula
v2: Ensure DRM_XE_DISPLAY and DRM_I915 can't both be built-in

 drivers/gpu/drm/xe/Kconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/Kconfig +3 -2
index 9bce047901b22..214f40264fa12 100644
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_XE
 	tristate "Intel Xe Graphics"
-	depends on DRM && PCI && MMU && (m || (y && KUNIT=y))
+	depends on DRM && PCI && MMU
+	depends on KUNIT || KUNIT=n
 	select INTERVAL_TREE
 	# we need shmfs for the swappable backing store, and in particular
 	# the shmem_readpage() which depends upon tmpfs
@@ -51,7 +52,7 @@ config DRM_XE
 
 config DRM_XE_DISPLAY
 	bool "Enable display support"
-	depends on DRM_XE && DRM_XE=m && HAS_IOPORT
+	depends on DRM_XE && (DRM_XE=m || DRM_I915!=y) && HAS_IOPORT
 	select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
 	select I2C
 	select I2C_ALGOBIT
Signature · 1 line
2.49.0
Acked-by on v3 1/1
#1 lore raw
Quoted 4 lines · Harry Austen

Fix Kconfig symbol dependency on KUNIT, which isn't actually required for XE to be built-in. However, if KUNIT is enabled, it must be built-in too.

Quoted 8 lines

Also, allow DRM_XE_DISPLAY to be built-in. But only as long as DRM_I915 isn't, since that results in duplicate symbol errors.

Fixes 08987a8b6820 ("drm/xe: Fix build with KUNIT=m")
Cc Lucas De Marchi <[email protected]>
Cc Thomas Hellström <[email protected]>
Cc Jani Nikula <[email protected]>

I didn't test this, but it makes sense to me.

Quoted 30 lines

---
v3: Simplify KUNIT dependency, as suggested by Jani Nikula
v2: Ensure DRM_XE_DISPLAY and DRM_I915 can't both be built-in

 drivers/gpu/drm/xe/Kconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/Kconfig +3 -2
index 9bce047901b22..214f40264fa12 100644
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_XE
 	tristate "Intel Xe Graphics"
-	depends on DRM && PCI && MMU && (m || (y && KUNIT=y))
+	depends on DRM && PCI && MMU
+	depends on KUNIT || KUNIT=n
 	select INTERVAL_TREE
 	# we need shmfs for the swappable backing store, and in particular
 	# the shmem_readpage() which depends upon tmpfs
@@ -51,7 +52,7 @@ config DRM_XE
 
 config DRM_XE_DISPLAY
 	bool "Enable display support"
-	depends on DRM_XE && DRM_XE=m && HAS_IOPORT
+	depends on DRM_XE && (DRM_XE=m || DRM_I915!=y) && HAS_IOPORT
 	select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
 	select I2C
 	select I2C_ALGOBIT
Signature · 1 line
Jani Nikula, Intel
#2 lore raw
Quoted 14 lines · Jani Nikula
Quoted 4 lines · Harry Austen

Fix Kconfig symbol dependency on KUNIT, which isn't actually required for XE to be built-in. However, if KUNIT is enabled, it must be built-in too.

Quoted 8 lines

Also, allow DRM_XE_DISPLAY to be built-in. But only as long as DRM_I915 isn't, since that results in duplicate symbol errors.

Fixes 08987a8b6820 ("drm/xe: Fix build with KUNIT=m")
Cc Lucas De Marchi <[email protected]>
Cc Thomas Hellström <[email protected]>
Cc Jani Nikula <[email protected]>
Quoted 3 lines

I didn't test this, but it makes sense to me.

humn... but the end result is very odd: from my current config with DRM_XE=m, DRM_XE_DISPLAY=y, DRM_I915=m. I then select DRM_I915=y and it (silently) set DRM_XE_DISPLAY=n. So this would now be forbidden with no warning:

	CONFIG_DRM_I915=y
	CONFIG_DRM_XE=m
	CONFIG_DRM_XE_DISPLAY=y

Considering some distros have DRM_I915 as builtin, I don't think that is a good outcome: it would basically block using display in xe and a "make olddefconfig" would break. I think we really need to start spliting the module and move the conflicting symbols.

Lucas De Marchi

#3 lore raw
Quoted 2 lines · Lucas De Marchi

I think we really need to start spliting the module and move the conflicting symbols.

Start? I've been working on it for more than a year now.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel