Skip to content

iommu/amd: Introduce Nested Translation support

Suravee Suthikulpanit linux-iommu lkml 6 versions – Applied

Status from this message: Applied, thanks Suravee.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest13 patches 3 repliesApplied
  2. v514 patches 24 repliesSuperseded
  3. v416 patches 26 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v315 patches11 repliesSuperseded
v212 patches29 repliesSuperseded
v18 patches16 repliesSuperseded

Changes in v6 from the cover letter · 20 lines

(https://lore.kernel.org/linux-iommu/[email protected]/)
* This series is rebased on top of
Git repo: git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git
Branch: next
Commit: c7fe9384c85d ("amd/iommu: Make protection domain ID functions non-static")

* Rebase on top of Linux v6.19-rc1, and adopt the new gen_pt framework.

* Remove patch "iommu/amd: Make amd_iommu_pdom_id_alloc() non-static" since it has been accepted from another series.

* Remove patch "iommu/amd: Make amd_iommu_pdom_id_free() non-static" since it has been accepted from another series.

* Patch 1:
- Rebase "[PATCH v5] iommu/amd: Add support for hw_info for iommu capability query"
(https://lore.kernel.org/linux-iommu/[email protected]/)

* Patch 10:
- Fix race condition using xa_lock()/xa_unlock() per Nicolin comment
- Introduce gdom_info_load_or_alloc_locked() per Jason suggestion

* Patch 12:
- Rework logic for set_dte_v1() / amd_iommu_set_dte_v1()
- Remove check for snp enabled and domid=0 since no longer applicable.

* Patch 13:
- Move amd_iommu_update_dte() to nested_attach_device().
- Add WARN_ON for PASID enabled.

Patches in v6 Applied

#Subject and filesSizeRepliesApplied
1/13iommu/amd: Add support for hw_info for iommu capability querydrivers/iommu/amd/Kconfig drivers/iommu/amd/Makefile drivers/iommu/amd/iommu.c +3 more+87 -00 replies
2/13iommu/amd: Rename DEV_DOMID_MASK to DTE_DOMID_MASKdrivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/init.c drivers/iommu/amd/iommu.c+3 -30 replies
3/13iommu/amd: Make amd_iommu_make_clear_dte() non-static inlinedrivers/iommu/amd/amd_iommu.h drivers/iommu/amd/iommu.c+10 -110 replies
4/13iommu/amd: Introduce helper function amd_iommu_update_dte()drivers/iommu/amd/amd_iommu.h drivers/iommu/amd/iommu.c+22 -60 replies
5/13iommufd: Introduce data struct for AMD nested domain allocationinclude/uapi/linux/iommufd.h+11 -00 replies
6/13iommu/amd: Always enable GCR3TRPMode when supported.drivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/init.c+10 -00 replies
7/13iommu/amd: Add support for nest parent domain allocationdrivers/iommu/amd/iommu.c+23 -30 replies
8/13iommu/amd: Introduce struct amd_iommu_viommudrivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/iommu.c drivers/iommu/amd/iommufd.c +1 more+29 -00 replies
9/13iommu/amd: Add support for nested domain allocationdrivers/iommu/amd/Makefile drivers/iommu/amd/amd_iommu.h drivers/iommu/amd/amd_iommu_types.h +1 more+129 -10 replies
10/13iommu/amd: Introduce gDomID-to-hDomID Mapping and handle parent domain invalidationdrivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/iommu.c drivers/iommu/amd/iommufd.c +1 more+203 -01 reply
11/13iommu/amd: Refactor persistent DTE bits programming into amd_iommu_make_clear_dte()drivers/iommu/amd/amd_iommu.h drivers/iommu/amd/iommu.c+13 -110 replies
12/13iommu/amd: Refactor logic to program the host page table in DTEdrivers/iommu/amd/amd_iommu.h drivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/iommu.c+82 -730 replies
13/13iommu/amd: Add support for nested domain attach/detachdrivers/iommu/amd/nested.c+73 -01 reply

Reviews trailers per patch

12 of 13 patches have a Reviewed-by or Acked-by.

PatchNicolin ChenVasant HegdeJason Gunthorpe
1/13R-b R-b R-b
2/13R-b R-b R-b
3/13R-b R-b R-b
4/13R-b
5/13R-b R-b R-b
6/13R-b R-b
7/13R-b R-b
8/13R-b R-b
9/13R-b R-b
10/13
11/13R-b R-b
12/13R-b
13/13R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v6 thread

Cover letter [PATCH v6 00/13] iommu/amd: Introduce Nested Translation support

This series introduces support for AMD IOMMU nested page table translation with the host (v1) and guest (v2) page tables.

In this mode, the AMD IOMMU driver configures the Device Table Entry (DTE) with host page table root pointer, which is configured by allocating domain with page table type IOMMU_HWPT_ALLOC_NEST_PARENT.

The guest page tables and Guest CR3 (GCR3) tables are managed by Guest OS, and stored in the guest DTE (gDTE) in guest memory. VMM is responsible for passing gDTE information to the host IOMMU driver using struct iommu_hwpt_amd_guest when allocating a domain type IOMMU_DOMAIN_NESTED. Then, the gDTE is parsed and program onto host DTE by the AMD IOMMU driver.

In addition, this series introduces base code for IOMMUFD vIOMMU for AMD IOMMU, and implements vIOMMU-based nested domain allocation interface. The struct nested_domain to store nested domain information, and set_dte_nested() helper function to handle DTE programing for the nested domain.

The series is separated into two parts:
* Patch 1 adds support for hw_info for AMD IOMMU
* Patch 2-4 are preparatory patches.
* Patch 5-13 implement nested translation support

Please note that this is a preparatory series for nested translation w/ AMD vIOMMU support. Currently, the amd_iommu_alloc_domain_nested() has not been hooked with the struct iommufd_viommu_ops.alloc_domain_nested. This will be fully enabled in subsequent series, which will introduce the support for IOMMUFD vIOMMU for AMD.

Changes from V5:
(https://lore.kernel.org/linux-iommu/[email protected]/)
* This series is rebased on top of
Git repo: git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git
Branch: next
Commit: c7fe9384c85d ("amd/iommu: Make protection domain ID functions non-static")

* Rebase on top of Linux v6.19-rc1, and adopt the new gen_pt framework.

* Remove patch "iommu/amd: Make amd_iommu_pdom_id_alloc() non-static" since it has been accepted from another series.

* Remove patch "iommu/amd: Make amd_iommu_pdom_id_free() non-static" since it has been accepted from another series.

* Patch 1:
- Rebase "[PATCH v5] iommu/amd: Add support for hw_info for iommu capability query"
(https://lore.kernel.org/linux-iommu/[email protected]/)

* Patch 10:
- Fix race condition using xa_lock()/xa_unlock() per Nicolin comment
- Introduce gdom_info_load_or_alloc_locked() per Jason suggestion

* Patch 12:
- Rework logic for set_dte_v1() / amd_iommu_set_dte_v1()
- Remove check for snp enabled and domid=0 since no longer applicable.

* Patch 13:
- Move amd_iommu_update_dte() to nested_attach_device().
- Add WARN_ON for PASID enabled.

Thanks,
Suravee

Suravee Suthikulpanit (13):
iommu/amd: Add support for hw_info for iommu capability query iommu/amd: Rename DEV_DOMID_MASK to DTE_DOMID_MASK iommu/amd: Make amd_iommu_make_clear_dte() non-static inline iommu/amd: Introduce helper function amd_iommu_update_dte()
iommufd: Introduce data struct for AMD nested domain allocation iommu/amd: Always enable GCR3TRPMode when supported. iommu/amd: Add support for nest parent domain allocation iommu/amd: Introduce struct amd_iommu_viommu
iommu/amd: Add support for nested domain allocation iommu/amd: Introduce gDomID-to-hDomID Mapping and handle parent domain
invalidation
iommu/amd: Refactor persistent DTE bits programming into
amd_iommu_make_clear_dte()
iommu/amd: Refactor logic to program the host page table in DTE iommu/amd: Add support for nested domain attach/detach

 drivers/iommu/amd/Kconfig           |  10 +
 drivers/iommu/amd/Makefile          |   1 +
 drivers/iommu/amd/amd_iommu.h       |  33 ++++
 drivers/iommu/amd/amd_iommu_types.h |  48 ++++-
 drivers/iommu/amd/init.c            |  10 +-
 drivers/iommu/amd/iommu.c           | 264 +++++++++++++++----------
 drivers/iommu/amd/iommufd.c         |  78 ++++++++
 drivers/iommu/amd/iommufd.h         |  20 ++
 drivers/iommu/amd/nested.c          | 294 ++++++++++++++++++++++++++++
 include/uapi/linux/iommufd.h        |  39 ++++
 10 files changed, 692 insertions(+), 105 deletions(-)
 create mode 100644 drivers/iommu/amd/iommufd.c
 create mode 100644 drivers/iommu/amd/iommufd.h
 create mode 100644 drivers/iommu/amd/nested.c
Signature · 1 line
2.34.1