Skip to contentSkip to conversation

drm/xe: xe with/without kunit

PATCH In review Lucas De Marchi 3 participants 7 messages Jun 27, 2025 – Jun 28, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover drm/xe: xe with/without kunit

For the second patch, original version is from
https://lore.kernel.org/intel-xe/[email protected]/

I took that and kept only the kunit part as mentioned there.

First patch fixes the bug reported when building with

	CONFIG_DRM_XE=y
	CONFIG_DRM_I915=y

---
Changes in v2:
- First patch should be good enough fix, so reword it accordingly
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Harry Austen (1):
drm/xe: Allow dropping kunit dependency as built-in

Lucas De Marchi (1):
drm/xe: Fix conflicting intel_pcode_* symbols

 drivers/gpu/drm/xe/Kconfig    | 3 ++-
 drivers/gpu/drm/xe/xe_pcode.c | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

base-commit: 98f015a92833e2d04fda89e1657a13d7290403e8
change-id: 20250626-xe-kunit-20c0199723b2

Lucas De Marchi

#1 lore raw

PATCH v2 1/2 drm/xe: Fix conflicting intel_pcode_* symbols

If CONFIG_DRM_XE_DISPLAY is set, the xe module can only be built as module to avoid duplicate symbols from i915. The interface for pcode was added without considering that, so the build breaks if both xe and i915 are built-in.

Since the intel_pcode_* functions should only be called from the display side (xe side should call the xe interface directly) and there's already a protection in Kconfig to avoid the problematic configuration, ifdef it out in case CONFIG_DRM_XE_DISPLAY is disabled.

Fixes d9465cc8ac2d ("drm/xe/pcode: add struct drm_device based interface")
---
 drivers/gpu/drm/xe/xe_pcode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_pcode.c +5 -1
index 87323ad0cbbb2..6a7ddb9005f99 100644
@@ -337,7 +337,9 @@ int xe_pcode_probe_early(struct xe_device *xe)
 }
 ALLOW_ERROR_INJECTION(xe_pcode_probe_early, ERRNO); /* See xe_pci_probe */
 
-/* Helpers with drm device */
+/* Helpers with drm device. These should only be called by the display side */
+#if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
+
 int intel_pcode_read(struct drm_device *drm, u32 mbox, u32 *val, u32 *val1)
 {
 	struct xe_device *xe = to_xe_device(drm);
@@ -362,3 +364,5 @@ int intel_pcode_request(struct drm_device *drm, u32 mbox, u32 request,
 
 	return xe_pcode_request(tile, mbox, request, reply_mask, reply, timeout_base_ms);
 }
+
+#endif
Signature · 1 line
2.49.0
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] drm/xe: Fix conflicting intel_pcode_* symbols

Quoted 10 lines · Lucas De Marchi

If CONFIG_DRM_XE_DISPLAY is set, the xe module can only be built as module to avoid duplicate symbols from i915. The interface for pcode was added without considering that, so the build breaks if both xe and i915 are built-in.

Since the intel_pcode_* functions should only be called from the display side (xe side should call the xe interface directly) and there's already a protection in Kconfig to avoid the problematic configuration, ifdef it out in case CONFIG_DRM_XE_DISPLAY is disabled.

Quoted 4 lines
Fixes d9465cc8ac2d ("drm/xe/pcode: add struct drm_device based interface")
Quoted 29 lines
---
 drivers/gpu/drm/xe/xe_pcode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_pcode.c +5 -1
index 87323ad0cbbb2..6a7ddb9005f99 100644
@@ -337,7 +337,9 @@ int xe_pcode_probe_early(struct xe_device *xe)
 }
 ALLOW_ERROR_INJECTION(xe_pcode_probe_early, ERRNO); /* See xe_pci_probe */
 
-/* Helpers with drm device */
+/* Helpers with drm device. These should only be called by the display side */
+#if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
+
 int intel_pcode_read(struct drm_device *drm, u32 mbox, u32 *val, u32 *val1)
 {
 	struct xe_device *xe = to_xe_device(drm);
@@ -362,3 +364,5 @@ int intel_pcode_request(struct drm_device *drm, u32 mbox, u32 request,
 
 	return xe_pcode_request(tile, mbox, request, reply_mask, reply, timeout_base_ms);
 }
+
+#endif
Signature · 2 lines
-- 
2.49.0
Reviewed-by Tested-by on v2 1/2
#3 lore raw

Re: [PATCH v2 1/2] drm/xe: Fix conflicting intel_pcode_* symbols

In reply to Lucas De Marchi
Quoted 10 lines · Lucas De Marchi

If CONFIG_DRM_XE_DISPLAY is set, the xe module can only be built as module to avoid duplicate symbols from i915. The interface for pcode was added without considering that, so the build breaks if both xe and i915 are built-in.

Since the intel_pcode_* functions should only be called from the display side (xe side should call the xe interface directly) and there's already a protection in Kconfig to avoid the problematic configuration, ifdef it out in case CONFIG_DRM_XE_DISPLAY is disabled.

Quoted 4 lines
Fixes d9465cc8ac2d ("drm/xe/pcode: add struct drm_device based interface")

Thanks.

Quoted 26 lines
---
 drivers/gpu/drm/xe/xe_pcode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_pcode.c +5 -1
index 87323ad0cbbb2..6a7ddb9005f99 100644
@@ -337,7 +337,9 @@ int xe_pcode_probe_early(struct xe_device *xe)
 }
 ALLOW_ERROR_INJECTION(xe_pcode_probe_early, ERRNO); /* See xe_pci_probe */
 
-/* Helpers with drm device */
+/* Helpers with drm device. These should only be called by the display side */
+#if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
+
 int intel_pcode_read(struct drm_device *drm, u32 mbox, u32 *val, u32 *val1)
 {
 	struct xe_device *xe = to_xe_device(drm);
@@ -362,3 +364,5 @@ int intel_pcode_request(struct drm_device *drm, u32 mbox, u32 request,
 
 	return xe_pcode_request(tile, mbox, request, reply_mask, reply, timeout_base_ms);
 }
+
+#endif
Signature · 1 line
~Randy
#4 lore raw

PATCH v2 2/2 drm/xe: Allow dropping kunit dependency as built-in

In reply to Lucas De Marchi

From: Harry Austen <[email protected]>

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.

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]>
Cc Maarten Lankhorst <[email protected]>
---
 drivers/gpu/drm/xe/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/Kconfig +2 -1
index 553c29e1030b1..827bc75b8b48f 100644
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_XE
 	tristate "Intel Xe2 Graphics"
-	depends on DRM && PCI && (m || (y && KUNIT=y))
+	depends on DRM && PCI
+	depends on KUNIT || !KUNIT
 	depends on INTEL_VSEC || !INTEL_VSEC
 	depends on X86_PLATFORM_DEVICES || !(X86 && ACPI)
 	select INTERVAL_TREE
Signature · 1 line
2.49.0
Acked-by Tested-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] drm/xe: Allow dropping kunit dependency as built-in

Quoted 6 lines · Lucas De Marchi

From: Harry Austen <[email protected]>

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
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]>
Cc Maarten Lankhorst <[email protected]>

Thanks.

Quoted 19 lines
---
 drivers/gpu/drm/xe/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/Kconfig +2 -1
index 553c29e1030b1..827bc75b8b48f 100644
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_XE
 	tristate "Intel Xe2 Graphics"
-	depends on DRM && PCI && (m || (y && KUNIT=y))
+	depends on DRM && PCI
+	depends on KUNIT || !KUNIT
 	depends on INTEL_VSEC || !INTEL_VSEC
 	depends on X86_PLATFORM_DEVICES || !(X86 && ACPI)
 	select INTERVAL_TREE
Signature · 1 line
~Randy
#6 lore raw
In reply to Lucas De Marchi
Quoted 19 lines · Lucas De Marchi

For the second patch, original version is from
https://lore.kernel.org/intel-xe/[email protected]/

I took that and kept only the kunit part as mentioned there.

First patch fixes the bug reported when building with

	CONFIG_DRM_XE=y
	CONFIG_DRM_I915=y

---
Changes in v2:
- First patch should be good enough fix, so reword it accordingly
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Harry Austen (1):
drm/xe: Allow dropping kunit dependency as built-in

Quoted 2 lines

Lucas De Marchi (1):
drm/xe: Fix conflicting intel_pcode_* symbols

Applied the first patch to drm-intel-next and the second to drm-xe-next.

Thanks
Lucas De Marchi

Quoted 10 lines

drivers/gpu/drm/xe/Kconfig | 3 ++-
drivers/gpu/drm/xe/xe_pcode.c | 6 +++++-

2 files changed, 7 insertions(+), 2 deletions(-)

base-commit: 98f015a92833e2d04fda89e1657a13d7290403e8
change-id: 20250626-xe-kunit-20c0199723b2

Lucas De Marchi