Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp201531pxj; Thu, 17 Jun 2021 00:23:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtcLKN2F4GYR7kIcv3/CDo9Jru6Gyk2ImCyBg6bVw4dFxQj/g4gUmZXuuVy/Pa/v4mrl+g X-Received: by 2002:a05:6638:168d:: with SMTP id f13mr3227396jat.124.1623914627778; Thu, 17 Jun 2021 00:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623914627; cv=none; d=google.com; s=arc-20160816; b=qOdDZB7O0UfjvoP8wt+BEpqIT0IoiS6StY2CntsGvF7NGCMpwJ68ReCk0FL0XXQ5un sZyAhgsEN5K96cN7hgL51StJV2eXIDB+dXkWtr8dPxnQVyo7lzx2I6EUMNPNGcytouQ9 igtCaqNcy6vd6bFlIKG4rXgmMKAaEernOr0oc1WrUK0BkcsIYNxCFEBw9NGV0XiiuNKc yeqIL1b0A8uL7DhBfZ5P5vtHPGYc8UeqQ91qnCWzf+ahGeaQFOnJ+Ux3JjomnETcxPID EtMlR8bY7W7xGLuk9xSdSxtEeVTW0Bm3O6psWwUfb/EEz/REPW+oOmFdPAJF3XAtkTFs 1iWQ== 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=16uRu4w7UYhYggz2uavP0hmR0pHZq6auzK8ChTk2ZaI=; b=qxpR3E8cCBM9qDQdyK9s0o8KKhz+VifrFkfHeivw02eofHM6anrEv6nVWvdvWX0SVF /WMPty0WABBSdHGbrVRXCEjcz9uV62lh6rgRvJHrvYqAsOy/1jEzyWN6EVMBhdz6IrzN /uvgPTFIU1HObvu+Ll20oucGO5IIf0CFdd04AZcghQXi2l53DWOLYMqgNGg3MXl9HhLB zFUeXAc4NcVVtN79sg1uRlF94YL5z942ZPefbgK5uuJh/2ove4HkOmkGI9lXFlPQPGFw OrQcoVQTYuQIASFcRq2VamwAfX6Zx4DDGnaMz8NTIOCdagrCVoOs7hjWyqJo5PKW14Cz qTGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=MFBPTGRF; 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 l23si5202799jaf.47.2021.06.17.00.23.36; Thu, 17 Jun 2021 00:23:47 -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=MFBPTGRF; 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 S231209AbhFQHYi (ORCPT + 99 others); Thu, 17 Jun 2021 03:24:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230331AbhFQHYY (ORCPT ); Thu, 17 Jun 2021 03:24:24 -0400 Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC54C061574; Thu, 17 Jun 2021 00:22:16 -0700 (PDT) Received: by ozlabs.org (Postfix, from userid 1007) id 4G5D5W75dmz9sXN; Thu, 17 Jun 2021 17:22:07 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1623914528; bh=qHt4cdZnk75miSfGS18ZGHebQR5ivhD/A2lqaj41G0w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MFBPTGRFEVaNTvvFvlTgUWKwEc4kQPWOSalxsFmlF/dxovJu6UNpgXh06qmieAtla aTOsdeIpcRXrYzZ4M5ZysP3isWxuYVwSRue2XMxKO51w62GFXvTty/W2z2NR4Vc26v kGEdyjdkfH3HSbrNihVHLK5CK8XMgkoT3Stmj2Ig= Date: Thu, 17 Jun 2021 14:45:46 +1000 From: David Gibson To: Jason Gunthorpe Cc: Joerg Roedel , "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 , 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: Plan for /dev/ioasid RFC v2 Message-ID: References: <20210609123919.GA1002214@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dBV3Ysu62aAbOUva" Content-Disposition: inline In-Reply-To: <20210609123919.GA1002214@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --dBV3Ysu62aAbOUva Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 09, 2021 at 09:39:19AM -0300, Jason Gunthorpe wrote: > On Wed, Jun 09, 2021 at 02:24:03PM +0200, Joerg Roedel wrote: > > On Mon, Jun 07, 2021 at 02:58:18AM +0000, Tian, Kevin wrote: > > > - Device-centric (Jason) vs. group-centric (David) uAPI. David is n= ot fully > > > convinced yet. Based on discussion v2 will continue to have ioasi= d uAPI > > > being device-centric (but it's fine for vfio to be group-centric)= =2E A new > > > section will be added to elaborate this part; > >=20 > > I would vote for group-centric here. Or do the reasons for which VFIO is > > group-centric not apply to IOASID? If so, why? >=20 > VFIO being group centric has made it very ugly/difficult to inject > device driver specific knowledge into the scheme. >=20 > The device driver is the only thing that knows to ask: > - I need a SW table for this ioasid because I am like a mdev > - I will issue TLPs with PASID > - I need a IOASID linked to a PASID > - I am a devices that uses ENQCMD and vPASID > - etc in future mdev drivers might know these, but shim drivers, like basic vfio-pci often won't. In that case only the userspace driver will know that for certain. The shim driver at best has a fairly loose bound on what the userspace driver *could* do. I still think you're having a tendency to partially conflate several meanings of "group": 1. the unavoidable hardware unit of non-isolation 2. the kernel internal concept and interface to it 3. the user visible fd and interface We can't avoid having (1) somewhere, (3) and to a lesser extent (2) are what you object to. > The current approach has the group try to guess the device driver > intention in the vfio type 1 code. I agree this has gotten ugly. What I'm not yet convinced of is that reworking groups to make this not-ugly necessarily requires totally minimizing the importance of groups. > I want to see this be clean and have the device driver directly tell > the iommu layer what kind of DMA it plans to do, and thus how it needs > the IOMMU and IOASID configured. >=20 > This is the source of the ugly symbol_get and the very, very hacky 'if > you are a mdev *and* a iommu then you must want a single PASID' stuff > in type1. >=20 > The group is causing all this mess because the group knows nothing > about what the device drivers contained in the group actually want. >=20 > Further being group centric eliminates the possibility of working in > cases like !ACS. How do I use PASID functionality of a device behind a > !ACS switch if the uAPI forces all IOASID's to be linked to a group, > not a device? >=20 > Device centric with an report that "all devices in the group must use > the same IOASID" covers all the new functionality, keep the old, and > has a better chance to keep going as a uAPI into the future. >=20 > Jason >=20 --=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 --dBV3Ysu62aAbOUva Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmDK03gACgkQbDjKyiDZ s5IDihAArTAIG0ZjpRdzkGG1oSy/yIILv/6kpvhvO41K7EWs7BoSD9wHWgKmNdOV Z1/Wy1C+nITlY0c8Lfv94BziM+8f32AaoTbfekmzKYDcGHmZuBKmyLcHOulLsx78 OccGNfd4gFe9AsX7wMonxhTQEAjxGQOyqU+Fx1vnyUmhxypHx7iXdGosY+u1RaiN uCNO0uHvslaEym/g11x1gTE02wAmd3eKpdl/Mdt9gMOB9Jq8kjr4inZf3NEOrPly epHoghD1te2rQl5XZxJ/N9qrzofbpFuXwEfTBJyprctpFPF69iDK4i3txfb7JY6b jFmwFSspVn2uzwmIW30dTvNDxwWqaIC+oHrzkYwGPF5Zc9NNRZdTbtJjbVafJTWr eNnP4QzlRtlI/zcYQcvlnHgawL3O2w+MUvNWv9g8kxtFCbuqY1wMjcKIBle6ac/O 5Ln3MtAe2ZjwtRsmbsQL97XkjGaBtbNJHTtlBaJtY4x4fdND5CRvsOaPp/Nx0uLL j8t+cr4WiBT7HP/68Ap0HZBqMWDjupyH30yWHDL4cWEIpSwFKb6Kwn8joGTLqhXS BCXjR5EakXCp6fTkrtYOMqWRXp0dNpdLhsVphrMpzXyIB8wYtb2yRQlNW517/ccz PDrwJgsax16LJkiIhq+5yGMzbUtiYOhvpU7B4KSQNn7d5y69Sn0= =xxEr -----END PGP SIGNATURE----- --dBV3Ysu62aAbOUva--