Re: [Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-26 Thread Yan Zhao
On Fri, Feb 24, 2023 at 10:31:35AM -0400, Jason Gunthorpe wrote: > On Fri, Feb 24, 2023 at 12:58:22PM +0800, Yan Zhao wrote: > > On Wed, Feb 22, 2023 at 08:59:51AM -0400, Jason Gunthorpe wrote: > > > On Wed, Feb 22, 2023 at 07:44:12AM +, Liu, Yi L wrote: > > > > > From: Tian, Kevin > > > > > S

Re: [Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-24 Thread Jason Gunthorpe
On Fri, Feb 24, 2023 at 12:58:22PM +0800, Yan Zhao wrote: > On Wed, Feb 22, 2023 at 08:59:51AM -0400, Jason Gunthorpe wrote: > > On Wed, Feb 22, 2023 at 07:44:12AM +, Liu, Yi L wrote: > > > > From: Tian, Kevin > > > > Sent: Wednesday, February 22, 2023 3:40 PM > > > > > > > > > From: Liu, Yi

Re: [Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-23 Thread Yan Zhao
On Wed, Feb 22, 2023 at 08:59:51AM -0400, Jason Gunthorpe wrote: > On Wed, Feb 22, 2023 at 07:44:12AM +, Liu, Yi L wrote: > > > From: Tian, Kevin > > > Sent: Wednesday, February 22, 2023 3:40 PM > > > > > > > From: Liu, Yi L > > > > Sent: Tuesday, February 21, 2023 11:48 AM > > > > > > > > +

Re: [Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-22 Thread Jason Gunthorpe
On Wed, Feb 22, 2023 at 07:44:12AM +, Liu, Yi L wrote: > > From: Tian, Kevin > > Sent: Wednesday, February 22, 2023 3:40 PM > > > > > From: Liu, Yi L > > > Sent: Tuesday, February 21, 2023 11:48 AM > > > > > > + > > > +void vfio_device_cdev_close(struct vfio_device_file *df) > > > +{ > > > +

Re: [Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-22 Thread Liu, Yi L
> From: Zhao, Yan Y > Sent: Wednesday, February 22, 2023 3:53 PM > > On Mon, Feb 20, 2023 at 07:48:09PM -0800, Yi Liu wrote: > > This adds ioctl for userspace to bind device cdev fd to iommufd. > > > > VFIO_DEVICE_BIND_IOMMUFD: bind device to an iommufd, hence gain > DMA > >

Re: [Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-22 Thread Yan Zhao
On Mon, Feb 20, 2023 at 07:48:09PM -0800, Yi Liu wrote: > This adds ioctl for userspace to bind device cdev fd to iommufd. > > VFIO_DEVICE_BIND_IOMMUFD: bind device to an iommufd, hence gain DMA > control provided by the iommufd. open_device >

Re: [Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-21 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Wednesday, February 22, 2023 3:44 PM > > > From: Tian, Kevin > > Sent: Wednesday, February 22, 2023 3:40 PM > > > > > From: Liu, Yi L > > > Sent: Tuesday, February 21, 2023 11:48 AM > > > > > > + > > > +void vfio_device_cdev_close(struct vfio_device_file *df) > > > +{

Re: [Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-21 Thread Liu, Yi L
> From: Tian, Kevin > Sent: Wednesday, February 22, 2023 3:40 PM > > > From: Liu, Yi L > > Sent: Tuesday, February 21, 2023 11:48 AM > > > > + > > +void vfio_device_cdev_close(struct vfio_device_file *df) > > +{ > > + struct vfio_device *device = df->device; > > + > > + mutex_lock(&device->d

Re: [Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-21 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Tuesday, February 21, 2023 11:48 AM > > + > +void vfio_device_cdev_close(struct vfio_device_file *df) > +{ > + struct vfio_device *device = df->device; > + > + mutex_lock(&device->dev_set->lock); > + if (!smp_load_acquire(&df->access_granted)) { there is no

[Intel-gfx] [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

2023-02-20 Thread Yi Liu
This adds ioctl for userspace to bind device cdev fd to iommufd. VFIO_DEVICE_BIND_IOMMUFD: bind device to an iommufd, hence gain DMA control provided by the iommufd. open_device op is called after bind_iommufd op.