dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency
@ 2025-05-23 12:10 Arnd Bergmann
  2025-05-27 20:55 ` Lucas De Marchi
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2025-05-23 12:10 UTC (permalink / raw)
  To: Lucas De Marchi, Thomas Hellström, Rodrigo Vivi
  Cc: Arnd Bergmann, David Airlie, Simona Vetter, Matthew Brost,
	Himal Prasad Ghimiray, Imre Deak, Ilpo Järvinen,
	Michael J. Ruhl, Andy Shevchenko, intel-xe, dri-devel,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The XE driver can be built with or without VSEC support, but fails to link as
built-in if vsec is in a loadable module:

x86_64-linux-ld: vmlinux.o: in function `xe_vsec_init':
(.text+0x1e83e16): undefined reference to `intel_vsec_register'

The normal fix for this is to add a 'depends on INTEL_VSEC || !INTEL_VSEC',
forcing XE to be a loadable module as well, but that causes a circular
dependency:

        symbol DRM_XE depends on INTEL_VSEC
        symbol INTEL_VSEC depends on X86_PLATFORM_DEVICES
        symbol X86_PLATFORM_DEVICES is selected by DRM_XE

The problem here is selecting a symbol from another subsystem, so change
that as well and rephrase the 'select' into the corresponding dependency.
Since X86_PLATFORM_DEVICES is 'default y', there is no change to
defconfig builds here.

Fixes: 0c45e76fcc62 ("drm/xe/vsec: Support BMG devices")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/xe/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
index beddd153c28c..c870b680431c 100644
--- a/drivers/gpu/drm/xe/Kconfig
+++ b/drivers/gpu/drm/xe/Kconfig
@@ -2,6 +2,8 @@
 config DRM_XE
 	tristate "Intel Xe Graphics"
 	depends on DRM && PCI && (m || (y && KUNIT=y))
+	depends on INTEL_VSEC || !INTEL_VSEC
+	depends on INTEL_PLATFORM_DEVICES || !(X86 && ACPI)
 	select INTERVAL_TREE
 	# we need shmfs for the swappable backing store, and in particular
 	# the shmem_readpage() which depends upon tmpfs
@@ -29,7 +31,6 @@ config DRM_XE
 	select INPUT if ACPI
 	select ACPI_VIDEO if X86 && ACPI
 	select ACPI_BUTTON if ACPI
-	select X86_PLATFORM_DEVICES if X86 && ACPI
 	select ACPI_WMI if X86 && ACPI
 	select SYNC_FILE
 	select IOSF_MBI
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency
  2025-05-23 12:10 [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency Arnd Bergmann
@ 2025-05-27 20:55 ` Lucas De Marchi
  2025-05-28  9:34   ` Andy Shevchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Lucas De Marchi @ 2025-05-27 20:55 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Thomas Hellström, Rodrigo Vivi, Arnd Bergmann, David Airlie,
	Simona Vetter, Matthew Brost, Himal Prasad Ghimiray, Imre Deak,
	Ilpo Järvinen, Michael J. Ruhl, Andy Shevchenko, intel-xe,
	dri-devel, linux-kernel

On Fri, May 23, 2025 at 02:10:46PM +0200, Arnd Bergmann wrote:
>From: Arnd Bergmann <arnd@arndb.de>
>
>The XE driver can be built with or without VSEC support, but fails to link as
>built-in if vsec is in a loadable module:
>
>x86_64-linux-ld: vmlinux.o: in function `xe_vsec_init':
>(.text+0x1e83e16): undefined reference to `intel_vsec_register'
>
>The normal fix for this is to add a 'depends on INTEL_VSEC || !INTEL_VSEC',
>forcing XE to be a loadable module as well, but that causes a circular
>dependency:
>
>        symbol DRM_XE depends on INTEL_VSEC
>        symbol INTEL_VSEC depends on X86_PLATFORM_DEVICES
>        symbol X86_PLATFORM_DEVICES is selected by DRM_XE
>
>The problem here is selecting a symbol from another subsystem, so change
>that as well and rephrase the 'select' into the corresponding dependency.
>Since X86_PLATFORM_DEVICES is 'default y', there is no change to
>defconfig builds here.
>
>Fixes: 0c45e76fcc62 ("drm/xe/vsec: Support BMG devices")
>Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>---
> drivers/gpu/drm/xe/Kconfig | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
>index beddd153c28c..c870b680431c 100644
>--- a/drivers/gpu/drm/xe/Kconfig
>+++ b/drivers/gpu/drm/xe/Kconfig
>@@ -2,6 +2,8 @@
> config DRM_XE
> 	tristate "Intel Xe Graphics"
> 	depends on DRM && PCI && (m || (y && KUNIT=y))
>+	depends on INTEL_VSEC || !INTEL_VSEC
>+	depends on INTEL_PLATFORM_DEVICES || !(X86 && ACPI)

		   ^
Did you mean X86_PLATFORM_DEVICES here?

With that, Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>

I see several drivers selecting
X86_PLATFORM_DEVICES though. Maybe they should also be translated to
dependencies instead?

$ git grep "select X86_PLATFORM_DEVICES"       
drivers/gpu/drm/amd/amdgpu/Kconfig:     select X86_PLATFORM_DEVICES if ACPI && X86
drivers/gpu/drm/gma500/Kconfig: select X86_PLATFORM_DEVICES if ACPI               
drivers/gpu/drm/i915/Kconfig:   select X86_PLATFORM_DEVICES if ACPI               
drivers/gpu/drm/nouveau/Kconfig:        select X86_PLATFORM_DEVICES if ACPI && X86
drivers/gpu/drm/radeon/Kconfig: select X86_PLATFORM_DEVICES if ACPI && X86        

thanks
Lucas De Marchi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency
  2025-05-27 20:55 ` Lucas De Marchi
@ 2025-05-28  9:34   ` Andy Shevchenko
  2025-05-28 10:03     ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2025-05-28  9:34 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Arnd Bergmann, Thomas Hellström, Rodrigo Vivi, Arnd Bergmann,
	David Airlie, Simona Vetter, Matthew Brost, Himal Prasad Ghimiray,
	Imre Deak, Ilpo Järvinen, Michael J. Ruhl, intel-xe,
	dri-devel, linux-kernel

On Tue, May 27, 2025 at 03:55:46PM -0500, Lucas De Marchi wrote:
> On Fri, May 23, 2025 at 02:10:46PM +0200, Arnd Bergmann wrote:

...

> > +	depends on INTEL_PLATFORM_DEVICES || !(X86 && ACPI)
> 
> 		   ^
> Did you mean X86_PLATFORM_DEVICES here?

Why do we need to depend on the whole thingy (yes, it will be enabled at the
end) if we only talking about Intel?

> With that, Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
> 
> I see several drivers selecting
> X86_PLATFORM_DEVICES though. Maybe they should also be translated to
> dependencies instead?

I think so, selecting that sounds wrong.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency
  2025-05-28  9:34   ` Andy Shevchenko
@ 2025-05-28 10:03     ` Arnd Bergmann
  2025-05-28 10:16       ` Andy Shevchenko
  2025-05-28 10:17       ` Christopher Snowhill
  0 siblings, 2 replies; 8+ messages in thread
From: Arnd Bergmann @ 2025-05-28 10:03 UTC (permalink / raw)
  To: Andy Shevchenko, Lucas De Marchi
  Cc: Arnd Bergmann, Thomas Hellström, Rodrigo Vivi, Dave Airlie,
	Simona Vetter, Matthew Brost, Himal Prasad Ghimiray, Imre Deak,
	Ilpo Järvinen, Michael J. Ruhl, intel-xe, dri-devel,
	linux-kernel

On Wed, May 28, 2025, at 11:34, Andy Shevchenko wrote:
> On Tue, May 27, 2025 at 03:55:46PM -0500, Lucas De Marchi wrote:
>> On Fri, May 23, 2025 at 02:10:46PM +0200, Arnd Bergmann wrote:
>
> ...
>
>> > +	depends on INTEL_PLATFORM_DEVICES || !(X86 && ACPI)
>> 
>> 		   ^
>> Did you mean X86_PLATFORM_DEVICES here?

Yes, my mistake.

> Why do we need to depend on the whole thingy (yes, it will be enabled at the
> end) if we only talking about Intel?

I don't understand what you mean with 'the whole thing'. My change
changed the existing 'select X86_PLATFORM_DEVICES if X86 && ACPI'
into the corresponding dependency, in order to change it the
least.

The dependency itself is needed because of

       select ACPI_WMI if X86 && ACPI

and this in turn is needed for

       select ACPI_VIDEO if X86 && ACPI

>> With that, Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> 
>> I see several drivers selecting
>> X86_PLATFORM_DEVICES though. Maybe they should also be translated to
>> dependencies instead?
>
> I think so, selecting that sounds wrong.

Agreed. Overall, what I'd really like to see is to remove
all those 'select' of drivers from other subsystems. I think
ACPI_VIDEO is at the center here, and changing all the
'select ACPI_VIDEO if ACPI' instances to
'depends on ACPI_VIDEO || !ACPI_VIDEO' would solve a lot of
the recurring dependency loop problems in drivers/gpu/.

Actually doing it without regressions is going to be
nontrivial though, because any change in this area is likely
to trigger another dependency loop somewhere.

     Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency
  2025-05-28 10:03     ` Arnd Bergmann
@ 2025-05-28 10:16       ` Andy Shevchenko
  2025-05-28 10:17       ` Christopher Snowhill
  1 sibling, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-05-28 10:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Lucas De Marchi, Arnd Bergmann, Thomas Hellström,
	Rodrigo Vivi, Dave Airlie, Simona Vetter, Matthew Brost,
	Himal Prasad Ghimiray, Imre Deak, Ilpo Järvinen,
	Michael J. Ruhl, intel-xe, dri-devel, linux-kernel

On Wed, May 28, 2025 at 12:03:43PM +0200, Arnd Bergmann wrote:
> On Wed, May 28, 2025, at 11:34, Andy Shevchenko wrote:
> > On Tue, May 27, 2025 at 03:55:46PM -0500, Lucas De Marchi wrote:
> >> On Fri, May 23, 2025 at 02:10:46PM +0200, Arnd Bergmann wrote:
> >
> > ...
> >
> >> > +	depends on INTEL_PLATFORM_DEVICES || !(X86 && ACPI)
> >> 
> >> 		   ^
> >> Did you mean X86_PLATFORM_DEVICES here?
> 
> Yes, my mistake.
> 
> > Why do we need to depend on the whole thingy (yes, it will be enabled at the
> > end) if we only talking about Intel?
> 
> I don't understand what you mean with 'the whole thing'. My change
> changed the existing 'select X86_PLATFORM_DEVICES if X86 && ACPI'
> into the corresponding dependency, in order to change it the
> least.

It used to be (for only one or two releases) X86_PLATFORM_DRIVERS_INTEL, but it
doesn't look closer to the mistake above, which I was thinking of. So, Lucas is
right.

> The dependency itself is needed because of
> 
>        select ACPI_WMI if X86 && ACPI
> 
> and this in turn is needed for
> 
>        select ACPI_VIDEO if X86 && ACPI
> 
> >> With that, Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
> >> 
> >> I see several drivers selecting
> >> X86_PLATFORM_DEVICES though. Maybe they should also be translated to
> >> dependencies instead?
> >
> > I think so, selecting that sounds wrong.
> 
> Agreed. Overall, what I'd really like to see is to remove
> all those 'select' of drivers from other subsystems.

Let's start from some low-hanging fruits?

> I think
> ACPI_VIDEO is at the center here, and changing all the
> 'select ACPI_VIDEO if ACPI' instances to
> 'depends on ACPI_VIDEO || !ACPI_VIDEO' would solve a lot of
> the recurring dependency loop problems in drivers/gpu/.
> 
> Actually doing it without regressions is going to be
> nontrivial though, because any change in this area is likely
> to trigger another dependency loop somewhere.

True and I agree this requires more comprehensive testing.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency
  2025-05-28 10:03     ` Arnd Bergmann
  2025-05-28 10:16       ` Andy Shevchenko
@ 2025-05-28 10:17       ` Christopher Snowhill
  2025-05-28 10:31         ` Andy Shevchenko
  1 sibling, 1 reply; 8+ messages in thread
From: Christopher Snowhill @ 2025-05-28 10:17 UTC (permalink / raw)
  To: Arnd Bergmann, Andy Shevchenko, Lucas De Marchi
  Cc: Arnd Bergmann, Thomas Hellström, Rodrigo Vivi, Dave Airlie,
	Simona Vetter, Matthew Brost, Himal Prasad Ghimiray, Imre Deak,
	Ilpo Järvinen, Michael J. Ruhl, intel-xe, dri-devel,
	linux-kernel, dri-devel

On Wed May 28, 2025 at 3:03 AM PDT, Arnd Bergmann wrote:
> On Wed, May 28, 2025, at 11:34, Andy Shevchenko wrote:
>> On Tue, May 27, 2025 at 03:55:46PM -0500, Lucas De Marchi wrote:
>>> On Fri, May 23, 2025 at 02:10:46PM +0200, Arnd Bergmann wrote:
>>
>> ...
>>
>>> > +	depends on INTEL_PLATFORM_DEVICES || !(X86 && ACPI)
>>> 
>>> 		   ^
>>> Did you mean X86_PLATFORM_DEVICES here?
>
> Yes, my mistake.
>
>> Why do we need to depend on the whole thingy (yes, it will be enabled at the
>> end) if we only talking about Intel?
>
> I don't understand what you mean with 'the whole thing'. My change
> changed the existing 'select X86_PLATFORM_DEVICES if X86 && ACPI'
> into the corresponding dependency, in order to change it the
> least.
>
> The dependency itself is needed because of
>
>        select ACPI_WMI if X86 && ACPI
>
> and this in turn is needed for
>
>        select ACPI_VIDEO if X86 && ACPI
>
>>> With that, Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
>>> 
>>> I see several drivers selecting
>>> X86_PLATFORM_DEVICES though. Maybe they should also be translated to
>>> dependencies instead?
>>
>> I think so, selecting that sounds wrong.
>
> Agreed. Overall, what I'd really like to see is to remove
> all those 'select' of drivers from other subsystems. I think
> ACPI_VIDEO is at the center here, and changing all the
> 'select ACPI_VIDEO if ACPI' instances to
> 'depends on ACPI_VIDEO || !ACPI_VIDEO' would solve a lot of

Maybe you meant 'depends on ACPI_VIDEO || !ACPI' ?

> the recurring dependency loop problems in drivers/gpu/.
>
> Actually doing it without regressions is going to be
> nontrivial though, because any change in this area is likely
> to trigger another dependency loop somewhere.
>
>      Arnd


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency
  2025-05-28 10:17       ` Christopher Snowhill
@ 2025-05-28 10:31         ` Andy Shevchenko
  2025-05-28 11:27           ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2025-05-28 10:31 UTC (permalink / raw)
  To: Christopher Snowhill
  Cc: Arnd Bergmann, Lucas De Marchi, Arnd Bergmann,
	Thomas Hellström, Rodrigo Vivi, Dave Airlie, Simona Vetter,
	Matthew Brost, Himal Prasad Ghimiray, Imre Deak,
	Ilpo Järvinen, Michael J. Ruhl, intel-xe, dri-devel,
	linux-kernel, dri-devel

On Wed, May 28, 2025 at 03:17:03AM -0700, Christopher Snowhill wrote:
> On Wed May 28, 2025 at 3:03 AM PDT, Arnd Bergmann wrote:
> > On Wed, May 28, 2025, at 11:34, Andy Shevchenko wrote:
> >> On Tue, May 27, 2025 at 03:55:46PM -0500, Lucas De Marchi wrote:
> >>> On Fri, May 23, 2025 at 02:10:46PM +0200, Arnd Bergmann wrote:

...

> > I think ACPI_VIDEO is at the center here, and changing all the
> > 'select ACPI_VIDEO if ACPI' instances to
> > 'depends on ACPI_VIDEO || !ACPI_VIDEO' would solve a lot of
> 
> Maybe you meant 'depends on ACPI_VIDEO || !ACPI' ?

I believe not. The depends on FOO || FOO=n is idiomatic in Kconfig.

> > the recurring dependency loop problems in drivers/gpu/.
> >
> > Actually doing it without regressions is going to be
> > nontrivial though, because any change in this area is likely
> > to trigger another dependency loop somewhere.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency
  2025-05-28 10:31         ` Andy Shevchenko
@ 2025-05-28 11:27           ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2025-05-28 11:27 UTC (permalink / raw)
  To: Andy Shevchenko, Christopher Snowhill
  Cc: Lucas De Marchi, Arnd Bergmann, Thomas Hellström,
	Rodrigo Vivi, Dave Airlie, Simona Vetter, Matthew Brost,
	Himal Prasad Ghimiray, Imre Deak, Ilpo Järvinen,
	Michael J. Ruhl, intel-xe, dri-devel, linux-kernel, dri-devel

On Wed, May 28, 2025, at 12:31, Andy Shevchenko wrote:
> On Wed, May 28, 2025 at 03:17:03AM -0700, Christopher Snowhill wrote:
>> On Wed May 28, 2025 at 3:03 AM PDT, Arnd Bergmann wrote:
>> > On Wed, May 28, 2025, at 11:34, Andy Shevchenko wrote:
>> >> On Tue, May 27, 2025 at 03:55:46PM -0500, Lucas De Marchi wrote:
>> > I think ACPI_VIDEO is at the center here, and changing all the
>> > 'select ACPI_VIDEO if ACPI' instances to
>> > 'depends on ACPI_VIDEO || !ACPI_VIDEO' would solve a lot of
>> 
>> Maybe you meant 'depends on ACPI_VIDEO || !ACPI' ?
>
> I believe not. The depends on FOO || FOO=n is idiomatic in Kconfig.

It depends on what we want here. 'ACPI_VIDEO || !ACPI' would
be the direct equivalent of the existing 'select ACPI_VIDEO if ACPI',
while 'ACPI_VIDEO || !ACPI_VIDEO' would allow building with
ACPI=y and ACPI_VIDEO=n, which is not possible today. I'd probably
start with the version that Christopher suggested to have a lower
regression risk.

     Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-05-28 11:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 12:10 [PATCH] drm/xe/vsec: fix CONFIG_INTEL_VSEC dependency Arnd Bergmann
2025-05-27 20:55 ` Lucas De Marchi
2025-05-28  9:34   ` Andy Shevchenko
2025-05-28 10:03     ` Arnd Bergmann
2025-05-28 10:16       ` Andy Shevchenko
2025-05-28 10:17       ` Christopher Snowhill
2025-05-28 10:31         ` Andy Shevchenko
2025-05-28 11:27           ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).