RE: Plan for /dev/ioasid RFC v2

2021-06-28 Thread Tian, Kevin
> From: Alex Williamson > Sent: Tuesday, June 29, 2021 6:32 AM > > On Mon, 28 Jun 2021 01:09:18 + > "Tian, Kevin" wrote: > > > > From: Jason Gunthorpe > > > Sent: Friday, June 25, 2021 10:36 PM > > > > > > On Fri, Jun 25, 2021 at 10:27:18AM +, Tian, Kevin wrote: > > > > > > > - When

RE: Plan for /dev/ioasid RFC v2

2021-06-28 Thread Tian, Kevin
> From: Alex Williamson > Sent: Tuesday, June 29, 2021 7:09 AM > > > > Ideally vfio would also at least be able to register a type1 IOMMU > > > backend through the existing uapi, backed by this iommu code, ie. we'd > > > create a new "iommufd" (but without the user visible fd), > > > > It would b

RE: Plan for /dev/ioasid RFC v2

2021-06-28 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Tuesday, June 29, 2021 7:13 AM > > On Mon, Jun 28, 2021 at 05:09:02PM -0600, Alex Williamson wrote: > > On Mon, 28 Jun 2021 19:48:18 -0300 > > Jason Gunthorpe wrote: > > > > > On Mon, Jun 28, 2021 at 04:31:45PM -0600, Alex Williamson wrote: > > > > > > > I'd expect

Re: Plan for /dev/ioasid RFC v2

2021-06-28 Thread Jason Gunthorpe
On Mon, Jun 28, 2021 at 05:09:02PM -0600, Alex Williamson wrote: > On Mon, 28 Jun 2021 19:48:18 -0300 > Jason Gunthorpe wrote: > > > On Mon, Jun 28, 2021 at 04:31:45PM -0600, Alex Williamson wrote: > > > > > I'd expect that /dev/iommu will be used by multiple subsystems. All > > > will want to

Re: Plan for /dev/ioasid RFC v2

2021-06-28 Thread Alex Williamson
On Mon, 28 Jun 2021 19:48:18 -0300 Jason Gunthorpe wrote: > On Mon, Jun 28, 2021 at 04:31:45PM -0600, Alex Williamson wrote: > > > I'd expect that /dev/iommu will be used by multiple subsystems. All > > will want to bind devices to address spaces, so shouldn't binding a > > device to an iommufd

Re: Plan for /dev/ioasid RFC v2

2021-06-28 Thread Jason Gunthorpe
On Mon, Jun 28, 2021 at 04:31:45PM -0600, Alex Williamson wrote: > I'd expect that /dev/iommu will be used by multiple subsystems. All > will want to bind devices to address spaces, so shouldn't binding a > device to an iommufd be an ioctl on the iommufd, ie. > IOMMU_BIND_VFIO_DEVICE_FD. Maybe w

Re: Plan for /dev/ioasid RFC v2

2021-06-28 Thread Alex Williamson
On Mon, 28 Jun 2021 01:09:18 + "Tian, Kevin" wrote: > > From: Jason Gunthorpe > > Sent: Friday, June 25, 2021 10:36 PM > > > > On Fri, Jun 25, 2021 at 10:27:18AM +, Tian, Kevin wrote: > > > > > - When receiving the binding call for the 1st device in a group, > > > iommu_fd > > >

Re: Plan for /dev/ioasid RFC v2

2021-06-28 Thread Jason Gunthorpe
On Mon, Jun 28, 2021 at 06:45:23AM +, Tian, Kevin wrote: > 7) Unbinding detaches the device from the block_dma domain and >re-attach it to the default domain. From now on the user should >be denied from accessing the device. vfio should tear down the >MMIO mapping at

Re: Plan for /dev/ioasid RFC v2

2021-06-28 Thread Jason Gunthorpe
On Mon, Jun 28, 2021 at 02:03:56AM +, Tian, Kevin wrote: > Combining with the last paragraph above, are you actually suggesting > that 1:1 group (including mdev) should use a new device-centric vfio > uAPI (without group fd) while existing group-centric vfio uAPI is only > kept for 1:N grou

RE: Plan for /dev/ioasid RFC v2

2021-06-27 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Friday, June 25, 2021 10:36 PM > > On Fri, Jun 25, 2021 at 10:27:18AM +, Tian, Kevin wrote: > > > - When receiving the binding call for the 1st device in a group, iommu_fd > > calls iommu_group_set_block_dma(group, dev->driver) which does > > several

RE: Plan for /dev/ioasid RFC v2

2021-06-27 Thread Tian, Kevin
Hi, Jason, > From: Jason Gunthorpe > Sent: Friday, June 25, 2021 10:36 PM > > The only thing that needs to be done to get the 1:1 step is to broadly > define how the other two cases will work so we don't get into trouble > and set some way to exclude the problematic cases from even getting to >

RE: Plan for /dev/ioasid RFC v2

2021-06-27 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Friday, June 25, 2021 10:36 PM > > On Fri, Jun 25, 2021 at 10:27:18AM +, Tian, Kevin wrote: > > > - When receiving the binding call for the 1st device in a group, iommu_fd > > calls iommu_group_set_block_dma(group, dev->driver) which does > > several

Re: Plan for /dev/ioasid RFC v2

2021-06-25 Thread Jason Gunthorpe
On Fri, Jun 25, 2021 at 10:27:18AM +, Tian, Kevin wrote: > - When receiving the binding call for the 1st device in a group, iommu_fd > calls iommu_group_set_block_dma(group, dev->driver) which does > several things: The whole problem here is trying to match this new world where we

RE: Plan for /dev/ioasid RFC v2

2021-06-25 Thread Tian, Kevin
Hi, Alex/Joerg/Jason, Want to draw your attention on an updated proposal below. Let's see whether there is a converged direction to move forward. 😊 > From: Jason Gunthorpe > Sent: Saturday, June 19, 2021 2:23 AM > > On Fri, Jun 18, 2021 at 04:57:40PM +, Tian, Kevin wrote: > > > From: Jason

Re: Plan for /dev/ioasid RFC v2

2021-06-24 Thread Lu Baolu
On 2021/6/24 12:03, David Gibson wrote: On Fri, Jun 18, 2021 at 01:21:47PM +0800, Lu Baolu wrote: Hi David, On 6/17/21 1:22 PM, David Gibson wrote: The iommu_group can guarantee the isolation among different physical devices (represented by RIDs). But when it comes to sub-devices (ex. mdev or

Re: Plan for /dev/ioasid RFC v2

2021-06-24 Thread Lu Baolu
On 2021/6/24 12:26, David Gibson wrote: On Fri, Jun 18, 2021 at 04:57:40PM +, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Friday, June 18, 2021 8:20 AM On Thu, Jun 17, 2021 at 03:14:52PM -0600, Alex Williamson wrote: I've referred to this as a limitation of type1, that we can't put de

Re: Plan for /dev/ioasid RFC v2

2021-06-24 Thread Jason Gunthorpe
On Thu, Jun 24, 2021 at 02:37:31PM +1000, David Gibson wrote: > On Thu, Jun 17, 2021 at 08:04:38PM -0300, Jason Gunthorpe wrote: > > On Thu, Jun 17, 2021 at 03:02:33PM +1000, David Gibson wrote: > > > > > In other words, do we really have use cases where we need to identify > > > different devices

Re: Plan for /dev/ioasid RFC v2

2021-06-24 Thread Jason Gunthorpe
On Thu, Jun 24, 2021 at 02:29:29PM +1000, David Gibson wrote: > But as I keep saying, some forms of grouping (and DMA aliasing as Alex > mentioned) mean that changing the domain of one device can change the > domain of another device, unavoidably. It may be rare with modern > hardware, but we sti

RE: Plan for /dev/ioasid RFC v2

2021-06-23 Thread Tian, Kevin
> From: David Gibson > Sent: Thursday, June 24, 2021 12:26 PM > > On Fri, Jun 18, 2021 at 04:57:40PM +, Tian, Kevin wrote: > > > From: Jason Gunthorpe > > > Sent: Friday, June 18, 2021 8:20 AM > > > > > > On Thu, Jun 17, 2021 at 03:14:52PM -0600, Alex Williamson wrote: > > > > > > > I've refe

Re: Plan for /dev/ioasid RFC v2

2021-06-23 Thread David Gibson
On Tue, Jun 15, 2021 at 01:21:35AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Monday, June 14, 2021 9:38 PM > > > > On Mon, Jun 14, 2021 at 03:09:31AM +, Tian, Kevin wrote: > > > > > If a device can be always blocked from accessing memory in the IOMMU > > > before it's bou

Re: Plan for /dev/ioasid RFC v2

2021-06-23 Thread David Gibson
On Thu, Jun 17, 2021 at 08:04:38PM -0300, Jason Gunthorpe wrote: > On Thu, Jun 17, 2021 at 03:02:33PM +1000, David Gibson wrote: > > > In other words, do we really have use cases where we need to identify > > different devices IDs, even though we know they're not isolated. > > I think when PASID

Re: Plan for /dev/ioasid RFC v2

2021-06-23 Thread David Gibson
On Fri, Jun 18, 2021 at 04:57:40PM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Friday, June 18, 2021 8:20 AM > > > > On Thu, Jun 17, 2021 at 03:14:52PM -0600, Alex Williamson wrote: > > > > > I've referred to this as a limitation of type1, that we can't put > > > devices within

Re: Plan for /dev/ioasid RFC v2

2021-06-23 Thread David Gibson
On Fri, Jun 18, 2021 at 12:15:06PM -0300, Jason Gunthorpe wrote: > On Fri, Jun 18, 2021 at 03:47:51PM +0200, Joerg Roedel wrote: > > Hi Kevin, > > > > On Thu, Jun 17, 2021 at 07:31:03AM +, Tian, Kevin wrote: > > > Now let's talk about the new IOMMU behavior: > > > > > > - A device is blocke

Re: Plan for /dev/ioasid RFC v2

2021-06-23 Thread David Gibson
On Thu, Jun 17, 2021 at 03:14:52PM -0600, Alex Williamson wrote: > On Thu, 17 Jun 2021 07:31:03 + > "Tian, Kevin" wrote: > > > From: Alex Williamson > > > Sent: Thursday, June 17, 2021 3:40 AM > > > On Wed, 16 Jun 2021 06:43:23 + > > > "Tian, Kevin" wrote: > > > > > From: Alex Williamson

Re: Plan for /dev/ioasid RFC v2

2021-06-23 Thread David Gibson
On Fri, Jun 18, 2021 at 01:21:47PM +0800, Lu Baolu wrote: > Hi David, > > On 6/17/21 1:22 PM, David Gibson wrote: > > > The iommu_group can guarantee the isolation among different physical > > > devices (represented by RIDs). But when it comes to sub-devices (ex. mdev > > > or > > > vDPA devices

Re: Plan for /dev/ioasid RFC v2

2021-06-23 Thread David Gibson
On Thu, Jun 17, 2021 at 08:10:04PM -0300, Jason Gunthorpe wrote: > On Thu, Jun 17, 2021 at 02:45:46PM +1000, David Gibson wrote: > > 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 0

Re: Plan for /dev/ioasid RFC v2

2021-06-18 Thread Jason Gunthorpe
On Fri, Jun 18, 2021 at 04:57:40PM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Friday, June 18, 2021 8:20 AM > > > > On Thu, Jun 17, 2021 at 03:14:52PM -0600, Alex Williamson wrote: > > > > > I've referred to this as a limitation of type1, that we can't put > > > devices within

RE: Plan for /dev/ioasid RFC v2

2021-06-18 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Friday, June 18, 2021 8:20 AM > > On Thu, Jun 17, 2021 at 03:14:52PM -0600, Alex Williamson wrote: > > > I've referred to this as a limitation of type1, that we can't put > > devices within the same group into different address spaces, such as > > behind separate

Re: Plan for /dev/ioasid RFC v2

2021-06-18 Thread Alex Williamson
On Fri, 18 Jun 2021 08:37:35 -0700 "Raj, Ashok" wrote: > On Fri, Jun 18, 2021 at 12:15:06PM -0300, Jason Gunthorpe wrote: > > On Fri, Jun 18, 2021 at 03:47:51PM +0200, Joerg Roedel wrote: > > > Hi Kevin, > > > > > > On Thu, Jun 17, 2021 at 07:31:03AM +, Tian, Kevin wrote: > > > > Now let

Re: Plan for /dev/ioasid RFC v2

2021-06-18 Thread Raj, Ashok
On Fri, Jun 18, 2021 at 12:15:06PM -0300, Jason Gunthorpe wrote: > On Fri, Jun 18, 2021 at 03:47:51PM +0200, Joerg Roedel wrote: > > Hi Kevin, > > > > On Thu, Jun 17, 2021 at 07:31:03AM +, Tian, Kevin wrote: > > > Now let's talk about the new IOMMU behavior: > > > > > > - A device is blocke

Re: Plan for /dev/ioasid RFC v2

2021-06-18 Thread Jason Gunthorpe
On Fri, Jun 18, 2021 at 03:47:51PM +0200, Joerg Roedel wrote: > Hi Kevin, > > On Thu, Jun 17, 2021 at 07:31:03AM +, Tian, Kevin wrote: > > Now let's talk about the new IOMMU behavior: > > > > - A device is blocked from doing DMA to any resource outside of > > its group when it's probed

Re: Plan for /dev/ioasid RFC v2

2021-06-18 Thread Joerg Roedel
Hi Kevin, On Thu, Jun 17, 2021 at 07:31:03AM +, Tian, Kevin wrote: > Now let's talk about the new IOMMU behavior: > > - A device is blocked from doing DMA to any resource outside of > its group when it's probed by the IOMMU driver. This could be a > special state w/o attaching to an

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread Lu Baolu
Hi David, On 6/17/21 1:22 PM, David Gibson wrote: The iommu_group can guarantee the isolation among different physical devices (represented by RIDs). But when it comes to sub-devices (ex. mdev or vDPA devices represented by RID + SSID), we have to rely on the device driver for isolation. The dev

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread Jason Gunthorpe
On Thu, Jun 17, 2021 at 07:31:03AM +, Tian, Kevin wrote: > > > Yes. function 1 is block-DMA while function 0 still attached to IOASID. > > > Actually unbind from IOMMU fd doesn't change the security context. > > > the change is conducted when attaching/detaching device to/from an > > > IOASID.

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread Jason Gunthorpe
On Thu, Jun 17, 2021 at 03:14:52PM -0600, Alex Williamson wrote: > I've referred to this as a limitation of type1, that we can't put > devices within the same group into different address spaces, such as > behind separate vRoot-Ports in a vIOMMU config, but really, who cares? > As isolation suppor

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread Jason Gunthorpe
On Tue, Jun 15, 2021 at 10:12:15AM -0600, Alex Williamson wrote: > > 1) A dual-function PCIe e1000e NIC where the functions are grouped >together due to ACS isolation issues. > >a) Initial state: functions 0 & 1 are both bound to e1000e driver. > >b) Admin uses driverctl to bind func

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread Jason Gunthorpe
On Thu, Jun 17, 2021 at 02:45:46PM +1000, David Gibson wrote: > 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 +, Tian, Kevin wrote: > > > > - Device-centric (Jason) vs

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread Jason Gunthorpe
On Thu, Jun 17, 2021 at 03:02:33PM +1000, David Gibson wrote: > In other words, do we really have use cases where we need to identify > different devices IDs, even though we know they're not isolated. I think when PASID is added in and all the complexity that brings, it does become more important

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread Alex Williamson
On Thu, 17 Jun 2021 07:31:03 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Thursday, June 17, 2021 3:40 AM > > > > On Wed, 16 Jun 2021 06:43:23 + > > "Tian, Kevin" wrote: > > > > > > From: Alex Williamson > > > > Sent: Wednesday, June 16, 2021 12:12 AM > > > > > > > >

RE: Plan for /dev/ioasid RFC v2

2021-06-17 Thread Tian, Kevin
> From: Alex Williamson > Sent: Thursday, June 17, 2021 3:40 AM > > On Wed, 16 Jun 2021 06:43:23 + > "Tian, Kevin" wrote: > > > > From: Alex Williamson > > > Sent: Wednesday, June 16, 2021 12:12 AM > > > > > > On Tue, 15 Jun 2021 02:31:39 + > > > "Tian, Kevin" wrote: > > > > > > > > F

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread David Gibson
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 +, Tian, Kevin wrote: > > > - Device-centric (Jason) vs. group-centric (David) uAPI. David is not > > > fully > > > conv

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread David Gibson
On Fri, Jun 11, 2021 at 01:45:29PM -0300, Jason Gunthorpe wrote: > On Thu, Jun 10, 2021 at 09:38:42AM -0600, Alex Williamson wrote: > > > Opening the group is not the extent of the security check currently > > required, the group must be added to a container and an IOMMU model > > configured for t

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread David Gibson
On Thu, Jun 10, 2021 at 01:50:22PM +0800, Lu Baolu wrote: > On 6/9/21 8:39 PM, 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 +, Tian, Kevin wrote: > > > > - Device-centric (Jason) vs. group-centric (David) uAP

Re: Plan for /dev/ioasid RFC v2

2021-06-17 Thread David Gibson
On Wed, Jun 09, 2021 at 10:15:32AM -0600, Alex Williamson wrote: > On Wed, 9 Jun 2021 17:51:26 +0200 > Joerg Roedel wrote: > > > On Wed, Jun 09, 2021 at 12:00:09PM -0300, Jason Gunthorpe wrote: > > > Only *drivers* know what the actual device is going to do, devices do > > > not. Since the group

Re: Plan for /dev/ioasid RFC v2

2021-06-16 Thread Liu Yi L
Hi Alex, On Wed, 16 Jun 2021 13:39:37 -0600, Alex Williamson wrote: > On Wed, 16 Jun 2021 06:43:23 + > "Tian, Kevin" wrote: > > > > From: Alex Williamson > > > Sent: Wednesday, June 16, 2021 12:12 AM > > > > > > On Tue, 15 Jun 2021 02:31:39 + > > > "Tian, Kevin" wrote: > > > > >

Re: Plan for /dev/ioasid RFC v2

2021-06-16 Thread Alex Williamson
On Wed, 16 Jun 2021 06:43:23 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Wednesday, June 16, 2021 12:12 AM > > > > On Tue, 15 Jun 2021 02:31:39 + > > "Tian, Kevin" wrote: > > > > > > From: Alex Williamson > > > > Sent: Tuesday, June 15, 2021 12:28 AM > > > > > > >

RE: Plan for /dev/ioasid RFC v2

2021-06-15 Thread Tian, Kevin
> From: Alex Williamson > Sent: Wednesday, June 16, 2021 12:56 AM > > On Tue, 15 Jun 2021 01:21:35 + > "Tian, Kevin" wrote: > > > > From: Jason Gunthorpe > > > Sent: Monday, June 14, 2021 9:38 PM > > > > > > On Mon, Jun 14, 2021 at 03:09:31AM +, Tian, Kevin wrote: > > > > > > > If a de

RE: Plan for /dev/ioasid RFC v2

2021-06-15 Thread Tian, Kevin
> From: Alex Williamson > Sent: Wednesday, June 16, 2021 12:12 AM > > On Tue, 15 Jun 2021 02:31:39 + > "Tian, Kevin" wrote: > > > > From: Alex Williamson > > > Sent: Tuesday, June 15, 2021 12:28 AM > > > > > [...] > > > > IOASID. Today the group fd requires an IOASID before it hands out a

Re: Plan for /dev/ioasid RFC v2

2021-06-15 Thread Alex Williamson
On Tue, 15 Jun 2021 01:21:35 + "Tian, Kevin" wrote: > > From: Jason Gunthorpe > > Sent: Monday, June 14, 2021 9:38 PM > > > > On Mon, Jun 14, 2021 at 03:09:31AM +, Tian, Kevin wrote: > > > > > If a device can be always blocked from accessing memory in the IOMMU > > > before it's boun

Re: Plan for /dev/ioasid RFC v2

2021-06-15 Thread Alex Williamson
On Tue, 15 Jun 2021 02:31:39 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Tuesday, June 15, 2021 12:28 AM > > > [...] > > > IOASID. Today the group fd requires an IOASID before it hands out a > > > device_fd. With iommu_fd the device_fd will not allow IOCTLs until it > > > h

RE: Plan for /dev/ioasid RFC v2

2021-06-14 Thread Tian, Kevin
> From: Alex Williamson > Sent: Tuesday, June 15, 2021 12:28 AM > [...] > > IOASID. Today the group fd requires an IOASID before it hands out a > > device_fd. With iommu_fd the device_fd will not allow IOCTLs until it > > has a blocked DMA IOASID and is successefully joined to an iommu_fd. > > W

RE: Plan for /dev/ioasid RFC v2

2021-06-14 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Monday, June 14, 2021 9:38 PM > > On Mon, Jun 14, 2021 at 03:09:31AM +, Tian, Kevin wrote: > > > If a device can be always blocked from accessing memory in the IOMMU > > before it's bound to a driver or more specifically before the driver > > moves it to a new

RE: Plan for /dev/ioasid RFC v2

2021-06-14 Thread Tian, Kevin
> From: Alex Williamson > Sent: Monday, June 14, 2021 11:23 AM > [...] > > In the meantime, I'm thinking about another way whether group > > security can be enforced in the iommu layer to relax the uAPI design. > > If a device can be always blocked from accessing memory in the > > IOMMU before it

Re: Plan for /dev/ioasid RFC v2

2021-06-14 Thread Jason Gunthorpe
On Mon, Jun 14, 2021 at 10:28:14AM -0600, Alex Williamson wrote: > > To my mind it is these three things: > > > > 1. The device can only do DMA to memory put into its security context > > System memory or device memory, yes. > > Corollary: The IOMMU group defines the minimum set of devices wher

Re: Plan for /dev/ioasid RFC v2

2021-06-14 Thread Alex Williamson
On Mon, 14 Jun 2021 11:07:11 -0300 Jason Gunthorpe wrote: > On Sat, Jun 12, 2021 at 10:57:11AM -0600, Alex Williamson wrote: > > On Fri, 11 Jun 2021 22:28:46 -0300 > > Jason Gunthorpe wrote: > > > > > On Fri, Jun 11, 2021 at 01:38:28PM -0600, Alex Williamson wrote: > > > > > > > That's fin

Re: Plan for /dev/ioasid RFC v2

2021-06-14 Thread Jason Gunthorpe
On Sat, Jun 12, 2021 at 10:57:11AM -0600, Alex Williamson wrote: > On Fri, 11 Jun 2021 22:28:46 -0300 > Jason Gunthorpe wrote: > > > On Fri, Jun 11, 2021 at 01:38:28PM -0600, Alex Williamson wrote: > > > > > That's fine for a serial port, but not a device that can do DMA. > > > The entire point

Re: Plan for /dev/ioasid RFC v2

2021-06-14 Thread Jason Gunthorpe
On Mon, Jun 14, 2021 at 03:09:31AM +, Tian, Kevin wrote: > If a device can be always blocked from accessing memory in the IOMMU > before it's bound to a driver or more specifically before the driver > moves it to a new security context, then there is no need for VFIO > to track whether IOASIDf

Re: Plan for /dev/ioasid RFC v2

2021-06-13 Thread Alex Williamson
On Mon, 14 Jun 2021 03:09:31 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Saturday, June 12, 2021 5:39 AM > > > > On Fri, 11 Jun 2021 00:58:35 + > > "Tian, Kevin" wrote: > > > > > Hi, Alex, > > > > > > > From: Alex Williamson > > > > Sent: Thursday, June 10, 2021 11

RE: Plan for /dev/ioasid RFC v2

2021-06-13 Thread Tian, Kevin
> From: Alex Williamson > Sent: Saturday, June 12, 2021 5:39 AM > > On Fri, 11 Jun 2021 00:58:35 + > "Tian, Kevin" wrote: > > > Hi, Alex, > > > > > From: Alex Williamson > > > Sent: Thursday, June 10, 2021 11:39 PM > > > > > > On Wed, 9 Jun 2021 15:49:40 -0300 > > > Jason Gunthorpe wrote:

Re: Plan for /dev/ioasid RFC v2

2021-06-12 Thread Alex Williamson
On Fri, 11 Jun 2021 22:28:46 -0300 Jason Gunthorpe wrote: > On Fri, Jun 11, 2021 at 01:38:28PM -0600, Alex Williamson wrote: > > > That's fine for a serial port, but not a device that can do DMA. > > The entire point of vfio is to try to provide secure, DMA capable > > userspace drivers. If we

Re: Plan for /dev/ioasid RFC v2

2021-06-11 Thread Jason Gunthorpe
On Fri, Jun 11, 2021 at 01:38:28PM -0600, Alex Williamson wrote: > That's fine for a serial port, but not a device that can do DMA. > The entire point of vfio is to try to provide secure, DMA capable > userspace drivers. If we relax enforcement of that isolation we've > failed. I don't understan

Re: Plan for /dev/ioasid RFC v2

2021-06-11 Thread Alex Williamson
On Fri, 11 Jun 2021 00:58:35 + "Tian, Kevin" wrote: > Hi, Alex, > > > From: Alex Williamson > > Sent: Thursday, June 10, 2021 11:39 PM > > > > On Wed, 9 Jun 2021 15:49:40 -0300 > > Jason Gunthorpe wrote: > > > > > On Wed, Jun 09, 2021 at 10:27:22AM -0600, Alex Williamson wrote: > > >

Re: Plan for /dev/ioasid RFC v2

2021-06-11 Thread Alex Williamson
On Fri, 11 Jun 2021 13:45:29 -0300 Jason Gunthorpe wrote: > On Thu, Jun 10, 2021 at 09:38:42AM -0600, Alex Williamson wrote: > > > Opening the group is not the extent of the security check currently > > required, the group must be added to a container and an IOMMU model > > configured for the co

Re: Plan for /dev/ioasid RFC v2

2021-06-11 Thread Jason Gunthorpe
On Thu, Jun 10, 2021 at 09:38:42AM -0600, Alex Williamson wrote: > Opening the group is not the extent of the security check currently > required, the group must be added to a container and an IOMMU model > configured for the container *before* the user can get a devicefd. > Each devicefd creates

RE: Plan for /dev/ioasid RFC v2

2021-06-10 Thread Tian, Kevin
Hi, Alex, > From: Alex Williamson > Sent: Thursday, June 10, 2021 11:39 PM > > On Wed, 9 Jun 2021 15:49:40 -0300 > Jason Gunthorpe wrote: > > > On Wed, Jun 09, 2021 at 10:27:22AM -0600, Alex Williamson wrote: > > > > > > > It is a kernel decision, because a fundamental task of the kernel is >

Re: Plan for /dev/ioasid RFC v2

2021-06-10 Thread Alex Williamson
On Wed, 9 Jun 2021 15:49:40 -0300 Jason Gunthorpe wrote: > On Wed, Jun 09, 2021 at 10:27:22AM -0600, Alex Williamson wrote: > > > > > It is a kernel decision, because a fundamental task of the kernel is to > > > > ensure isolation between user-space tasks as good as it can. And if a > > > > devi

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Lu Baolu
On 6/9/21 8:39 PM, 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 +, Tian, Kevin wrote: - Device-centric (Jason) vs. group-centric (David) uAPI. David is not fully convinced yet. Based on discussion v2 will cont

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Jason Gunthorpe
On Wed, Jun 09, 2021 at 10:27:22AM -0600, Alex Williamson wrote: > > > It is a kernel decision, because a fundamental task of the kernel is to > > > ensure isolation between user-space tasks as good as it can. And if a > > > device assigned to one task can interfer with a device of another task >

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Alex Williamson
On Wed, 9 Jun 2021 10:15:32 -0600 Alex Williamson wrote: > On Wed, 9 Jun 2021 17:51:26 +0200 > Joerg Roedel wrote: > > > On Wed, Jun 09, 2021 at 12:00:09PM -0300, Jason Gunthorpe wrote: > > > Only *drivers* know what the actual device is going to do, devices do > > > not. Since the group does

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Alex Williamson
On Wed, 9 Jun 2021 17:51:26 +0200 Joerg Roedel wrote: > On Wed, Jun 09, 2021 at 12:00:09PM -0300, Jason Gunthorpe wrote: > > Only *drivers* know what the actual device is going to do, devices do > > not. Since the group doesn't have drivers it is the wrong layer to be > > making choices about how

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Joerg Roedel
On Wed, Jun 09, 2021 at 12:00:09PM -0300, Jason Gunthorpe wrote: > Only *drivers* know what the actual device is going to do, devices do > not. Since the group doesn't have drivers it is the wrong layer to be > making choices about how to configure the IOMMU. Groups don't carry how to configure IO

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Jason Gunthorpe
On Wed, Jun 09, 2021 at 03:32:34PM +0200, Joerg Roedel wrote: > > 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. Well exactly, that is the whole problem.

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Joerg Roedel
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. VF

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Jason Gunthorpe
On Wed, Jun 09, 2021 at 02:24:03PM +0200, Joerg Roedel wrote: > On Mon, Jun 07, 2021 at 02:58:18AM +, Tian, Kevin wrote: > > - Device-centric (Jason) vs. group-centric (David) uAPI. David is not > > fully > > convinced yet. Based on discussion v2 will continue to have ioasid uAPI > >

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Joerg Roedel
On Mon, Jun 07, 2021 at 02:58:18AM +, Tian, Kevin wrote: > - Device-centric (Jason) vs. group-centric (David) uAPI. David is not fully > convinced yet. Based on discussion v2 will continue to have ioasid uAPI > being device-centric (but it's fine for vfio to be group-centric). A new >

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Eric Auger
Hi Kevin, On 6/9/21 11:37 AM, Tian, Kevin wrote: >> From: Eric Auger >> Sent: Wednesday, June 9, 2021 4:15 PM >> >> Hi Kevin, >> >> On 6/7/21 4:58 AM, Tian, Kevin wrote: >>> Hi, all, >>> >>> We plan to work on v2 now, given many good comments already received >>> and substantial changes envisione

RE: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Tian, Kevin
> From: Leon Romanovsky > Sent: Wednesday, June 9, 2021 5:02 PM > > On Mon, Jun 07, 2021 at 02:58:18AM +, Tian, Kevin wrote: > > Hi, all, > > <...> > > > (Remaining opens in v1) > > <...> > > > - Device-centric (Jason) vs. group-centric (David) uAPI. David is not > > fully > > conv

RE: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Tian, Kevin
> From: Eric Auger > Sent: Wednesday, June 9, 2021 4:15 PM > > Hi Kevin, > > On 6/7/21 4:58 AM, Tian, Kevin wrote: > > Hi, all, > > > > We plan to work on v2 now, given many good comments already received > > and substantial changes envisioned. This is a very complex topic with > > many sub-thre

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Leon Romanovsky
On Mon, Jun 07, 2021 at 02:58:18AM +, Tian, Kevin wrote: > Hi, all, <...> > (Remaining opens in v1) <...> > - Device-centric (Jason) vs. group-centric (David) uAPI. David is not fully > convinced yet. Based on discussion v2 will continue to have ioasid uAPI > being device-centric

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Eric Auger
Hi Kevin, On 6/7/21 4:58 AM, Tian, Kevin wrote: > Hi, all, > > We plan to work on v2 now, given many good comments already received > and substantial changes envisioned. This is a very complex topic with > many sub-threads being discussed. To ensure that I didn't miss valuable > suggestions (and