Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-17 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Friday, February 17, 2023 11:59 PM > > On Fri, Feb 17, 2023 at 10:55:08AM +, Liu, Yi L wrote: > > > One more thinking on this. For a single device, my above reply is true. > > The device should have been fully-opened when its > GET_PCI_HOT_RESET_INFO > > and H

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-17 Thread Jason Gunthorpe
On Fri, Feb 17, 2023 at 10:55:08AM +, Liu, Yi L wrote: > One more thinking on this. For a single device, my above reply is true. > The device should have been fully-opened when its GET_PCI_HOT_RESET_INFO > and HOT_RESET path have been unblocked. However, when there are > multiple devices that

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-17 Thread Liu, Yi L
Hi Alex, Jason, > From: Liu, Yi L > Sent: Tuesday, February 14, 2023 3:19 PM > > > From: Liu, Yi L > > Sent: Tuesday, February 14, 2023 10:03 AM > > > > > From: Jason Gunthorpe > > > Sent: Tuesday, February 14, 2023 7:44 AM > > > > > > On Mon, Feb 13, 2023 at 07:13:36AM -0800, Yi Liu wrote: >

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-15 Thread Jason Gunthorpe
On Wed, Feb 15, 2023 at 10:19:35AM -0700, Alex Williamson wrote: > On Wed, 15 Feb 2023 13:04:13 -0400 > Jason Gunthorpe wrote: > > > On Wed, Feb 15, 2023 at 08:32:34AM -0700, Alex Williamson wrote: > > > > > We've discussed this with Paolo before and I believe the bar of proof > > > is not very

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-15 Thread Alex Williamson
On Wed, 15 Feb 2023 13:04:13 -0400 Jason Gunthorpe wrote: > On Wed, Feb 15, 2023 at 08:32:34AM -0700, Alex Williamson wrote: > > > We've discussed this with Paolo before and I believe the bar of proof > > is not very high. I suspect it's not a problem that the device itself > > is not yet acces

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-15 Thread Jason Gunthorpe
On Wed, Feb 15, 2023 at 08:32:34AM -0700, Alex Williamson wrote: > We've discussed this with Paolo before and I believe the bar of proof > is not very high. I suspect it's not a problem that the device itself > is not yet accessible, so long as the user can prove they have the > ability to access

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-15 Thread Alex Williamson
[Cc +Paolo] On Wed, 15 Feb 2023 10:46:34 -0400 Jason Gunthorpe wrote: > On Wed, Feb 15, 2023 at 02:43:20PM +, Liu, Yi L wrote: > > > From: Jason Gunthorpe > > > Sent: Wednesday, February 15, 2023 8:39 PM > > > > > > On Tue, Feb 14, 2023 at 02:02:37AM +, Liu, Yi L wrote: > > > > > Fro

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-15 Thread Jason Gunthorpe
On Wed, Feb 15, 2023 at 02:43:20PM +, Liu, Yi L wrote: > > From: Jason Gunthorpe > > Sent: Wednesday, February 15, 2023 8:39 PM > > > > On Tue, Feb 14, 2023 at 02:02:37AM +, Liu, Yi L wrote: > > > > From: Jason Gunthorpe > > > > Sent: Tuesday, February 14, 2023 7:44 AM > > > > > > > > On

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-15 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Wednesday, February 15, 2023 8:39 PM > > On Tue, Feb 14, 2023 at 02:02:37AM +, Liu, Yi L wrote: > > > From: Jason Gunthorpe > > > Sent: Tuesday, February 14, 2023 7:44 AM > > > > > > On Mon, Feb 13, 2023 at 07:13:36AM -0800, Yi Liu wrote: > > > > +static struc

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-15 Thread Jason Gunthorpe
On Tue, Feb 14, 2023 at 02:02:37AM +, Liu, Yi L wrote: > > From: Jason Gunthorpe > > Sent: Tuesday, February 14, 2023 7:44 AM > > > > On Mon, Feb 13, 2023 at 07:13:36AM -0800, Yi Liu wrote: > > > +static struct vfio_device *vfio_device_from_file(struct file *file) > > > +{ > > > + struct vfio

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-13 Thread Liu, Yi L
> From: Liu, Yi L > Sent: Tuesday, February 14, 2023 10:03 AM > > > From: Jason Gunthorpe > > Sent: Tuesday, February 14, 2023 7:44 AM > > > > On Mon, Feb 13, 2023 at 07:13:36AM -0800, Yi Liu wrote: > > > +static struct vfio_device *vfio_device_from_file(struct file *file) > > > +{ > > > + struc

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-13 Thread Liu, Yi L
> From: Alex Williamson > Sent: Tuesday, February 14, 2023 7:22 AM > > On Mon, 13 Feb 2023 07:13:36 -0800 > Yi Liu wrote: > > > This makes the vfio file kAPIs to accepte vfio device files, also a > > preparation for vfio device cdev support. > > > > For the kvm set with vfio device file, kvm po

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-13 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Tuesday, February 14, 2023 7:44 AM > > On Mon, Feb 13, 2023 at 07:13:36AM -0800, Yi Liu wrote: > > +static struct vfio_device *vfio_device_from_file(struct file *file) > > +{ > > + struct vfio_device_file *df = file->private_data; > > + > > + if (file->f_op !=

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-13 Thread Jason Gunthorpe
On Mon, Feb 13, 2023 at 07:13:36AM -0800, Yi Liu wrote: > +static struct vfio_device *vfio_device_from_file(struct file *file) > +{ > + struct vfio_device_file *df = file->private_data; > + > + if (file->f_op != &vfio_device_fops) > + return NULL; > + return df->device; > +}

Re: [Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-13 Thread Alex Williamson
On Mon, 13 Feb 2023 07:13:36 -0800 Yi Liu wrote: > This makes the vfio file kAPIs to accepte vfio device files, also a > preparation for vfio device cdev support. > > For the kvm set with vfio device file, kvm pointer is stored in struct > vfio_device_file, and use kvm_ref_lock to protect kvm se

[Intel-gfx] [PATCH v3 03/15] vfio: Accept vfio device file in the driver facing kAPI

2023-02-13 Thread Yi Liu
This makes the vfio file kAPIs to accepte vfio device files, also a preparation for vfio device cdev support. For the kvm set with vfio device file, kvm pointer is stored in struct vfio_device_file, and use kvm_ref_lock to protect kvm set and kvm pointer usage within VFIO. This kvm pointer will be