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@xxxxxxxxx> > Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> > Reviewed-by: Eric Auger <eric.auger@xxxxxxxxxx> > --- > 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@xxxxxxxxxx> Jason