Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp603815pxj; Thu, 27 May 2021 07:37:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzirwyDwFWIeKCc1jF33C343f6YJi6C+9NDLUeme6cqJTa/XJBthIkrb5O0I4ujg2N4ItKk X-Received: by 2002:a92:db07:: with SMTP id b7mr3304948iln.282.1622126276163; Thu, 27 May 2021 07:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622126276; cv=none; d=google.com; s=arc-20160816; b=atx2gBp91J6PzGC8JDNa0ABL7BsOXtJ9fZ1dR9K6nx+fW7vMuei3OqgTeE7J4dUmkm aiHm83ZlLvHXc+Y6Duo5zZHY8GIfAtdCnE2gZFsaZPCAlZ50ckYs/zn6ACCqrg7mHCjg JXrcJmtyoS8Pp3I5bATgqS7t4tP+2gn2yEDiWIZuqyEnJUfPK/CB3fjE2cet+WoexF37 V434wUMqkOFKYvkUrM/RRFBhPmwY+OrGPtzFf+6yfy43z/uyL5D6sEKHwTy9UJC4pJ4p s+zAb3b0ghPO8wCnfxUu1riWrA7g9t80CsVZUN0Qi/EwyIbR63X6ZIkrThNYjWazFEza f3DQ== 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=S3x273kjfZ7j8329oq9ol5XDaQoQnFdaqPKmI8YIKgA=; b=mLhJtPzRmZcNVfKgUGtuAqcR5/crpVJFHxwlvSSANJv8lsd9mtYqSLQxVjaE3Zc4vy HlC7ZhE8DlKOYrbdJ8ZCDoDJypdnKBifmpQ/FKIsMZInAblGOlbJQNjDjcmBkOcgzy5j 0fKF7isTmypMDtsBdpSVoKX7O84owd3JYtWSHfJjNXtyHWVklGS1kUaZfH/vYTQy6KiP O1NOdd0yJihf9nuWm7ipalBMT8yAwIfwv6qTHwIQOm4PTM8GBSNNmvCHVRT1yU+ZV1MV 58rlWGX3HvmX46MAiES6FXGxAK8hgJaSN5LXYIzTfXHTRXfpCFWD4dqSbe+L0x54a1jx upLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=PBJfr7UY; 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 m4si2799602jah.87.2021.05.27.07.37.39; Thu, 27 May 2021 07:37:56 -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=PBJfr7UY; 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 S234703AbhE0HN4 (ORCPT + 99 others); Thu, 27 May 2021 03:13:56 -0400 Received: from ozlabs.org ([203.11.71.1]:57533 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234684AbhE0HNz (ORCPT ); Thu, 27 May 2021 03:13:55 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4FrJsx2tB6z9sWp; Thu, 27 May 2021 17:12:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1622099541; bh=/Vk6QIsfClarCnHuWF3h00g/TTHnE4TtoS0mH61nSvk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PBJfr7UYZPAGjibTLx3tnWLHnRpaUShxpkGQgtqAMqSU1cRDoZa5GzhsXCRFM76n6 /2dBtWmxbyYYr4V+CxP4PSVzAwF4AD4T2TGF1pIXK0c44UNAZyDsnE8zGdVBo4KZpb 3ivmm4aCrXG/e3Jm6+/nRQqIJ3rfH7ZWRNAOeov4= Date: Thu, 27 May 2021 14:58:30 +1000 From: David Gibson To: Jason Gunthorpe Cc: Kirti Wankhede , Alex Williamson , "Liu, Yi L" , Jacob Pan , Auger Eric , Jean-Philippe Brucker , "Tian, Kevin" , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "cgroups@vger.kernel.org" , Tejun Heo , Li Zefan , Johannes Weiner , Jean-Philippe Brucker , Jonathan Corbet , "Raj, Ashok" , "Wu, Hao" , "Jiang, Dave" , Alexey Kardashevskiy Subject: Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Message-ID: References: <20210428145622.GU1370958@nvidia.com> <20210503161518.GM1370958@nvidia.com> <20210513135938.GG1002214@nvidia.com> <20210524233744.GT1002214@nvidia.com> <20210525195257.GG1002214@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rKeY89V0ifZRRhP6" Content-Disposition: inline In-Reply-To: <20210525195257.GG1002214@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --rKeY89V0ifZRRhP6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 25, 2021 at 04:52:57PM -0300, Jason Gunthorpe wrote: > On Wed, May 26, 2021 at 12:56:30AM +0530, Kirti Wankhede wrote: >=20 > > 2. iommu backed mdev devices for SRIOV where mdev device is created per > > VF (mdev device =3D=3D VF device) then that mdev device has same iommu > > protection scope as VF associated to it.=20 >=20 > This doesn't require, and certainly shouldn't create, a fake group. It's only fake if you start with a narrow view of what a group is. A group is a set of devices (in the kernel sense of "device", not necessarily the hardware sense) which can't be isolated from each other. The mdev device is a kernel device, and if working as intended it can be isolated from everything else, and is therefore in an absolute bona fide group of its own. > Only the VF's real IOMMU group should be used to model an iommu domain > linked to a VF. Injecting fake groups that are proxies for real groups > only opens the possibility of security problems like David is > concerned with. It's not a proxy for a real group, it's a group of its own. If you discover that (due to a hardware bug, for example) the mdev is *not* properly isolated from its parent PCI device, then both the mdev virtual device *and* the physical PCI device are in the same group. Groups including devices of different types and on different buses were considered from the start, and are precedented, if rare. > Max's series approaches this properly by fully linking the struct > pci_device of the VF throughout the entire VFIO scheme, including the > group and container, while still allowing override of various VFIO > operations. >=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 --rKeY89V0ifZRRhP6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmCvJvYACgkQbDjKyiDZ s5IEqBAAp3p5NH8nnJVVcGSVZxbNrLeTTJqPwhNtEEsveVKJd5BmHf3EvT4BqqnK rXisyd2ygrY8fO1DiLJOa/WM6FDA05WD0XkqyDJ2XUFAOEHpyY0EesSw7CqSl1zz V2dbprWQAD9nJoPG/fidBsmuYEwpxjvptttrf1yEgFe+isfJLdalJbA+k/kfZOdd F4BL6+mtySC2DoKnQqoDQYCsXrSNzsYgv6SDbj4W7izUuOqYFADN7qawINcxAEBa I43JXW3Dhx3aLzL0JeEjFf2j/f1YMQo/RfkfLg9OWuHdsF+SF8+5lcikGWtjBZKT pC443P1CHOmJkW0TMr9Pz2lHJfjlcTaIq35qpaEP23tKmS60FDoLIvWPlFJYidaz tWDNMtMmS8UbcyzF868ZJiRc94+A8RTFFW7hSmHQoqLnxMqNnUoyOKrZ2ehaqg+j JjbsxFq37+jun2Fb2BxwPg+F2jFQmaw7l6FCdhePKc/h/HeCRPpZ+jTqF6AEqdU1 KrET9bw9TE3euBNQK62gJNfdIdrkBelfcUjKluxCWamoHFeJBEnBKbqGR4wn0Jqg QucFQtoKZyEIXVKFtK0Pedz46dzxc5iH1hj+eIAGLw92/SIjWzVYEp6vCZYHxNSk VQFvdHTLJJ8vRVhLGJlo5Ji4EX+jgb9i7eIufxgqD+SxhzOoRvo= =ygK9 -----END PGP SIGNATURE----- --rKeY89V0ifZRRhP6--