Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1266926rda; Mon, 23 Oct 2023 07:36:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8g30pgjKBKBsMwfkCVlLT6K6GG2WRZbPCjJRj1mA8un/QjEFV0yElWWPVV/lvSofQgbSJ X-Received: by 2002:a17:902:ce81:b0:1c6:2acc:62ea with SMTP id f1-20020a170902ce8100b001c62acc62eamr8308996plg.57.1698071765274; Mon, 23 Oct 2023 07:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698071765; cv=none; d=google.com; s=arc-20160816; b=rMDXxaJ/daW9rX+FsAPHS5k1uTZoXs8LOZow6+PFTnEGv1ccs2jG8ZWyOQCquanpoM v/48dxV4tQSO/MsQdCU4JXpEk7smisRagrSNy4PAZXXfy0VvNvYwZXYuMDK6+E/UxG2R 1SrenN8hB7e2Xjtzu34g86CfIkin+N9iKOpE3tUYiij3vAEODntrT75XS6UiKKV82pX3 WxbPNBWph+sWyjJ8ZKJ3WchoH8DDHg26QRQaJzlF5h6twcP7yLMxinQ+MLPS7QIj7K/0 l4HqYzKZdb2esIXfpSNOocRjUXWUgEHreBjS3Lt7V/90dkrc/1j6jIryF9ZtlsX5WHpG 1KtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=nsM6vmFqZvDPhoAELKcnQJ/kaRHfmIZhcPe+kcJ2ns4=; fh=9+lOjbe8wFBfzDlxwt4ogO85qC0pLjYodOSfOY5O5UA=; b=PAEFYrVtsEnKAaxErPrT2/KeWzse9vmG8fkFKOeM9QBSVCu8MdVHrtMFcRSt4I82qG KL8tvDI3+/+pWAvEcWFwN0kHyzQ+fSCQax47muFeTjejdXBlhCmB8Fn8IfuKmaDMMYTH vrrakmpvrlDMUooCh9xzfUCuIfXnSnmdmM5bxRETNKohw/4l/30skvWmRZqSOE2Tk2Zx Rc9vX+z+Pb0Fe84//VqrMeOAkvZSIWAxPF915iIDvorEUk4mG8fSOmdXG/5malvn0oIx XmTwuReVCepErWzioRDflZaB4Hk44oYRqYuNOBEmpIkNSAdiSjX+VCZULfo5u5gApbjM H8nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=bDa0bPl2; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Oy6KqXD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j1-20020a170902690100b001bbd0450af8si6340853plk.187.2023.10.23.07.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 07:36:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=bDa0bPl2; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Oy6KqXD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DC66080681C9; Mon, 23 Oct 2023 07:35:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233399AbjJWOfk (ORCPT + 99 others); Mon, 23 Oct 2023 10:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230356AbjJWOfi (ORCPT ); Mon, 23 Oct 2023 10:35:38 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4BC9C; Mon, 23 Oct 2023 07:35:36 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5250A5C0342; Mon, 23 Oct 2023 10:35:36 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 23 Oct 2023 10:35:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1698071736; x=1698158136; bh=ns M6vmFqZvDPhoAELKcnQJ/kaRHfmIZhcPe+kcJ2ns4=; b=bDa0bPl2rptPQ2B2mX hBCx7/WFE3vBEEl/RdbR8eWELpZDEDcC+ikBlJAK9ENjzi4i9XQ5h0Qb2vmmms3e Jo8u5xhzMzrj+UiR+cF6+mh7tk60R1Y5u1a2TxHOQ58bg6Ujd61vBhXkyLJKSChg t+kxvcSKUjzxZZTMvX4h+elL5E533OSMCuH4BzKn6uA6Y8OT04ddDdWDngACRbmM 6m+jJci7sxixb+CGDTJtQc4K/GqTtlF7cGENyHalQWb5YqngmLjwFN+xDe4mD5AU Z98UbJHCAM6TdDwpWxSOdoZ9AEGjmjbzFH6XCeAvKTuirZb7+/ewqk1gwpq5qQAT G1hA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698071736; x=1698158136; bh=nsM6vmFqZvDPh oAELKcnQJ/kaRHfmIZhcPe+kcJ2ns4=; b=Oy6KqXD88c9a7L5MEKkQt4ia34n1C kwYxJ5kZSjCZQpg9HUgH1njn/znEuQq7d4nEafu8QFKXQFCuHRDFZe5jUalYPz7q 8MbkzK2AQlEzT0XnwTsywxuw1rcg6B1dgqU6y/PU5J3ai/LnvIg1po+c4Rs2ZAjg zddR+BMLTWXWI5xOAAFMOlJ5+LgiZuvJaq8NUEN1r1npQ0LhbSU1/51mbuYQlAfr fQMMWOaLSdxhwrX8K+BVT37A75EY70Q2ZCyDJ9f97NdACDB5NpAglgxmTaUfURBE btDGwxXCkMPGxme58e9oQYEvqTqSeuM7XUzJuhtYkNC5S9V6LRkphJkGQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeeigdejiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtth gvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedtkeet ffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrh hnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 85399B60089; Mon, 23 Oct 2023 10:35:35 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1048-g9229b632c5-fm-20231019.001-g9229b632 MIME-Version: 1.0 Message-Id: <35d65efa-e87b-4cc5-9c1a-e95dd6bf8edb@app.fastmail.com> In-Reply-To: <20231023141955.GX3952@nvidia.com> References: <20231023115520.3530120-1-arnd@kernel.org> <20231023120418.GH691768@ziepe.ca> <20231023132305.GT3952@nvidia.com> <5d7cb04d-9e79-43b9-9dd2-7d7803c93f4f@app.fastmail.com> <20231023141955.GX3952@nvidia.com> Date: Mon, 23 Oct 2023 16:35:15 +0200 From: "Arnd Bergmann" To: "Jason Gunthorpe" Cc: "Joao Martins" , "Arnd Bergmann" , "Kevin Tian" , "Yishai Hadas" , "Shameerali Kolothum Thodi" , "Alex Williamson" , "Brett Creeley" , oushixiong , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] vfio: mlx5, pds: add IOMMU_SUPPORT dependency Content-Type: text/plain X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 07:35:53 -0700 (PDT) On Mon, Oct 23, 2023, at 16:19, Jason Gunthorpe wrote: > On Mon, Oct 23, 2023 at 04:02:11PM +0200, Arnd Bergmann wrote: >> On Mon, Oct 23, 2023, at 15:23, Jason Gunthorpe wrote: >> > >> > I think the right thing is to combine IOMMU_SUPPORT and IOMMU_API into >> > the same thing. >> >> I've had a closer look now and I think the way it is currently >> designed to be used makes some sense: IOMMU implementations almost >> universally depend on both a CPU architecture and CONFIG_IOMMU_SUPPORT, >> but select IOMMU_API. So if you enable IOMMU_SUPPORT on an >> architecture that has no IOMMU implementations, none of the drivers >> are visible and nothing happens. Similarly, almost all drivers >> using the IOMMU interface depend on IOMMU_API, so they can only >> be built if at least one IOMMU driver is configured. > > Maybe, but I don't think we need such micro-optimization. > > If someone selects 'enable IOMMU support' and doesn't turn on any > drivers then they should still get the core API. That is how a lot of > the kconfig stuff typically works in the kernel. Agreed, that would be fine as well, and I agree it is less confusing. A similar approach as in iommu is used in a couple of other subsystems (regmap, gpiolib, sound, mfd, phy, virtio) where each provider selects the subsystem as a library, but I'm not a huge fan of this either. It's usually just easier to not make fundamental changes like this. In this case, we can just use 'depends on' for one of the two symbols everywhere and use to control both the providers and consumers. > Similarly, if they don't select 'enable IOMMU support' then they > definitely shouldn't quitely get the core API turned on! ... >> diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig >> index 4a79704b164f7..2902b89a48f17 100644 >> --- a/drivers/gpu/drm/nouveau/Kconfig >> +++ b/drivers/gpu/drm/nouveau/Kconfig >> @@ -4,7 +4,7 @@ config DRM_NOUVEAU >> depends on DRM && PCI && MMU >> depends on (ACPI_VIDEO && ACPI_WMI && MXM_WMI) || !(ACPI && X86) >> depends on BACKLIGHT_CLASS_DEVICE >> - select IOMMU_API >> + depends on IOMMU_API >> select FW_LOADER >> select DRM_DISPLAY_DP_HELPER >> select DRM_DISPLAY_HDMI_HELPER > > Like here, nouveau should still be compilable even if no iommu driver > was selected, and it should compile on arches without iommu drivers at > all. Right, so with my draft patch, we can't build nouveau without having an IOMMU driver, which matches the original intention behind the Kconfig logic, while your suggestion would add the same dependency here but still allow it to be compile tested on target systems with no IOMMU. A minor downside of your approach is that you end up building drivers (without CONFIG_COMPILE_TEST) that currently exclude because we know they will never work. Arnd