* [PATCH] accel: work around DRM_ACCEL dependencies
@ 2023-01-27 9:36 Arnd Bergmann
2023-01-27 10:17 ` Stanislaw Gruszka
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2023-01-27 9:36 UTC (permalink / raw)
To: Oded Gabbay, Jeffrey Hugo, Jacek Lawrynowicz, Dave Airlie,
Thomas Zimmermann, Melissa Wen
Cc: Arnd Bergmann, Daniel Vetter, 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'
This could be avoided by making DRM_ACCEL a tristate symbol, which
would mean that every ACCEL driver is guarantee to be able to link
against DRM as well. However, having both as =m causes another link
failure because the DRM core code also links against the accel driver:
x86_64-linux-ld: drivers/gpu/drm/drm_drv.o: in function `drm_minor_register':
drm_drv.c:(.text+0x259): undefined reference to `accel_debugfs_init'
x86_64-linux-ld: drm_drv.c:(.text+0x298): undefined reference to `accel_minor_replace'
I think it will be necessary to establish a link hierarchy between drm.ko
and drm_accel.ko to avoid circular dependencies like this, but until then
the only way that both can be used is to have both subsystems built into
the kernel. Enforce this using a Kconfig dependency.
Fixes: 8bf4889762a8 ("drivers/accel: define kconfig and register a new major")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/accel/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/Kconfig b/drivers/accel/Kconfig
index 834863902e16..dd18d3b2028c 100644
--- a/drivers/accel/Kconfig
+++ b/drivers/accel/Kconfig
@@ -8,7 +8,7 @@
#
menuconfig DRM_ACCEL
bool "Compute Acceleration Framework"
- depends on DRM
+ depends on DRM=y
help
Framework for device drivers of compute acceleration devices, such
as, but not limited to, Machine-Learning and Deep-Learning
--
2.39.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] accel: work around DRM_ACCEL dependencies
2023-01-27 9:36 [PATCH] accel: work around DRM_ACCEL dependencies Arnd Bergmann
@ 2023-01-27 10:17 ` Stanislaw Gruszka
2023-01-27 10:22 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Stanislaw Gruszka @ 2023-01-27 10:17 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Oded Gabbay, Jeffrey Hugo, Jacek Lawrynowicz, Dave Airlie,
Thomas Zimmermann, Melissa Wen, Daniel Vetter, dri-devel,
Arnd Bergmann, linux-kernel
Hi
On Fri, Jan 27, 2023 at 10:36:20AM +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'
Ehh, this should not happen.
> This could be avoided by making DRM_ACCEL a tristate symbol, which
> would mean that every ACCEL driver is guarantee to be able to link
> against DRM as well. However, having both as =m causes another link
> failure because the DRM core code also links against the accel driver:
>
> x86_64-linux-ld: drivers/gpu/drm/drm_drv.o: in function `drm_minor_register':
> drm_drv.c:(.text+0x259): undefined reference to `accel_debugfs_init'
> x86_64-linux-ld: drm_drv.c:(.text+0x298): undefined reference to `accel_minor_replace'
>
> I think it will be necessary to establish a link hierarchy between drm.ko
> and drm_accel.ko to avoid circular dependencies like this, but until then
> the only way that both can be used is to have both subsystems built into
> the kernel. Enforce this using a Kconfig dependency.
Hmm, it was discussed a bit before and conclusion was that accel will be
compiled in drm.ko to avoid circular dependencies. There should be
no drm_accel.ko module.
> Fixes: 8bf4889762a8 ("drivers/accel: define kconfig and register a new major")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/accel/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/accel/Kconfig b/drivers/accel/Kconfig
> index 834863902e16..dd18d3b2028c 100644
> --- a/drivers/accel/Kconfig
> +++ b/drivers/accel/Kconfig
> @@ -8,7 +8,7 @@
> #
> menuconfig DRM_ACCEL
> bool "Compute Acceleration Framework"
> - depends on DRM
> + depends on DRM=y
Would making ivpu Kconfig:
depends on DRM
select DRM_ACCEL
solve the problem and still allow to drm to be build as module ?
Regards
Stanislaw
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] accel: work around DRM_ACCEL dependencies
2023-01-27 10:17 ` Stanislaw Gruszka
@ 2023-01-27 10:22 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2023-01-27 10:22 UTC (permalink / raw)
To: Stanislaw Gruszka, Arnd Bergmann
Cc: Oded Gabbay, Jeffrey Hugo, Jacek Lawrynowicz, Dave Airlie,
Thomas Zimmermann, Melissa Wen, Daniel Vetter, dri-devel,
linux-kernel
On Fri, Jan 27, 2023, at 11:17, Stanislaw Gruszka wrote:
> On Fri, Jan 27, 2023 at 10:36:20AM +0100, Arnd Bergmann wrote:
>> I think it will be necessary to establish a link hierarchy between drm.ko
>> and drm_accel.ko to avoid circular dependencies like this, but until then
>> the only way that both can be used is to have both subsystems built into
>> the kernel. Enforce this using a Kconfig dependency.
>
> Hmm, it was discussed a bit before and conclusion was that accel will be
> compiled in drm.ko to avoid circular dependencies. There should be
> no drm_accel.ko module.
Ok, got it. This does not sounds like a great solution as it ties
the two modules closer together than most users want, but it should
work as long as we control the dependencies for the individual drivers.
>> diff --git a/drivers/accel/Kconfig b/drivers/accel/Kconfig
>> index 834863902e16..dd18d3b2028c 100644
>> --- a/drivers/accel/Kconfig
>> +++ b/drivers/accel/Kconfig
>> @@ -8,7 +8,7 @@
>> #
>> menuconfig DRM_ACCEL
>> bool "Compute Acceleration Framework"
>> - depends on DRM
>> + depends on DRM=y
>
> Would making ivpu Kconfig:
>
> depends on DRM
> select DRM_ACCEL
>
> solve the problem and still allow to drm to be build as module ?
Right, that should work, I'll send a v2 patch to add an "if DRM"
around the entire drivers/accel/Kconfig file, which should have the
effect.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-27 10:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-27 9:36 [PATCH] accel: work around DRM_ACCEL dependencies Arnd Bergmann
2023-01-27 10:17 ` Stanislaw Gruszka
2023-01-27 10:22 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox