Message ID | 20230316121526.5644-1-yi.l.liu@intel.com (mailing list archive) |
---|---|
Headers | show |
Series | vfio: Make emulated devices prepared for vfio device cdev | expand |
> -----Original Message----- > From: Liu, Yi L <yi.l.liu@intel.com> > Sent: Thursday, March 16, 2023 8:15 PM > > The .bind_iommufd op of vfio emulated devices are either empty or does > nothing. This is different with the vfio physical devices, to add vfio device > cdev, need to make them act the same. > > This series first makes the .bind_iommufd op of vfio emulated devices to > create iommufd_access, this introduces a new iommufd API. Then let the > driver that does not provide .bind_iommufd op to use the vfio emulated > iommufd op set. This makes all vfio device drivers have consistent iommufd > operations, which is good for adding new device uAPIs in the device cdev > series. > > Change log: > > v2: > - Add r-b from Kevin and Jason > - Refine patch 01 per comments from Jason and Kevin > > v1: https://lore.kernel.org/kvm/20230308131340.459224-1-yi.l.liu@intel.com/ > > Thanks, > Yi Liu > > Nicolin Chen (1): > iommufd: Create access in vfio_iommufd_emulated_bind() > > Yi Liu (4): > vfio-iommufd: No need to record iommufd_ctx in vfio_device > vfio-iommufd: Make vfio_iommufd_emulated_bind() return > iommufd_access > ID > vfio/mdev: Uses the vfio emulated iommufd ops set in the mdev sample > drivers > vfio: Check the presence for iommufd callbacks in > __vfio_register_dev() > > drivers/iommu/iommufd/device.c | 57 ++++++++++++++++++++------------ > drivers/iommu/iommufd/selftest.c | 8 +++-- > drivers/vfio/iommufd.c | 39 +++++++++++----------- > drivers/vfio/vfio_main.c | 5 +-- > include/linux/iommufd.h | 5 +-- > include/linux/vfio.h | 1 - > samples/vfio-mdev/mbochs.c | 3 ++ > samples/vfio-mdev/mdpy.c | 3 ++ > samples/vfio-mdev/mtty.c | 3 ++ > 9 files changed, 76 insertions(+), 48 deletions(-) > > -- > 2.34.1 Verified this series by test the vfio-mdev with mtty emulated device, it passed VFIO legacy mode / compat mode / cdev mode, including negative tests. Tested-by: Terrence Xu <terrence.xu@intel.com>