linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] iommufd support pasid attach/replace
@ 2023-11-27  6:34 Yi Liu
  2023-11-27  6:34 ` [PATCH 1/8] iommu: Introduce a replace API for device pasid Yi Liu
                   ` (7 more replies)
  0 siblings, 8 replies; 36+ messages in thread
From: Yi Liu @ 2023-11-27  6:34 UTC (permalink / raw)
  To: joro, alex.williamson, jgg, kevin.tian, robin.murphy, baolu.lu
  Cc: cohuck, eric.auger, nicolinc, kvm, mjrosato, chao.p.peng,
	yi.l.liu, yi.y.sun, peterx, jasowang, shameerali.kolothum.thodi,
	lulu, suravee.suthikulpanit, iommu, linux-kernel, linux-kselftest,
	zhenzhong.duan, joao.m.martins, xin.zeng, yan.y.zhao

PASID (Process Address Space ID) is a PCIe extension to tag the DMA
transactions out of a physical device, and most modern IOMMU hardware
have supported PASID granular address translation. So a PASID-capable
device can be attached to multiple hwpts (a.k.a. domains), each attachment
is tagged with a pasid.

This series first adds a missing iommu API to replace domain for a pasid,
then adds iommufd APIs for device drivers to attach/replace/detach pasid
to/from hwpt per userspace's request, and adds selftest to validate the
iommufd APIs.

pasid attach/replace is mandatory on Intel VT-d given the PASID table
locates in the physical address space hence must be managed by the kernel,
both for supporting vSVA and coming SIOV. But it's optional on ARM/AMD
which allow configuring the PASID/CD table either in host physical address
space or nested on top of an GPA address space. This series only add VT-d
support as the minimal requirement.

Complete code can be found in below link:

https://github.com/yiliu1765/iommufd/tree/iommufd_pasid

Change log:

v1:
 - Implemnet iommu_replace_device_pasid() to fall back to the original domain
   if this replacement failed (Kevin)
 - Add check in do_attach() to check corressponding attach_fn per the pasid value.

rfc: https://lore.kernel.org/linux-iommu/20230926092651.17041-1-yi.l.liu@intel.com/

Regards,
	Yi Liu

Kevin Tian (1):
  iommufd: Support attach/replace hwpt per pasid

Lu Baolu (2):
  iommu: Introduce a replace API for device pasid
  iommu/vt-d: Add set_dev_pasid callback for nested domain

Yi Liu (5):
  iommufd: replace attach_fn with a structure
  iommufd/selftest: Add set_dev_pasid and remove_dev_pasid in mock iommu
  iommufd/selftest: Add a helper to get test device
  iommufd/selftest: Add test ops to test pasid attach/detach
  iommufd/selftest: Add coverage for iommufd pasid attach/detach

 drivers/iommu/intel/nested.c                  |  47 +++++
 drivers/iommu/iommu-priv.h                    |   2 +
 drivers/iommu/iommu.c                         |  82 ++++++--
 drivers/iommu/iommufd/Makefile                |   1 +
 drivers/iommu/iommufd/device.c                |  50 +++--
 drivers/iommu/iommufd/iommufd_private.h       |  23 +++
 drivers/iommu/iommufd/iommufd_test.h          |  24 +++
 drivers/iommu/iommufd/pasid.c                 | 138 ++++++++++++++
 drivers/iommu/iommufd/selftest.c              | 176 ++++++++++++++++--
 include/linux/iommufd.h                       |   6 +
 tools/testing/selftests/iommu/iommufd.c       | 172 +++++++++++++++++
 .../selftests/iommu/iommufd_fail_nth.c        |  28 ++-
 tools/testing/selftests/iommu/iommufd_utils.h |  78 ++++++++
 13 files changed, 785 insertions(+), 42 deletions(-)
 create mode 100644 drivers/iommu/iommufd/pasid.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2024-03-21 13:54 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-27  6:34 [PATCH 0/8] iommufd support pasid attach/replace Yi Liu
2023-11-27  6:34 ` [PATCH 1/8] iommu: Introduce a replace API for device pasid Yi Liu
2024-01-15 17:19   ` Jason Gunthorpe
2024-03-10 13:05     ` Yi Liu
2024-03-11  9:26       ` Tian, Kevin
2024-03-12  3:07         ` Yi Liu
2024-03-13  3:13           ` Baolu Lu
2024-03-13  8:11             ` Yi Liu
2024-03-18 16:52               ` Jason Gunthorpe
2024-03-19  7:29                 ` Yi Liu
2024-03-20 12:38                   ` Jason Gunthorpe
2024-03-21  6:16                     ` Yi Liu
2024-03-21 11:26                       ` Yi Liu
2024-03-21 12:20                         ` Jason Gunthorpe
2024-03-21 13:58                           ` Yi Liu
2023-11-27  6:34 ` [PATCH 2/8] iommufd: replace attach_fn with a structure Yi Liu
2023-11-27  6:34 ` [PATCH 3/8] iommufd: Support attach/replace hwpt per pasid Yi Liu
2024-01-15 17:24   ` Jason Gunthorpe
2024-01-16  1:18     ` Tian, Kevin
2024-01-16 12:57       ` Jason Gunthorpe
2024-01-17  4:17         ` Tian, Kevin
2024-01-17  8:24           ` Yi Liu
2024-01-17 12:56             ` Jason Gunthorpe
2024-01-18  9:28               ` Yi Liu
2024-01-18 13:38                 ` Jason Gunthorpe
2024-01-19 10:15                   ` Yi Liu
2023-11-27  6:34 ` [PATCH 4/8] iommufd/selftest: Add set_dev_pasid and remove_dev_pasid in mock iommu Yi Liu
2023-11-27  6:34 ` [PATCH 5/8] iommufd/selftest: Add a helper to get test device Yi Liu
2023-11-27  6:34 ` [PATCH 6/8] iommufd/selftest: Add test ops to test pasid attach/detach Yi Liu
2023-11-27  6:34 ` [PATCH 7/8] iommufd/selftest: Add coverage for iommufd " Yi Liu
2023-11-27  6:34 ` [PATCH 8/8] iommu/vt-d: Add set_dev_pasid callback for nested domain Yi Liu
2023-12-14  2:55   ` Yang, Weijiang
2023-12-14 13:33     ` Baolu Lu
2023-12-15  0:37       ` Yang, Weijiang
2024-01-15 17:22   ` Jason Gunthorpe
2024-01-17  8:20     ` Baolu Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).