mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Oded Gabbay <ogabbay@kernel.org>,
	Jeffrey Hugo <quic_jhugo@quicinc.com>,
	Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>,
	Dave Airlie <airlied@redhat.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Melissa Wen <mwen@igalia.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] accel: work around DRM_ACCEL dependencies
Date: Fri, 27 Jan 2023 10:36:20 +0100	[thread overview]
Message-ID: <20230127093631.2132187-1-arnd@kernel.org> (raw)

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


             reply	other threads:[~2023-01-27  9:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27  9:36 Arnd Bergmann [this message]
2023-01-27 10:17 ` Stanislaw Gruszka
2023-01-27 10:22   ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230127093631.2132187-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=airlied@redhat.com \
    --cc=arnd@arndb.de \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacek.lawrynowicz@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mwen@igalia.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®