Skip to content

Add set_dev_data and unset_dev_data support

Nicolin Chen linux-arm-kernel linux-iommu lkml 5 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 0 repliesNew
  2. v4 RFC4 patches 0 repliesSuperseded
  3. v3 RFC4 patches 2 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 RFC3 patches11 repliesSuperseded
v1 RFC3 patches0 repliesSuperseded

Changes in v5 from the cover letter

* 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

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4iommu: Add set/unset_dev_user_data opsinclude/linux/iommu.h+13 -00 replies
2/4iommufd: Add IOMMUFD_CMD_SET_DEV_DATA and IOMMUFD_CMD_UNSET_DEV_DATAdrivers/iommu/iommufd/device.c drivers/iommu/iommufd/iommufd_private.h drivers/iommu/iommufd/main.c +1 more+120 -00 replies
3/4iommufd/selftest: Add IOMMU_TEST_OP_DEV_CHECK_DATAdrivers/iommu/iommufd/iommufd_test.h drivers/iommu/iommufd/selftest.c+57 -00 replies
4/4iommufd/selftest: Add coverage for IOMMU_SET/UNSET_DEV_DATAtools/testing/selftests/iommu/iommufd.c tools/testing/selftests/iommu/iommufd_utils.h+81 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 0/4] Add set_dev_data and unset_dev_data support

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/[email protected]/
* Rebased on top of v6.4-rc1, and iommufd_nesting-v2 (candidate)
* Dropped WARN_ON in the destroy()
v3:
https://lore.kernel.org/all/[email protected]/
* 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/[email protected]/
* 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/[email protected]/

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(+)
Signature · 1 line
2.41.0