[PATCH v2] drm/xe: Allow building as kernel built-in

Harry Austen posted 1 patch 9 months, 2 weeks ago
There is a newer version of this series
drivers/gpu/drm/xe/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH v2] drm/xe: Allow building as kernel built-in
Posted by Harry Austen 9 months, 2 weeks ago
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 <lucas.demarchi@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Harry Austen <hpausten@protonmail.com>
---
v2: Ensure DRM_XE_DISPLAY and DRM_I915 can't both be built-in

 drivers/gpu/drm/xe/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
index 9bce047901b22..bc63c396d7fef 100644
--- a/drivers/gpu/drm/xe/Kconfig
+++ b/drivers/gpu/drm/xe/Kconfig
@@ -1,7 +1,7 @@
 # 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 && (m || (y && KUNIT!=m))
 	select INTERVAL_TREE
 	# we need shmfs for the swappable backing store, and in particular
 	# the shmem_readpage() which depends upon tmpfs
@@ -51,7 +51,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
-- 
2.49.0
Re: [PATCH v2] drm/xe: Allow building as kernel built-in
Posted by Jani Nikula 9 months, 2 weeks ago
On Fri, 25 Apr 2025, Harry Austen <hpausten@protonmail.com> wrote:
> 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 <lucas.demarchi@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Harry Austen <hpausten@protonmail.com>
> ---
> v2: Ensure DRM_XE_DISPLAY and DRM_I915 can't both be built-in
>
>  drivers/gpu/drm/xe/Kconfig | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
> index 9bce047901b22..bc63c396d7fef 100644
> --- a/drivers/gpu/drm/xe/Kconfig
> +++ b/drivers/gpu/drm/xe/Kconfig
> @@ -1,7 +1,7 @@
>  # 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 && (m || (y && KUNIT!=m))

I can't make heads or tails about that. I think expressing the kunit
dependency on a separate line like this is both much more common and
clear:

	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 +51,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

-- 
Jani Nikula, Intel
Re: [PATCH v2] drm/xe: Allow building as kernel built-in
Posted by Harry Austen 9 months, 2 weeks ago
On Fri Apr 25, 2025 at 8:59 AM BST, Jani Nikula wrote:
> On Fri, 25 Apr 2025, Harry Austen <hpausten@protonmail.com> wrote:
>> 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 <lucas.demarchi@intel.com>
>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> Signed-off-by: Harry Austen <hpausten@protonmail.com>
>> ---
>> v2: Ensure DRM_XE_DISPLAY and DRM_I915 can't both be built-in
>>
>>  drivers/gpu/drm/xe/Kconfig | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
>> index 9bce047901b22..bc63c396d7fef 100644
>> --- a/drivers/gpu/drm/xe/Kconfig
>> +++ b/drivers/gpu/drm/xe/Kconfig
>> @@ -1,7 +1,7 @@
>>  # 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 && (m || (y && KUNIT!=m))
>
> I can't make heads or tails about that. I think expressing the kunit
> dependency on a separate line like this is both much more common and
> clear:
>
> 	depends on KUNIT || KUNIT=n

Ah, yes that looks like it should do the trick and does seem clearer. Will do in
v3.

>
>>  	select INTERVAL_TREE
>>  	# we need shmfs for the swappable backing store, and in particular
>>  	# the shmem_readpage() which depends upon tmpfs
>> @@ -51,7 +51,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
>
> --
> Jani Nikula, Intel

Thanks,
Harry