|
|
Subscribe / Log in / New account

iommufd support pasid attach/replace

From:  Yi Liu <yi.l.liu-AT-intel.com>
To:  joro-AT-8bytes.org, alex.williamson-AT-redhat.com, jgg-AT-nvidia.com, kevin.tian-AT-intel.com, robin.murphy-AT-arm.com, baolu.lu-AT-linux.intel.com
Subject:  [RFC 0/8] iommufd support pasid attach/replace
Date:  Tue, 26 Sep 2023 02:26:43 -0700
Message-ID:  <20230926092651.17041-1-yi.l.liu@intel.com>
Cc:  cohuck-AT-redhat.com, eric.auger-AT-redhat.com, nicolinc-AT-nvidia.com, kvm-AT-vger.kernel.org, mjrosato-AT-linux.ibm.com, chao.p.peng-AT-linux.intel.com, yi.l.liu-AT-intel.com, yi.y.sun-AT-linux.intel.com, peterx-AT-redhat.com, jasowang-AT-redhat.com, shameerali.kolothum.thodi-AT-huawei.com, lulu-AT-redhat.com, suravee.suthikulpanit-AT-amd.com, iommu-AT-lists.linux.dev, linux-kernel-AT-vger.kernel.org, linux-kselftest-AT-vger.kernel.org, zhenzhong.duan-AT-intel.com, joao.m.martins-AT-oracle.com
Archive-link:  Article

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
devices 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

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                         |  73 ++++++--
 drivers/iommu/iommufd/Makefile                |   1 +
 drivers/iommu/iommufd/device.c                |  42 +++--
 drivers/iommu/iommufd/iommufd_private.h       |  16 ++
 drivers/iommu/iommufd/iommufd_test.h          |  24 +++
 drivers/iommu/iommufd/pasid.c                 | 152 ++++++++++++++++
 drivers/iommu/iommufd/selftest.c              | 158 ++++++++++++++--
 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, 756 insertions(+), 43 deletions(-)
 create mode 100644 drivers/iommu/iommufd/pasid.c

-- 
2.34.1



Copyright © 2023, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds