linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [v2] accel: fix CONFIG_DRM dependencies
@ 2023-01-27 22:14 Arnd Bergmann
  2023-01-30  9:41 ` Stanislaw Gruszka
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arnd Bergmann @ 2023-01-27 22:14 UTC (permalink / raw)
  To: Oded Gabbay, Dave Airlie, Melissa Wen, Jacek Lawrynowicz, Jeffrey Hugo
  Cc: Arnd Bergmann, Daniel Vetter, Greg Kroah-Hartman,
	Thomas Zimmermann, dri-devel, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

At the moment, accel drivers can be built-in even with CONFIG_DRM=m,
but this causes a link failure:

x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_dev_init':
ivpu_drv.c:(.text+0x1535): undefined reference to `drmm_kmalloc'
x86_64-linux-ld: ivpu_drv.c:(.text+0x1562): undefined reference to `drmm_kmalloc'
x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_remove':
ivpu_drv.c:(.text+0x1faa): undefined reference to `drm_dev_unregister'
x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_probe':
ivpu_drv.c:(.text+0x1fef): undefined reference to `__devm_drm_dev_alloc'

The problem is that DRM_ACCEL is a 'bool' symbol symbol, so driver that
only depend on DRM_ACCEL but not also on DRM do not see the restriction
to =m configs.

To ensure that each accel driver has an implied dependency on CONFIG_DRM,
enclose the entire Kconfig file in an if/endif check.

Fixes: 8bf4889762a8 ("drivers/accel: define kconfig and register a new major")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: rearrage the DRM dependency rather than requiring DRM to be built-in
---
 drivers/accel/Kconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/accel/Kconfig b/drivers/accel/Kconfig
index 834863902e16..c437206aa3f1 100644
--- a/drivers/accel/Kconfig
+++ b/drivers/accel/Kconfig
@@ -6,9 +6,10 @@
 # as, but not limited to, Machine-Learning and Deep-Learning acceleration
 # devices
 #
+if DRM
+
 menuconfig DRM_ACCEL
 	bool "Compute Acceleration Framework"
-	depends on DRM
 	help
 	  Framework for device drivers of compute acceleration devices, such
 	  as, but not limited to, Machine-Learning and Deep-Learning
@@ -25,3 +26,5 @@ menuconfig DRM_ACCEL
 
 source "drivers/accel/habanalabs/Kconfig"
 source "drivers/accel/ivpu/Kconfig"
+
+endif
-- 
2.39.0


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

* Re: [PATCH] [v2] accel: fix CONFIG_DRM dependencies
  2023-01-27 22:14 [PATCH] [v2] accel: fix CONFIG_DRM dependencies Arnd Bergmann
@ 2023-01-30  9:41 ` Stanislaw Gruszka
  2023-01-30 15:42 ` Jeffrey Hugo
  2023-01-31  8:53 ` Oded Gabbay
  2 siblings, 0 replies; 6+ messages in thread
From: Stanislaw Gruszka @ 2023-01-30  9:41 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Oded Gabbay, Dave Airlie, Melissa Wen, Jacek Lawrynowicz,
	Jeffrey Hugo, Arnd Bergmann, Daniel Vetter, linux-kernel,
	dri-devel, Thomas Zimmermann, Greg Kroah-Hartman

On Fri, Jan 27, 2023 at 11:14:55PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> At the moment, accel drivers can be built-in even with CONFIG_DRM=m,
> but this causes a link failure:
> 
> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_dev_init':
> ivpu_drv.c:(.text+0x1535): undefined reference to `drmm_kmalloc'
> x86_64-linux-ld: ivpu_drv.c:(.text+0x1562): undefined reference to `drmm_kmalloc'
> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_remove':
> ivpu_drv.c:(.text+0x1faa): undefined reference to `drm_dev_unregister'
> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_probe':
> ivpu_drv.c:(.text+0x1fef): undefined reference to `__devm_drm_dev_alloc'
> 
> The problem is that DRM_ACCEL is a 'bool' symbol symbol, so driver that
> only depend on DRM_ACCEL but not also on DRM do not see the restriction
> to =m configs.
> 
> To ensure that each accel driver has an implied dependency on CONFIG_DRM,
> enclose the entire Kconfig file in an if/endif check.
> 
> Fixes: 8bf4889762a8 ("drivers/accel: define kconfig and register a new major")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>

> ---
> v2: rearrage the DRM dependency rather than requiring DRM to be built-in
> ---
>  drivers/accel/Kconfig | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/accel/Kconfig b/drivers/accel/Kconfig
> index 834863902e16..c437206aa3f1 100644
> --- a/drivers/accel/Kconfig
> +++ b/drivers/accel/Kconfig
> @@ -6,9 +6,10 @@
>  # as, but not limited to, Machine-Learning and Deep-Learning acceleration
>  # devices
>  #
> +if DRM
> +
>  menuconfig DRM_ACCEL
>  	bool "Compute Acceleration Framework"
> -	depends on DRM
>  	help
>  	  Framework for device drivers of compute acceleration devices, such
>  	  as, but not limited to, Machine-Learning and Deep-Learning
> @@ -25,3 +26,5 @@ menuconfig DRM_ACCEL
>  
>  source "drivers/accel/habanalabs/Kconfig"
>  source "drivers/accel/ivpu/Kconfig"
> +
> +endif
> -- 
> 2.39.0
> 

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

* Re: [PATCH] [v2] accel: fix CONFIG_DRM dependencies
  2023-01-27 22:14 [PATCH] [v2] accel: fix CONFIG_DRM dependencies Arnd Bergmann
  2023-01-30  9:41 ` Stanislaw Gruszka
@ 2023-01-30 15:42 ` Jeffrey Hugo
  2023-01-31  8:53 ` Oded Gabbay
  2 siblings, 0 replies; 6+ messages in thread
From: Jeffrey Hugo @ 2023-01-30 15:42 UTC (permalink / raw)
  To: Arnd Bergmann, Oded Gabbay, Dave Airlie, Melissa Wen, Jacek Lawrynowicz
  Cc: Arnd Bergmann, Daniel Vetter, Greg Kroah-Hartman,
	Thomas Zimmermann, dri-devel, linux-kernel

On 1/27/2023 3:14 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> At the moment, accel drivers can be built-in even with CONFIG_DRM=m,
> but this causes a link failure:
> 
> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_dev_init':
> ivpu_drv.c:(.text+0x1535): undefined reference to `drmm_kmalloc'
> x86_64-linux-ld: ivpu_drv.c:(.text+0x1562): undefined reference to `drmm_kmalloc'
> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_remove':
> ivpu_drv.c:(.text+0x1faa): undefined reference to `drm_dev_unregister'
> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_probe':
> ivpu_drv.c:(.text+0x1fef): undefined reference to `__devm_drm_dev_alloc'
> 
> The problem is that DRM_ACCEL is a 'bool' symbol symbol, so driver that
> only depend on DRM_ACCEL but not also on DRM do not see the restriction
> to =m configs.
> 
> To ensure that each accel driver has an implied dependency on CONFIG_DRM,
> enclose the entire Kconfig file in an if/endif check.
> 
> Fixes: 8bf4889762a8 ("drivers/accel: define kconfig and register a new major")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>

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

* Re: [PATCH] [v2] accel: fix CONFIG_DRM dependencies
  2023-01-27 22:14 [PATCH] [v2] accel: fix CONFIG_DRM dependencies Arnd Bergmann
  2023-01-30  9:41 ` Stanislaw Gruszka
  2023-01-30 15:42 ` Jeffrey Hugo
@ 2023-01-31  8:53 ` Oded Gabbay
  2023-01-31  9:20   ` Jacek Lawrynowicz
  2 siblings, 1 reply; 6+ messages in thread
From: Oded Gabbay @ 2023-01-31  8:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Dave Airlie, Melissa Wen, Jacek Lawrynowicz, Jeffrey Hugo,
	Arnd Bergmann, Daniel Vetter, Greg Kroah-Hartman,
	Thomas Zimmermann, dri-devel, linux-kernel

On Sat, Jan 28, 2023 at 12:15 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> At the moment, accel drivers can be built-in even with CONFIG_DRM=m,
> but this causes a link failure:
>
> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_dev_init':
> ivpu_drv.c:(.text+0x1535): undefined reference to `drmm_kmalloc'
> x86_64-linux-ld: ivpu_drv.c:(.text+0x1562): undefined reference to `drmm_kmalloc'
> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_remove':
> ivpu_drv.c:(.text+0x1faa): undefined reference to `drm_dev_unregister'
> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_probe':
> ivpu_drv.c:(.text+0x1fef): undefined reference to `__devm_drm_dev_alloc'
>
> The problem is that DRM_ACCEL is a 'bool' symbol symbol, so driver that
> only depend on DRM_ACCEL but not also on DRM do not see the restriction
> to =m configs.
>
> To ensure that each accel driver has an implied dependency on CONFIG_DRM,
> enclose the entire Kconfig file in an if/endif check.
>
> Fixes: 8bf4889762a8 ("drivers/accel: define kconfig and register a new major")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: rearrage the DRM dependency rather than requiring DRM to be built-in
> ---
>  drivers/accel/Kconfig | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/accel/Kconfig b/drivers/accel/Kconfig
> index 834863902e16..c437206aa3f1 100644
> --- a/drivers/accel/Kconfig
> +++ b/drivers/accel/Kconfig
> @@ -6,9 +6,10 @@
>  # as, but not limited to, Machine-Learning and Deep-Learning acceleration
>  # devices
>  #
> +if DRM
> +
>  menuconfig DRM_ACCEL
>         bool "Compute Acceleration Framework"
> -       depends on DRM
>         help
>           Framework for device drivers of compute acceleration devices, such
>           as, but not limited to, Machine-Learning and Deep-Learning
> @@ -25,3 +26,5 @@ menuconfig DRM_ACCEL
>
>  source "drivers/accel/habanalabs/Kconfig"
>  source "drivers/accel/ivpu/Kconfig"
> +
> +endif
> --
> 2.39.0
>
This patch is:
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>

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

* Re: [PATCH] [v2] accel: fix CONFIG_DRM dependencies
  2023-01-31  8:53 ` Oded Gabbay
@ 2023-01-31  9:20   ` Jacek Lawrynowicz
  2023-02-01 10:36     ` Thomas Zimmermann
  0 siblings, 1 reply; 6+ messages in thread
From: Jacek Lawrynowicz @ 2023-01-31  9:20 UTC (permalink / raw)
  To: Oded Gabbay, Arnd Bergmann
  Cc: Jeffrey Hugo, Arnd Bergmann, Daniel Vetter, linux-kernel,
	dri-devel, Melissa Wen, Thomas Zimmermann, Greg Kroah-Hartman,
	Dave Airlie

On 31.01.2023 09:53, Oded Gabbay wrote:
> On Sat, Jan 28, 2023 at 12:15 AM Arnd Bergmann <arnd@kernel.org> wrote:
>>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> At the moment, accel drivers can be built-in even with CONFIG_DRM=m,
>> but this causes a link failure:
>>
>> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_dev_init':
>> ivpu_drv.c:(.text+0x1535): undefined reference to `drmm_kmalloc'
>> x86_64-linux-ld: ivpu_drv.c:(.text+0x1562): undefined reference to `drmm_kmalloc'
>> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_remove':
>> ivpu_drv.c:(.text+0x1faa): undefined reference to `drm_dev_unregister'
>> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_probe':
>> ivpu_drv.c:(.text+0x1fef): undefined reference to `__devm_drm_dev_alloc'
>>
>> The problem is that DRM_ACCEL is a 'bool' symbol symbol, so driver that
>> only depend on DRM_ACCEL but not also on DRM do not see the restriction
>> to =m configs.
>>
>> To ensure that each accel driver has an implied dependency on CONFIG_DRM,
>> enclose the entire Kconfig file in an if/endif check.
>>
>> Fixes: 8bf4889762a8 ("drivers/accel: define kconfig and register a new major")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> v2: rearrage the DRM dependency rather than requiring DRM to be built-in
>> ---
>>  drivers/accel/Kconfig | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/accel/Kconfig b/drivers/accel/Kconfig
>> index 834863902e16..c437206aa3f1 100644
>> --- a/drivers/accel/Kconfig
>> +++ b/drivers/accel/Kconfig
>> @@ -6,9 +6,10 @@
>>  # as, but not limited to, Machine-Learning and Deep-Learning acceleration
>>  # devices
>>  #
>> +if DRM
>> +
>>  menuconfig DRM_ACCEL
>>         bool "Compute Acceleration Framework"
>> -       depends on DRM
>>         help
>>           Framework for device drivers of compute acceleration devices, such
>>           as, but not limited to, Machine-Learning and Deep-Learning
>> @@ -25,3 +26,5 @@ menuconfig DRM_ACCEL
>>
>>  source "drivers/accel/habanalabs/Kconfig"
>>  source "drivers/accel/ivpu/Kconfig"
>> +
>> +endif
>> --
>> 2.39.0
>>
> This patch is:
> Reviewed-by: Oded Gabbay <ogabbay@kernel.org>

Applied to drm-misc-next.
Thanks.

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

* Re: [PATCH] [v2] accel: fix CONFIG_DRM dependencies
  2023-01-31  9:20   ` Jacek Lawrynowicz
@ 2023-02-01 10:36     ` Thomas Zimmermann
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2023-02-01 10:36 UTC (permalink / raw)
  To: Jacek Lawrynowicz, Oded Gabbay, Arnd Bergmann
  Cc: Jeffrey Hugo, Arnd Bergmann, Daniel Vetter, linux-kernel,
	dri-devel, Melissa Wen, Greg Kroah-Hartman, Dave Airlie


[-- Attachment #1.1: Type: text/plain, Size: 2704 bytes --]



Am 31.01.23 um 10:20 schrieb Jacek Lawrynowicz:
> On 31.01.2023 09:53, Oded Gabbay wrote:
>> On Sat, Jan 28, 2023 at 12:15 AM Arnd Bergmann <arnd@kernel.org> wrote:
>>>
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> At the moment, accel drivers can be built-in even with CONFIG_DRM=m,
>>> but this causes a link failure:
>>>
>>> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_dev_init':
>>> ivpu_drv.c:(.text+0x1535): undefined reference to `drmm_kmalloc'
>>> x86_64-linux-ld: ivpu_drv.c:(.text+0x1562): undefined reference to `drmm_kmalloc'
>>> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_remove':
>>> ivpu_drv.c:(.text+0x1faa): undefined reference to `drm_dev_unregister'
>>> x86_64-linux-ld: drivers/accel/ivpu/ivpu_drv.o: in function `ivpu_probe':
>>> ivpu_drv.c:(.text+0x1fef): undefined reference to `__devm_drm_dev_alloc'
>>>
>>> The problem is that DRM_ACCEL is a 'bool' symbol symbol, so driver that
>>> only depend on DRM_ACCEL but not also on DRM do not see the restriction
>>> to =m configs.
>>>
>>> To ensure that each accel driver has an implied dependency on CONFIG_DRM,
>>> enclose the entire Kconfig file in an if/endif check.
>>>
>>> Fixes: 8bf4889762a8 ("drivers/accel: define kconfig and register a new major")
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> ---
>>> v2: rearrage the DRM dependency rather than requiring DRM to be built-in
>>> ---
>>>   drivers/accel/Kconfig | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/accel/Kconfig b/drivers/accel/Kconfig
>>> index 834863902e16..c437206aa3f1 100644
>>> --- a/drivers/accel/Kconfig
>>> +++ b/drivers/accel/Kconfig
>>> @@ -6,9 +6,10 @@
>>>   # as, but not limited to, Machine-Learning and Deep-Learning acceleration
>>>   # devices
>>>   #
>>> +if DRM
>>> +
>>>   menuconfig DRM_ACCEL
>>>          bool "Compute Acceleration Framework"
>>> -       depends on DRM
>>>          help
>>>            Framework for device drivers of compute acceleration devices, such
>>>            as, but not limited to, Machine-Learning and Deep-Learning
>>> @@ -25,3 +26,5 @@ menuconfig DRM_ACCEL
>>>
>>>   source "drivers/accel/habanalabs/Kconfig"
>>>   source "drivers/accel/ivpu/Kconfig"
>>> +
>>> +endif
>>> --
>>> 2.39.0
>>>
>> This patch is:
>> Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
> 
> Applied to drm-misc-next.

I have cherry-picked the patch into drm-misc-next-fixes.

> Thanks.

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

end of thread, other threads:[~2023-02-01 10:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 22:14 [PATCH] [v2] accel: fix CONFIG_DRM dependencies Arnd Bergmann
2023-01-30  9:41 ` Stanislaw Gruszka
2023-01-30 15:42 ` Jeffrey Hugo
2023-01-31  8:53 ` Oded Gabbay
2023-01-31  9:20   ` Jacek Lawrynowicz
2023-02-01 10:36     ` Thomas Zimmermann

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).