Message ID | 20230127221504.2522909-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1071847wrn; Fri, 27 Jan 2023 14:21:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXvZD2La7K9PZy67U7s5aJeGkKPWNdB8KrDoc+h0JqI88FH1hkjcqsRM8sLlKRy/PDrGzMpH X-Received: by 2002:a05:6402:1008:b0:47a:e008:8662 with SMTP id c8-20020a056402100800b0047ae0088662mr40403875edu.34.1674858097272; Fri, 27 Jan 2023 14:21:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674858097; cv=none; d=google.com; s=arc-20160816; b=oOgP1tnXAcdTd4xBCeGVeS9tdmwe3sry3MhVmBsw9Gmub7UMoM3VzElt5CzloaCJpj y7jmg8naUlkJ0EqWu57j8IL0WKXYjTWKc+YBMhfz5XJoHpPGY3ifcCtBhHJCTA6B3VtN mGtIkWK/3pR6F58PDscIwy7W0Be3Q+BgCpVsJq0ZWKMj/lbVyScOXdKSXqj7DxwC2eeO GqIQSNqxCcMvdJjEf9tD0CennPwsfHZilTMtVp6TysZ5rNZw0F0B4SF8YYHWN1zHApVd kRMgKp2dj+Qx21l41W87TyytRXUk+MYvVB/ZcVaMTuwnmVDESwcvJo1mxWQu1suVZKbA EgRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=k8MVOFncBSj8GRr1doV230blDMwMWTiiZTZv6k3ny2U=; b=ktGubxy8j+bKSj845OvYaxdOvlEr+YlHF5noY+xPP4EGWOMlVGVU+PgYoC9qiZFYUr lMAhXU0jNrzacr/ThJUvq3UVlzRSPatFw5xKsVkh7d1+fWfCcNJCi1z29HsK8iKE30YW przhDy0Me2sKvQtIKlJiYOkwIvvIxDTa6sL7F4CFwl+tBGLP6YtgJMEs9OONlkOKDGsT xDks40sgvKNRShzZI1PvM2laXLPKTG2dLs/7FaNWwFbC5//Rnaxc7UxDpvRKv1LfvvdV 9YQPQMpHGl7bYVAFIXtvk7bsP2lOj32DloP1ezB+qOQUDnRKCUhc3ScbmE8PrYBpi7Sp dc2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FcoP7OuX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020aa7d289000000b004a2121f5253si2258521edq.387.2023.01.27.14.21.13; Fri, 27 Jan 2023 14:21:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FcoP7OuX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232709AbjA0WPN (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Fri, 27 Jan 2023 17:15:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbjA0WPM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 27 Jan 2023 17:15:12 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 191ED84FBC for <linux-kernel@vger.kernel.org>; Fri, 27 Jan 2023 14:15:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B9F0CB8214D for <linux-kernel@vger.kernel.org>; Fri, 27 Jan 2023 22:15:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 065FBC433D2; Fri, 27 Jan 2023 22:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674857708; bh=tYeVWVDqmrYCQ68BomdAu9i6GwFXBSSVooD9s632kl0=; h=From:To:Cc:Subject:Date:From; b=FcoP7OuX+aYmdJQtza1BnQZJTENkfGj2s/ORLK/+cRjT/Psyfu1W8AV4ydF3eNhC4 XXCAoj8GK47nhBs3IU+aL/uffgBty8u8nFWRAk4NG0CJ056LuvVKgN8ZBR+DwVcWMc 8F+CCJhb/Xt5iPcAdxyiydjRrWCjaAdwfMN/jUNq8C1ssKDlUQCcxeYdZCrmWk0xlf zQj+nwBibCyeGIE3dc8O80I5MHFObt+w58qik5L5HMH0sajKK3BcP3YJYioNhqMi2E cgGK+g2XhMMQPQ38zdz5a4NPM1OrVk5kQqCHUUJ+vQlBJf2xZkMWoAns3sWxacbMqu 9s56ZSw5PuR5w== From: Arnd Bergmann <arnd@kernel.org> To: Oded Gabbay <ogabbay@kernel.org>, Dave Airlie <airlied@redhat.com>, Melissa Wen <mwen@igalia.com>, Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>, Jeffrey Hugo <quic_jhugo@quicinc.com> Cc: Arnd Bergmann <arnd@arndb.de>, Daniel Vetter <daniel.vetter@ffwll.ch>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] accel: fix CONFIG_DRM dependencies Date: Fri, 27 Jan 2023 23:14:55 +0100 Message-Id: <20230127221504.2522909-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756216004408713033?= X-GMAIL-MSGID: =?utf-8?q?1756216004408713033?= |
Series |
[v2] accel: fix CONFIG_DRM dependencies
|
|
Commit Message
Arnd Bergmann
Jan. 27, 2023, 10:14 p.m. UTC
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(-)
Comments
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 >
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>
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>
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.
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
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