From patchwork Thu Feb 25 12:52:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 387209 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp287421jap; Thu, 25 Feb 2021 04:53:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkXnugEU2oQ6OdhQ0YjaNx3LnM951X5dsWrvLr+JtDCZqp/IDKE1wRs7J4vPxZbJk2yesl X-Received: by 2002:a17:902:e750:b029:e3:a720:f4c with SMTP id p16-20020a170902e750b02900e3a7200f4cmr3062916plf.31.1614257589925; Thu, 25 Feb 2021 04:53:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614257589; cv=none; d=google.com; s=arc-20160816; b=JZ65FxzuN8RZbcue6Vlb79l4k0m9PF4xazOkT4dSSiP1JVuL3l4QYAQgRFGliDdut0 O1hjEgEHX4Bu9kIgL2ylGzX0uG3yF2864VO8kcHsu2fv7fESZdQzWZY2HYseEkPY+F68 /sl/9Ikyt1D22giLj1VeYGTyQPFfP1jliClXM1a2kN1UCoETXjic1U7qclvnfcStFHs8 GjxFIZcWQShG7uqZhScqHawmQf7HtgUspGWpKNqpVGYOKHXMAOlvf9gmfxAd1XE2RJcW rp0OexBOTmzh+hu5pNxnntHWQnOxFr3Tp7E8BIMpaa/+Xfsm6t6jS4VSz/StuQThQOp0 3bmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=Z8CGElqbYjfIXFrTjMcvaRbJGWxfRpxNZIu24tiAwdI=; b=c4POiuXmOIKCxSRoIKhbzBJxc5kwTJjKnfPXW88c2N4kVNC5LFkVDCabXbSaSRubr+ zV31KdpZmU8QFWyVNumN7aGzthiKViTu4TaaZV0sOhCmESPmOSggkqGWY3xzpeTj4qVI KnrrhqwDX4NGX/T8pGGM93tq+NYPxawFyOMyuZlwxVFFvvwsbUtgzePczDBo+vYO0Rcv Do11XwmOY7a5ikWJHHJqOuR5JBDaq4/g9lzAXHI6OQk+O+x8s6nuf7R/bPSyMG6zBSuT PEO3bDUHUNJ4AzSNWgjL8HCqqQY1EvT/TYGr90osVNglRn0MU9coWzvNKyqSW3hgBq8q n9OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=l5ZUYTfX; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id d9si5379499pga.420.2021.02.25.04.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Feb 2021 04:53:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=l5ZUYTfX; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03DFB6E10C; Thu, 25 Feb 2021 12:53:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0FE3F6E10C; Thu, 25 Feb 2021 12:53:08 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id DCA7864F11; Thu, 25 Feb 2021 12:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614257587; bh=QCiGi85fr9DFYHiTlbvSudt58MY7c/cO+LSTBCt1zIs=; h=From:To:Cc:Subject:Date:From; b=l5ZUYTfXS2EGUsILj+mBWQ0aXkivB0bbPsOsL5UM/Ww6tuslziEvuaXA2yUuSx1jQ UgVQImLsMcXJbunGtJMORCSt8Za/+7sapzbEiIjX7gFN2SavTPbIywYmwhL/1mgrQ+ Rk2SF7G2nNFaWYtLFv3JzxlPN85RY9SqfwRSNCkgn7UtzVrcoUZ0iAVpGtJji/fnYi mcCgtJYLJbyakXMm18B0clCZ9qQ02gg7pP0XYGiGysna5tzyrfAHTqJG/Gt4vgk3lq VkFWXWeJ9RJXdWkLUR+J1cBnMDUASUwaf3QfrLigFQqBJ5+/QPtfF/KWQZ6dU62i1s O8/odlO8exDcA== From: Arnd Bergmann To: Ben Skeggs , David Airlie , Daniel Vetter Subject: [PATCH] drm/nouveau/pci: rework AGP dependency Date: Thu, 25 Feb 2021 13:52:38 +0100 Message-Id: <20210225125301.1723047-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , =?utf-8?q?Christian_K=C3=B6n?= =?utf-8?q?ig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann I noticed a warning from 'nm' when CONFIG_TRIM_UNUSED_KSYMS is set and IS_REACHABLE(CONFIG_AGP) is false: drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.o: no symbols I later found this is completely harmless and we should find a way to suppress the warning, but at that point I had already done a cleanup patch to address this instance. It turns out this code could be improved anyway, as the current version behaves unexpectedly when AGP is a loadable module but nouveau is built-in itself, in which case it silently omits agp support. A better way to handle this is with a Kconfig dependency that requires AGP either to be disabled, or forces nouveau to be a module for AGP=m. With this change, the compile-time hack can be removed and lld no longer warns. Fixes: 340b0e7c500a ("drm/nouveau/pci: merge agp handling from nouveau drm") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/nouveau/Kbuild | 1 + drivers/gpu/drm/nouveau/Kconfig | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c | 2 -- drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h | 9 +++++---- 5 files changed, 8 insertions(+), 7 deletions(-) -- 2.29.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/Kbuild index 60586fb8275e..173b8d9d85e3 100644 --- a/drivers/gpu/drm/nouveau/Kbuild +++ b/drivers/gpu/drm/nouveau/Kbuild @@ -15,6 +15,7 @@ nouveau-y := $(nvif-y) #- code also used by various userspace tools/tests include $(src)/nvkm/Kbuild nouveau-y += $(nvkm-y) +nouveau-m += $(nvkm-m) # DRM - general ifdef CONFIG_X86 diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig index 278e048235a9..90276a557a70 100644 --- a/drivers/gpu/drm/nouveau/Kconfig +++ b/drivers/gpu/drm/nouveau/Kconfig @@ -2,6 +2,7 @@ config DRM_NOUVEAU tristate "Nouveau (NVIDIA) cards" depends on DRM && PCI && MMU + depends on AGP || !AGP select IOMMU_API select FW_LOADER select DRM_KMS_HELPER diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild index 174bdf995271..a400c680cf65 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild @@ -1,5 +1,5 @@ # SPDX-License-Identifier: MIT -nvkm-y += nvkm/subdev/pci/agp.o +nvkm-$(CONFIG_AGP) += nvkm/subdev/pci/agp.o nvkm-y += nvkm/subdev/pci/base.o nvkm-y += nvkm/subdev/pci/pcie.o nvkm-y += nvkm/subdev/pci/nv04.o diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c index 385a90f91ed6..86c9e1d658af 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c @@ -20,7 +20,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ #include "agp.h" -#ifdef __NVKM_PCI_AGP_H__ #include struct nvkm_device_agp_quirk { @@ -172,4 +171,3 @@ nvkm_agp_ctor(struct nvkm_pci *pci) pci->agp.mtrr = arch_phys_wc_add(pci->agp.base, pci->agp.size); } -#endif diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h index ad4d3621d02b..041fe1fbf093 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h @@ -1,15 +1,14 @@ -/* SPDX-License-Identifier: MIT */ -#include "priv.h" -#if defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)) #ifndef __NVKM_PCI_AGP_H__ #define __NVKM_PCI_AGP_H__ +/* SPDX-License-Identifier: MIT */ +#include "priv.h" +#if IS_ENABLED(CONFIG_AGP) void nvkm_agp_ctor(struct nvkm_pci *); void nvkm_agp_dtor(struct nvkm_pci *); void nvkm_agp_preinit(struct nvkm_pci *); int nvkm_agp_init(struct nvkm_pci *); void nvkm_agp_fini(struct nvkm_pci *); -#endif #else static inline void nvkm_agp_ctor(struct nvkm_pci *pci) {} static inline void nvkm_agp_dtor(struct nvkm_pci *pci) {} @@ -17,3 +16,5 @@ static inline void nvkm_agp_preinit(struct nvkm_pci *pci) {} static inline int nvkm_agp_init(struct nvkm_pci *pci) { return -ENOSYS; } static inline void nvkm_agp_fini(struct nvkm_pci *pci) {} #endif + +#endif