Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5209786pxj; Wed, 9 Jun 2021 11:45:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz05deDYS+RjlcowCRd7x2JH0voQ4CSVW2DPDOCLdPd1deo5vYvFgLQ26SEc7BhflNrXwX X-Received: by 2002:a17:906:9715:: with SMTP id k21mr1124027ejx.553.1623264346526; Wed, 09 Jun 2021 11:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623264346; cv=none; d=google.com; s=arc-20160816; b=qLeyoso9axUYCSMh1g/tYCbATsCOys9cou5exG+m96mWx8YDiQNEgOYY4MmFW+KrtY MTjcKFlYbIDhUCs+ZAfMfCnOzhVobqPo/YEBASZvYXvjHrazyBRRzzkiSK+XXS5bJ61U VR8Bcysf/+Q51KgFJn0agpEdDUKDqQ8ifHbzowunXM6CvrSVGtShMn3W4s+CiWSO84rk HgIv731Vz5Lx8g+UEwwDpy0GJ4bAyYpL0UQYpP4cj8PaWfyQ5DHTdDVo7cHb6/KEE47l K/H9MCBdVvHKf9ZEX0a3LA/AWIjSR0vNaXgmQ31RamsaHltqP28bDXWks+bR9nzHTlZ4 wSPQ== 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; bh=09V8mfOGE7e5f+hL85zOTaOYr4WB85ea/WvX34/GxJ4=; b=Q1A59PCCqgdmJN8eoN5YiX3AQczrEB0hGfD7zsSGoaZ85dEwWAQErZF+dHmwbO2ITL b0x5REdPfC8yEh0EigNQfnpmOJSJGt9vS/SODVHOXVeEjxHBOEBHsEn9XnR9TcfIGQW2 JXSlFrH3uDGn+8zA7WIr09vlfLOoFsMBP9G2zANPkSS7mrn0wByV7Qe01CxRyXPxn7HW 6MCbYrAWaNVGckrTRBolEozjxRoGuL6+svKY90LcWXr2ZqAtsxw2mvVuvxRRQU9fyHnA 7Gyo6x1GzmOm0UWv6yxXcGyCa0H6XMFCdai5GBxadNUtbDdWmh91iihSsuZybPOc5VCe 1+lQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y5si323375edv.563.2021.06.09.11.45.21; Wed, 09 Jun 2021 11:45:46 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233645AbhFINee (ORCPT + 99 others); Wed, 9 Jun 2021 09:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231576AbhFINec (ORCPT ); Wed, 9 Jun 2021 09:34:32 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99F2BC06175F; Wed, 9 Jun 2021 06:32:37 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id 7774036A; Wed, 9 Jun 2021 15:32:35 +0200 (CEST) Date: Wed, 9 Jun 2021 15:32:34 +0200 From: Joerg Roedel To: Jason Gunthorpe Cc: "Tian, Kevin" , "Alex Williamson (alex.williamson@redhat.com)" , Jean-Philippe Brucker , David Gibson , 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: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210609123919.GA1002214@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 09, 2021 at 09:39:19AM -0300, Jason Gunthorpe wrote: > VFIO being group centric has made it very ugly/difficult to inject > device driver specific knowledge into the scheme. This whole API will be complicated and difficult anyway, so no reason to unnecessarily simplify things here. VFIO is group-centric for security/isolation reasons, and since IOASID is a uAPI it also needs to account for that. In the end the devices which are going to use this will likely have their own group anyway, so things will not get too complicated. > The current approach has the group try to guess the device driver > intention in the vfio type 1 code. > > 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. I am in for the general idea, it simplifies the code. But the kernel still needs to check whether the wishlist from user-space can be fulfilled. > The group is causing all this mess because the group knows nothing > about what the device drivers contained in the group actually want. There are devices in the group, not drivers. > 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? You don't use it, because it is not secure for devices which are not behind an ACS bridge. > 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. If all devices in the group have to use the same IOASID anyway, we can just as well force it by making the interface group-centric. Regards, Joerg