Skip to contentSkip to conversation

accel: fix CONFIG_DRM dependencies

PATCH Applied Arnd Bergmann 6 participants 6 messages Jan 27, 2023 – Feb 1, 2023 DRM compute accelerators drivers and framework

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 accel: fix CONFIG_DRM dependencies

From: Arnd Bergmann <[email protected]>

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

---
v2: rearrage the DRM dependency rather than requiring DRM to be built-in

---
 drivers/accel/Kconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/accel/Kconfig +4 -1
index 834863902e16..c437206aa3f1 100644
@@ -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
Signature · 1 line
2.39.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 17 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

Quoted 5 lines

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")
Quoted 31 lines

---
v2: rearrage the DRM dependency rather than requiring DRM to be built-in

---
 drivers/accel/Kconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/accel/Kconfig +4 -1
index 834863902e16..c437206aa3f1 100644
@@ -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
Signature · 1 line
2.39.0
Reviewed-by on v2 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 17 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

Quoted 5 lines

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")
maintainer Reviewed-by on v2 1/1
#3 lore raw
In reply to Arnd Bergmann
Quoted 52 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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

---
v2: rearrage the DRM dependency rather than requiring DRM to be built-in

---
 drivers/accel/Kconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/accel/Kconfig +4 -2
index 834863902e16..c437206aa3f1 100644
@@ -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
--
Quoted 2 lines

2.39.0

This patch is:

#4 lore raw
Quoted 56 lines · Oded Gabbay
Quoted 52 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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

---
v2: rearrage the DRM dependency rather than requiring DRM to be built-in

---
 drivers/accel/Kconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/accel/Kconfig +4 -2
index 834863902e16..c437206aa3f1 100644
@@ -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
--
Quoted 2 lines

2.39.0

This patch is:

Quoted 1 line

Applied to drm-misc-next.
Thanks.

#5 lore raw

Am 31.01.23 um 10:20 schrieb Jacek Lawrynowicz:

Quoted 59 lines · Oded Gabbay
Quoted 56 lines · Arnd Bergmann
Quoted 52 lines

From: Arnd Bergmann <[email protected]>

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

---
v2: rearrage the DRM dependency rather than requiring DRM to be built-in

---
  drivers/accel/Kconfig | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/accel/Kconfig +4 -2
index 834863902e16..c437206aa3f1 100644
@@ -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
--
Quoted 2 lines

2.39.0

This patch is:

Quoted 1 line
Quoted 1 line

Applied to drm-misc-next.

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

Quoted 1 line

Thanks.

Signature · 6 lines
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