kernel-hacking-2024-linux-s.../drivers/vfio
Yi Liu 5c8d3d93f6 vfio: Refactor vfio_device open and close
This refactor makes the vfio_device_open() to accept device, iommufd_ctx
pointer and kvm pointer. These parameters are generic items in today's
group path and future device cdev path. Caller of vfio_device_open()
should take care the necessary protections. e.g. the current group path
need to hold the group_lock to ensure the iommufd_ctx and kvm pointer are
valid.

This refactor also wraps the group spefcific codes in the device open and
close paths to be paired helpers like:

- vfio_device_group_open/close(): call vfio_device_open/close()
- vfio_device_group_use/unuse_iommu(): this pair is container specific.
				       iommufd vs. container is selected
				       in vfio_device_first_open().

Such helpers are supposed to be moved to group.c. While iommufd related
codes will be kept in the generic helpers since future device cdev path
also need to handle iommufd.

Link: https://lore.kernel.org/r/20221201145535.589687-8-yi.l.liu@intel.com
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Tested-by: Lixiao Yang <lixiao.yang@intel.com>
Tested-by: Yu He <yu.he@intel.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2022-12-05 08:56:01 -04:00
..
fsl-mc vfio-iommufd: Support iommufd for physical VFIO devices 2022-12-02 11:52:03 -04:00
mdev vfio/mdev: add mdev available instance checking to the core 2022-10-04 12:06:58 -06:00
pci Merge tag 'v6.1-rc7' into iommufd.git for-next 2022-12-02 12:04:39 -04:00
platform vfio-iommufd: Support iommufd for physical VFIO devices 2022-12-02 11:52:03 -04:00
container.c vfio: Move container related MODULE_ALIAS statements into container.c 2022-12-02 11:52:04 -04:00
iommufd.c vfio-iommufd: Support iommufd for emulated VFIO devices 2022-12-02 11:52:03 -04:00
iova_bitmap.c vfio: Add an IOVA bitmap support 2022-09-08 12:59:00 -06:00
Kconfig vfio: Make vfio_container optionally compiled 2022-12-02 11:52:04 -04:00
Makefile vfio: Make vfio_container optionally compiled 2022-12-02 11:52:04 -04:00
vfio.h vfio: Make vfio_container optionally compiled 2022-12-02 11:52:04 -04:00
vfio_iommu_spapr_tce.c
vfio_iommu_type1.c Merge branches 'apple/dart', 'arm/mediatek', 'arm/omap', 'arm/smmu', 'virtio', 'x86/vt-d', 'x86/amd' and 'core' into next 2022-09-26 15:52:31 +02:00
vfio_main.c vfio: Refactor vfio_device open and close 2022-12-05 08:56:01 -04:00
vfio_spapr_eeh.c
virqfd.c