Re: [PATCH v5 01/19] vfio: Allocate per device file structure

Jason Gunthorpe
2023-02-27T18:46:44Z

On Mon, Feb 27, 2023 at 03:11:17AM -0800, Yi Liu wrote:
> This is preparation for adding vfio device cdev support. vfio device
> cdev requires:
> 1) a per device file memory to store the kvm pointer set by KVM. It will
> be propagated to vfio_device:kvm after the device cdev file is bound
> to an iommufd
> 2) a mechanism to block device access through device cdev fd before it
> is bound to an iommufd
>
> To address above requirements, this adds a per device file structure
> named vfio_device_file. For now, it's only a wrapper of struct vfio_device
> pointer. Other fields will be added to this per file structure in future
> commits.
>
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Reviewed-by: Eric Auger <eric.auger@redhat.com>
> ---
> drivers/vfio/group.c | 13 +++++++++++--
> drivers/vfio/vfio.h | 6 ++++++
> drivers/vfio/vfio_main.c | 31 ++++++++++++++++++++++++++-----
> 3 files changed, 43 insertions(+), 7 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason