Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5928090pxb; Mon, 14 Feb 2022 10:55:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEgEGSRH12S0nBgxUwEpiVk0Ol5E64Cu8LoWME8cD3Dh0giSflHlwlENil12eTNv+qvl4R X-Received: by 2002:a17:90a:9f91:b0:1b9:e916:25da with SMTP id o17-20020a17090a9f9100b001b9e91625damr44333pjp.208.1644864917460; Mon, 14 Feb 2022 10:55:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644864917; cv=none; d=google.com; s=arc-20160816; b=PJoWn6H+/EAhyyo0Wg2liHG2KHDCyq7cC5gP0QI7rSLIwgcHL3JdGAT66lnCKQIuXT 7pnylICO/hOPKAhmgfsb99FXOzKlI7oMBQMvMDNd2osc5geVlcsPK2AqTcCTkWKL88AP ZSWiZvvSvqZiEWfa6D9zSTtcD/+QJUyW7MYGsNgOpW+HXe3umjKC7UEH0vpnhxn6QUnc klzO7+F2VK5Z95sKuYLQoIjJcMM8cQQG2axlXe6xdRS3dzaJOc9CfnwlkWiC/+3wrPVu dGJatgvv2tkIhtRKCcGMo/Y+WLQtnAyJWYvlmVYDXo9xY+uGtt6SL58z6li2dq6AT91E kNgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ZWW86suhUkg+7Ri+vRokKJDopvOrpc34H/QrXxi8Wsw=; b=kuJNJBK+IZhmyPXOvUT45SY9B10yFgxdqLQfI90a/9mwJIQrqFuBEUtujD9Z4cV14r KW1OZ7kfQnXxVd5byo/HPK1zUPT4gNbFa7O6L7s/Tlavsdl9+12fkJKpUMfalZWXuJ5P AOzZK+Cf2TwoKJlxlsEB/f6zZnzUqRo7e1jWFTAuw8K1r8Oyyq91qXq+IOxJJRYZ8iKF ZpU2XLQsh14tn7u0jfZf0rs+trqtXJwD+dDIC7MISyeeKgsLdCkraz0PXTarUFgsnO6x JcRfEMS9VO0Z2MeEBSPaZNf7QTCXgRaY7FQ9qsIOMweCACli+u2QUE6ehOpexHP4LunV xKVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o2si11902557plg.158.2022.02.14.10.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 10:55:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 897B8A94DA; Mon, 14 Feb 2022 10:54:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355737AbiBNPSt (ORCPT + 99 others); Mon, 14 Feb 2022 10:18:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbiBNPSr (ORCPT ); Mon, 14 Feb 2022 10:18:47 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 77C40593BC; Mon, 14 Feb 2022 07:18:39 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2E72F1063; Mon, 14 Feb 2022 07:18:39 -0800 (PST) Received: from [10.57.70.89] (unknown [10.57.70.89]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 972823F70D; Mon, 14 Feb 2022 07:18:35 -0800 (PST) Message-ID: <08e90a61-8491-acf1-ab0f-f93f97366d24@arm.com> Date: Mon, 14 Feb 2022 15:18:31 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v1 3/8] iommu: Extend iommu_at[de]tach_device() for multi-device groups Content-Language: en-GB To: Joerg Roedel , Jason Gunthorpe Cc: Stuart Yoder , rafael@kernel.org, David Airlie , linux-pci@vger.kernel.org, Thierry Reding , Diana Craciun , Dmitry Osipenko , Will Deacon , Ashok Raj , Jonathan Hunter , Christoph Hellwig , Kevin Tian , Chaitanya Kulkarni , Alex Williamson , kvm@vger.kernel.org, Bjorn Helgaas , Dan Williams , Greg Kroah-Hartman , Cornelia Huck , linux-kernel@vger.kernel.org, Li Yang , iommu@lists.linux-foundation.org, Jacob jun Pan , Daniel Vetter References: <20220106022053.2406748-1-baolu.lu@linux.intel.com> <20220106022053.2406748-4-baolu.lu@linux.intel.com> <20220214130313.GV4160@nvidia.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-02-14 14:39, Joerg Roedel wrote: > On Mon, Feb 14, 2022 at 09:03:13AM -0400, Jason Gunthorpe wrote: >> Groups should disappear into an internal implementation detail, not be >> so prominent in the API. > > Not going to happen, IOMMU groups are ABI and todays device assignment > code, including user-space, relies on them. > > Groups implement and important aspect of hardware IOMMUs that the API > can not abstract away: That there are devices which share the same > request-id. > > This is not an issue for devices concerned by iommufd, but for legacy > device assignment it is. The IOMMU-API needs to handle both in a clean > API, even if it means that drivers need to lookup the sub-group of a > device first. > > And I don't see how a per-device API can handle both in a device-centric > way. For sure it is not making it 'device centric but operate on groups > under the hood'. Arguably, iommu_attach_device() could be renamed something like iommu_attach_group_for_dev(), since that's effectively the semantic that all the existing API users want anyway (even VFIO at the high level - the group is the means for the user to assign their GPU/NIC/whatever device to their process, not the end in itself). That's just a lot more churn. It's not that callers should be blind to the entire concept of groups altogether - they remain a significant reason why iommu_attach_device() might fail, for one thing - however what callers really shouldn't need to be bothered with is the exact *implementation* of groups. I do actually quite like the idea of refining the group abstraction into isolation groups as a superset of alias groups, but if anything that's a further argument for not having the guts of the current abstraction exposed in places that don't need to care - otherwise that would be liable to be a microcosm of this series in itself: widespread churn vs. "same name, new meaning" compromises. Robin.