Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp497715pxb; Thu, 25 Feb 2021 07:49:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyp8vQFz7UJDCqWvTzfFKleLru2EhN1qkmh5VLWNtLJYYAy3/507+X8/CZWwAej+nzcxrNB X-Received: by 2002:a05:6402:12c5:: with SMTP id k5mr3589871edx.291.1614268172589; Thu, 25 Feb 2021 07:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614268172; cv=none; d=google.com; s=arc-20160816; b=ageXxa0qI4C7X7kES8Ie/68tKwZ2NNQ58BHvFJb7mrh9HeoeA2ujgnkXEHX8cVQ9d7 ONin48iatzw6u2/kPpejHpk2DIHuovY0tGonHo2VOukCNOrku2iqWcw/d9+tH5PwzkTL yjbsbBVtWZQm9a/tjtY6b2hjlLWinNYhdaPtEEzYpQJY79XqgWtHsBTi4sbANzzOeZ96 CXHZ7GJEKX8rbEWBNWKMAm1llKWZRlj/YfRLRcWdtMiTWKPCLyBPkCwIo0TI12F4qI3S ffegVfwKmLyuN3quYvngX8rtdBYlzM8kKbTPk3OcB4PABC9kMmHfP1N97O96JbI3dV+j exwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=p1FuJXZMatJHyJTGkObaxlo1fAYr8nIDoteIQbCQluQ=; b=zrJr33kw0V53G7WbeFDly+z0hUYa3NMyj0riQ58kgiLENxpX3Th/i6oBPMOc/F7Gus rJQRdqy1MkO3pyM4gYWSwZuX5/HyanujqKv8ObnQN03OiTHzTgKEr3jyaOojP3WjieDf K0KsjYkcUHH6+8gOv+O4to4TDd3uSnC4718dXIwJOya+fZTxawJzU75ncQ5FG8OCjfIA CS2RpZwzxHwA0IAawE6jTDiMYLyKPlBb3Lip7m9i2+n9VD9P/tC3z6IgFbQntWn7Z089 XvB8eG4uyM3bdDS+WEb1d8ioUUeftdK8rVJ+q4GtdKmZzwO2IRRxsHbol++BxghLD247 azPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=CySFpdI+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o13si189517edi.135.2021.02.25.07.49.09; Thu, 25 Feb 2021 07:49:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=CySFpdI+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232711AbhBYPsO (ORCPT + 99 others); Thu, 25 Feb 2021 10:48:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233016AbhBYPrl (ORCPT ); Thu, 25 Feb 2021 10:47:41 -0500 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CEC5C061574 for ; Thu, 25 Feb 2021 07:47:00 -0800 (PST) Received: by mail-oi1-x230.google.com with SMTP id o3so6466922oic.8 for ; Thu, 25 Feb 2021 07:47:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=p1FuJXZMatJHyJTGkObaxlo1fAYr8nIDoteIQbCQluQ=; b=CySFpdI+Jsei8FbEThQbhvVfeq0NF3DKnmK4tWuxHtE64J8KA7qxG9/Kcz83gyVyY6 M0MP2JJCTD6SIdr0nI4j0bHUdPee8x/pGJJ+Ubsa2uPskvU7x7FxNbIjImla1Z2A5D6z Eix+yQWlA+5DvZVobTnKFrWjuwKxUJJWY5m34= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=p1FuJXZMatJHyJTGkObaxlo1fAYr8nIDoteIQbCQluQ=; b=g7cwI4J7YZ5honCsGxpClw2fgrvGtf8w36Bj7Jmwo/ssTMlkKXad49fNCNVoO2rgW4 KRgPHCfJk7BgoYG0BTF+53oYx1A2+ZjCSDVz4PCAO8SEkkrg39L998rKOvywfaKu4mGv edLVdVsN/P7iKxrOvVSbPkzASkOM1jwXaD/HxExqleB/MigFdI3yCw/MB7qn8rN/LYOX oWRHpn41Q8YY39cgZzhcyB52sjqGfHYtjcI9Nliy91hBpPfbHASaPoVWn5TobM7ri1Vz ac8d6cmsJqjTZZWV9qkyOHOaR8ybcBqJ3Gtcg0Krah+zFuIlgpjJC87t7vIDfCYA9YNv bAmw== X-Gm-Message-State: AOAM533cxg2HBS8hCiVfEWQAfYkm+D7BciCvtVB8Heut5nbFNFPBC3pF UulvbVF0+0XPPbdVoQcUVX28gmUba0kF8NUb0UYhuQ== X-Received: by 2002:a05:6808:4c9:: with SMTP id a9mr2303337oie.101.1614268019504; Thu, 25 Feb 2021 07:46:59 -0800 (PST) MIME-Version: 1.0 References: <20210225125301.1723047-1-arnd@kernel.org> <7c41b175-6da2-6801-43c2-c4038c08b228@amd.com> In-Reply-To: <7c41b175-6da2-6801-43c2-c4038c08b228@amd.com> From: Daniel Vetter Date: Thu, 25 Feb 2021 16:46:48 +0100 Message-ID: Subject: Re: [PATCH] drm/nouveau/pci: rework AGP dependency To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: Arnd Bergmann , Ben Skeggs , David Airlie , Arnd Bergmann , Lyude Paul , Thomas Zimmermann , dri-devel , Nouveau Dev , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 25, 2021 at 1:59 PM Christian K=C3=B6nig wrote: > > Am 25.02.21 um 13:52 schrieb Arnd Bergmann: > > 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=3Dm= . > > 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(-) > > > > diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/K= build > > index 60586fb8275e..173b8d9d85e3 100644 > > --- a/drivers/gpu/drm/nouveau/Kbuild > > +++ b/drivers/gpu/drm/nouveau/Kbuild > > @@ -15,6 +15,7 @@ nouveau-y :=3D $(nvif-y) > > #- code also used by various userspace tools/tests > > include $(src)/nvkm/Kbuild > > nouveau-y +=3D $(nvkm-y) > > +nouveau-m +=3D $(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 > > My first thought was WTF? But then I realized that this totally makes sen= se. depends on SYM || !SYM is essentially optional depends on SYM when SYM is a tri-state. I think there was even patches to kconfig to add something like that since it's such a common pattern. Might be neat to resurrect that for more clarity. -Daniel > We should probably have the same for radeon as well. > > Apart from that the patch is Acked-by: Christian K=C3=B6nig > > > > select IOMMU_API > > select FW_LOADER > > select DRM_KMS_HELPER > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild b/drivers/g= pu/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 +=3D nvkm/subdev/pci/agp.o > > +nvkm-$(CONFIG_AGP) +=3D nvkm/subdev/pci/agp.o > > nvkm-y +=3D nvkm/subdev/pci/base.o > > nvkm-y +=3D nvkm/subdev/pci/pcie.o > > nvkm-y +=3D nvkm/subdev/pci/nv04.o > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c b/drivers/gp= u/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 =3D 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/gp= u/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(MODU= LE)) > > #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 -ENOSY= S; } > > static inline void nvkm_agp_fini(struct nvkm_pci *pci) {} > > #endif > > + > > +#endif > --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch