vfio/pci: Use the struct file as the handle not the vfio_group
authorJason Gunthorpe <jgg@nvidia.com>
Wed, 4 May 2022 19:14:46 +0000 (16:14 -0300)
committerAlex Williamson <alex.williamson@redhat.com>
Fri, 13 May 2022 16:14:20 +0000 (10:14 -0600)
commit6a985ae80befcf2c00e7c889336bfe9e9739e2ef
treef6dbc8c708c963024e3ff914969024814edbc9bd
parent3e5449d5f954f537522906dfcb6a76e2b035521f
vfio/pci: Use the struct file as the handle not the vfio_group

VFIO PCI does a security check as part of hot reset to prove that the user
has permission to manipulate all the devices that will be impacted by the
reset.

Use a new API vfio_file_has_dev() to perform this security check against
the struct file directly and remove the vfio_group from VFIO PCI.

Since VFIO PCI was the last user of vfio_group_get_external_user() and
vfio_group_put_external_user() remove it as well.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/8-v3-f7729924a7ea+25e33-vfio_kvm_no_group_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci_core.c
drivers/vfio/vfio.c
include/linux/vfio.h