Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2083460pxy; Mon, 2 Aug 2021 19:02:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznQVf7SNrWDpSTYFoBPfn+r6hbGSOAARx+jvYwiIKDF+73Zq1tHYGi9phA6bEuy5UDVAIB X-Received: by 2002:a92:d5cf:: with SMTP id d15mr845488ilq.194.1627956120730; Mon, 02 Aug 2021 19:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627956120; cv=none; d=google.com; s=arc-20160816; b=Ui2m6PrySmHWAzjRzQk8NtRZFC9RG9Q2UociWfcZqLbC2W3o4LWy5NAf+wcCbBj79T WikrdqkAWqIPuLf34SvnZarAl+hoQ60j9eMnJcrsK8h6x6NY4j5I5j4/lXBvtxeYtiYr 60AsrzstHMBFOu+XzLVrMm55f9i9cH5N/dS8AsYsKrw/LUqY1Lj0luuW5rPHx8EHY4j0 SweC+afEsUWgY0oPF5EV61+iTjR7Mob7cei2R2auuQlz9GQzVYOp7EXyPTGFcVNfhnXS 4Vr8Gr0byz8EB1yTfgdNuFGeaVK/JKrXwYmYhDY+HBPetBzayR0/V0HXtr9+IXnGpwJ7 jxvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mcssnhKHGpqf7aGtYadSQBmF9hBe6OphCi9VnHFLwK8=; b=t5+a214EK6BbBXnjNnrhbuTcCavhy6gHUF3/6ePoEAvhMbQL5bPfjhEFPKFSLyIWW+ qVrVV6G9VjloXM8vu9+hvYLJDylbrWLz0wWeItg0J0HqEs6qUIfUNCI1VtqmvALnBenc JVSJ0vqG5lY6Oegb0ci01EUJrnPrx0KB/xHzZg9fD6n5M2hcwyFzBkOB7uBiD6lECsOA zN1zSvynwGaTyfg+914sgrpYkgg5a3G3JwPlU81ewrTN1rLtw+43xETu0wiJbBVxKuZD LwoL4Q+ObsipVmE/FM2ONstrK2AkLyyzRvR7YqRp7T9hUkNeQ1AuaFaXRstR+pl6eyfe iKUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=YJzBitf3; 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 5si13461539iof.82.2021.08.02.19.01.48; Mon, 02 Aug 2021 19:02:00 -0700 (PDT) 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=@gibson.dropbear.id.au header.s=201602 header.b=YJzBitf3; 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 S233524AbhHCB7z (ORCPT + 99 others); Mon, 2 Aug 2021 21:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233449AbhHCB7y (ORCPT ); Mon, 2 Aug 2021 21:59:54 -0400 Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 917BDC06175F; Mon, 2 Aug 2021 18:59:44 -0700 (PDT) Received: by ozlabs.org (Postfix, from userid 1007) id 4Gdyjn2qhBz9sRR; Tue, 3 Aug 2021 11:59:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1627955981; bh=mcssnhKHGpqf7aGtYadSQBmF9hBe6OphCi9VnHFLwK8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YJzBitf3pp0u/NKy0gtRB+9FzkbD9C+yw1jDFI3o0uuA3rzB2LyegGA/PabDE74vP G+IG8wYOgtVrgFbrnRs7bMXHz5TJ72GHsRS3ush9ybD0NN4nZdzMsDsjCL8AUYXNSH F25Pcd0z5I5RLRdUHZii6gWgRXAyHxYnPsR78ncc= Date: Tue, 3 Aug 2021 11:58:54 +1000 From: David Gibson To: Jason Gunthorpe Cc: "Tian, Kevin" , "Alex Williamson (alex.williamson@redhat.com)" , Jean-Philippe Brucker , Jason Wang , "parav@mellanox.com" , "Enrico Weigelt, metux IT consult" , Paolo Bonzini , Shenming Lu , Joerg Roedel , Eric Auger , Jonathan Corbet , "Raj, Ashok" , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Kirti Wankhede , Robin Murphy , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , David Woodhouse , LKML , Lu Baolu Subject: Re: [RFC v2] /dev/iommu uAPI proposal Message-ID: References: <20210730145123.GW1721383@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="woWztZ/43ybkO+Tp" Content-Disposition: inline In-Reply-To: <20210730145123.GW1721383@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --woWztZ/43ybkO+Tp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 30, 2021 at 11:51:23AM -0300, Jason Gunthorpe wrote: > On Mon, Jul 26, 2021 at 02:50:48PM +1000, David Gibson wrote: >=20 > > That said, I'm still finding the various ways a device can attach to > > an ioasid pretty confusing. Here are some thoughts on some extra > > concepts that might make it easier to handle [note, I haven't thought > > this all the way through so far, so there might be fatal problems with > > this approach]. >=20 > I think you've summarized how I've been viewing this problem. All the > concepts you pointed to should show through in the various APIs at the > end, one way or another. >=20 > How much we need to expose to userspace, I don't know. >=20 > Does userspace need to care how the system labels traffic between DMA > endpoint and the IOASID? At some point maybe yes since stuff like > PASID does leak out in various spots Yeah, I'm not sure. I think it probably doesn't for the "main path" of the API, though we might want to expose that for debugging and some edge cases. We *should* however be exposing the address type for each IOAS, since that affects how your MAP operations will work, as well as what endpoints are compatible with the IOAS. > > /dev/iommu would work entirely (or nearly so) in terms of endpoint > > handles, not device handles. Endpoints are what get bound to an IOAS, > > and endpoints are what get the user chosen endpoint cookie. >=20 > While an accurate modeling of groups, it feels like an > overcomplication at this point in history where new HW largely doesn't > need it. So.. first, is that really true across the board? I expect it's true of high end server hardware, but for consumer level and embedded hardware as well? Then there's virtual hardware - I could point to several things still routinely using emulated PCIe to PCI bridges in qemu. Second, we can't just ignore older hardware. > The user interface VFIO and others presents is device > centric, inserting a new endpoint object is going going back to some > kind of group centric view of the world. Well, kind of, yeah, because I still think the concept has value. Part of the trouble is that "device" is pretty ambiguous. "Device" in the sense of PCI address for register interface may not be the same as "device" in terms of DMA RID may not be the same as as "device" in terms of Linux struct device=20 terms of PCI register interface is not the same as "device" in terms of RID / DMA identifiability is not the same "device" in terms of what. > I'd rather deduce the endpoint from a collection of devices than the > other way around... Which I think is confusing, and in any case doesn't cover the case of one "device" with multiple endpoints. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --woWztZ/43ybkO+Tp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmEIot4ACgkQbDjKyiDZ s5LrNhAAuKUL5EwDkgGG0d1RtZfMCGJzZoJmU/9h/PLaLeR/INpQR+ZrAd0vNrUd XxGaIEZelNKEFXMyALoYwXqiwxdwdhduIpdBaN2X2usYYKaMl6iuP34CMWKl7gxq U+91Jwb/lP3IrU1t9fhAJaNUL/wIKpmMefsFjVqicYjwxGdIHdJLT8TsHqnd/Suq Yx5kjGQhF8o3lziQtAeDwMfGytM2rekdpshVrIye8+6urrxO/PM308gGGUj3QBfE NxmDYQWRDcqrPdtLN8Ln8sPi7GDliXX0+8pC83RiRPUgXGCgoLcmF8KGVUtio/td TC8laRhl15Zls1/EyuBlDRZBkp/SQSlksh3v9sgHfJqUofgLtWcHtb8w+arNEGKQ b3ppdmORDQg47ELkRE/fYgNNHiFQmzZxEP7TJJaR+uhY2DQ7LEsFS3UUeFI82oUb DY9+4FwKgI73+Cz+f088tIJ5gJgLoESLUDcqShvsbFK4RjD3bJcyCwwap8Vz5kuf eH/fdvoeqw/M8L2xS+i6NqzVY59hAOFWNj8yU1O4V3yLCo8D8Z7/4ouoRqWgz6Ci 7JhDg/zYuoCRG9KNDO5s/FNpuQW6UCiJi07ZQi6J62mnmRvi3gFJcn3Wvi15yY4K gLebfSKkC/adNM5iUb0shqpYS5qLt5OZUITuujtV2wVs5hr2zUk= =1JD4 -----END PGP SIGNATURE----- --woWztZ/43ybkO+Tp--