mbox series

[v5,0/4] Add set_dev_data and unset_dev_data support

Message ID cover.1690487690.git.nicolinc@nvidia.com (mailing list archive)
Headers show
Series Add set_dev_data and unset_dev_data support | expand

Message

Nicolin Chen July 27, 2023, 9:09 p.m. UTC
Changelog
v5:
 * Renamed ioctls to IOMMU_SET_DEV_DATA and IOMMU_UNSET_DEV_DATA
 * Renamed data structs to iommu_set_dev_data and IOMMU_UNSET_DEV_DATA
 * Added missing TEST_LENGTH for those two new data structures
v4:
 https://lore.kernel.org/all/cover.1683593949.git.nicolinc@nvidia.com/
 * Rebased on top of v6.4-rc1, and iommufd_nesting-v2 (candidate)
 * Dropped WARN_ON in the destroy()
v3:
 https://lore.kernel.org/all/cover.1682234302.git.nicolinc@nvidia.com/
 * Reverted the data in VFIO BIND ioctl to a set of new iommufd ioctls
 * Replaced the iommu_device_data_size array with a dev_user_data_len
   variable in the iommu_ops structure.
 * Added has_dev_data check and locking protection
 * Added selftest coverage
v2:
 https://lore.kernel.org/all/cover.1681976394.git.nicolinc@nvidia.com/
 * Integrated the uAPI into VFIO_DEVICE_BIND_IOMMUFD call
 * Renamed the previous set_rid_user to set_dev_data, to decouple from
   the PCI regime.
v1:
 https://lore.kernel.org/all/cover.1680762112.git.nicolinc@nvidia.com/

This is a pair of new uAPI/ops for user space to set an iommu specific
device data for a passthrough device. This is primarily used by SMMUv3
driver for now, to link the vSID and the pSID of a device that's behind
the SMMU. The link (lookup table) will be used to verify any ATC_INV
command from the user space for that device, and then replace the SID
field (virtual SID) with the corresponding physical SID.

This series is available on Github:
https://github.com/nicolinc/iommufd/commits/set_dev_data-v5

Thanks!
Nicolin

Nicolin Chen (4):
  iommu: Add set/unset_dev_user_data ops
  iommufd: Add IOMMUFD_CMD_SET_DEV_DATA and IOMMUFD_CMD_UNSET_DEV_DATA
  iommufd/selftest: Add IOMMU_TEST_OP_DEV_CHECK_DATA
  iommufd/selftest: Add coverage for IOMMU_SET/UNSET_DEV_DATA

 drivers/iommu/iommufd/device.c                |  2 +
 drivers/iommu/iommufd/iommufd_private.h       |  1 +
 drivers/iommu/iommufd/iommufd_test.h          | 15 ++++
 drivers/iommu/iommufd/main.c                  | 85 +++++++++++++++++++
 drivers/iommu/iommufd/selftest.c              | 42 +++++++++
 include/linux/iommu.h                         | 13 +++
 include/uapi/linux/iommufd.h                  | 32 +++++++
 tools/testing/selftests/iommu/iommufd.c       | 22 +++++
 tools/testing/selftests/iommu/iommufd_utils.h | 59 +++++++++++++
 9 files changed, 271 insertions(+)