Re: [PATCH v5 02/19] vfio: Refine vfio file kAPIs for KVM

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

On Mon, Feb 27, 2023 at 03:11:18AM -0800, Yi Liu wrote:
> This prepares for making the below kAPIs to accept both group file
> and device file instead of only vfio group file.
>
> bool vfio_file_enforced_coherent(struct file *file);
> void vfio_file_set_kvm(struct file *file, struct kvm *kvm);
>
> Besides the above change, vfio_file_is_valid() is added to check if a
> given file is a valid vfio file. It would be extended to check both
> vfio group file and vfio device file later.
>
> vfio_file_is_group() is kept to for the VFIO PCI hot reset path.
>
> 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 | 57 +++++++++++++++-------------------------
> drivers/vfio/vfio.h | 3 +++
> drivers/vfio/vfio_main.c | 45 +++++++++++++++++++++++++++++++
> include/linux/vfio.h | 1 +
> virt/kvm/vfio.c | 10 +++----
> 5 files changed, 75 insertions(+), 41 deletions(-)

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

Jason