Skip to content

iommu/amd: SVA Support (part 3) - refactor support for GCR3 table

Vasant Hegde linux-iommu 7 versions – Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest17 patches 1 replyApplied
  2. v617 patches 9 repliesSuperseded
  3. v517 patches 13 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v416 patches25 repliesSuperseded
v313 patches28 repliesSuperseded
v210 patches15 repliesSuperseded
v111 patches23 repliesSuperseded

Changes in v7 from the cover letter

- Added Reviewed-by tags
- Rebased on top of iommu/next branch
- iommu: Introduce iommu_group_mutex_assert()
Removed 'extern' from iommu_group_mutex_assert() declaration
- iommu/amd: Refactor helper function for setting / clearing GCR3 Followed-success oriented flow
- Minor update to patch 11/17 description

Patches in v7 Applied

#Subject and filesSizeRepliesApplied
1/17iommu/amd: Pass struct iommu_dev_data to set_dte_entry()drivers/iommu/amd/iommu.c+8 -100 replies
2/17iommu/amd: Enable Guest Translation before registering devicesdrivers/iommu/amd/init.c+3 -30 replies
3/17iommu/amd: Introduce get_amd_iommu_from_dev()drivers/iommu/amd/amd_iommu.h drivers/iommu/amd/iommu.c include/linux/iommu.h+44 -410 replies
4/17iommu/amd: Introduce struct protection_domain.pd_modedrivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/iommu.c+8 -00 replies
5/17iommu/amd: Introduce per-device GCR3 tabledrivers/iommu/amd/amd_iommu_types.h+7 -00 replies
6/17iommu/amd: Use protection_domain.flags to check page table modedrivers/iommu/amd/iommu.c+2 -20 replies
7/17iommu/amd: Add support for device based TLB invalidationdrivers/iommu/amd/amd_iommu.h drivers/iommu/amd/iommu.c+28 -00 replies
8/17iommu/amd: Rearrange GCR3 table setup codedrivers/iommu/amd/iommu.c+32 -320 replies
9/17iommu: Introduce iommu_group_mutex_assert()drivers/iommu/iommu.c include/linux/iommu.h+27 -00 replies
10/17iommu/amd: Refactor helper function for setting / clearing GCR3drivers/iommu/amd/amd_iommu.h drivers/iommu/amd/io_pgtable_v2.c drivers/iommu/amd/iommu.c+61 -830 replies
11/17iommu/amd: Refactor attaching / detaching device functionsdrivers/iommu/amd/iommu.c+27 -30 replies
12/17iommu/amd: Refactor protection_domain helper functionsdrivers/iommu/amd/iommu.c+3 -110 replies
13/17iommu/amd: Refactor GCR3 table helper functionsdrivers/iommu/amd/iommu.c+31 -220 replies
14/17iommu/amd: Remove unused flush pasid functionsdrivers/iommu/amd/amd_iommu.h drivers/iommu/amd/iommu.c+0 -1030 replies
15/17iommu/amd: Rearrange device flush codedrivers/iommu/amd/iommu.c+43 -490 replies
16/17iommu/amd: Remove unused GCR3 table parameters from struct protection_domaindrivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/iommu.c+1 -130 replies
17/17iommu/amd: Introduce per-device domain ID to fix potential TLB aliasing issuedrivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/iommu.c+64 -170 replies

Reviews trailers per patch

All 17 patches have a Reviewed-by or Acked-by.

PatchJason Gunthorpe
1/17R-b
2/17R-b
3/17R-b
4/17R-b
5/17R-b
6/17R-b
7/17R-b
8/17R-b
9/17R-b
10/17R-b
11/17R-b
12/17R-b
13/17R-b
14/17R-b
15/17R-b
16/17R-b
17/17R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 00/17] iommu/amd: SVA Support (part 3) - refactor support for GCR3 table

This is part 3 of the 4-part series to introduce Share Virtual Address (SVA) support, which focuses on refactoring GCR3 table. This moves GCR3 related information from protection domain structure to iommu_dev_data (per device) structure.

It contains the following enhancements:

* Patch 1 - 3:
Cleanup and introduce helper function

* Patch 4 - 13:
Introduce per device GCR3 table, invalidation based on per device and code refactoring. Also introduce iommu_group_mutex_assert.

* Patch 14 - 16:
Remove unused variable, rearrange functions to make it easy to maintain

* Patch 17:
Introduce per device domain ID.

This patch series is based on top of iommu/next branch (commit d2d00e15808).

This is also available at github :
https://github.com/AMDESE/linux/tree/iommu_sva_part3_v7_v6.8_rc2

Thanks Jason for reviewing previous versions and providing valuable feedbacks.

Changes from v6 -> v7:
- Added Reviewed-by tags
- Rebased on top of iommu/next branch
- iommu: Introduce iommu_group_mutex_assert()
Removed 'extern' from iommu_group_mutex_assert() declaration
- iommu/amd: Refactor helper function for setting / clearing GCR3 Followed-success oriented flow
- Minor update to patch 11/17 description

v6: https://lore.kernel.org/linux-iommu/[email protected]/T/#t

Changes from v5 -> v6:
- Moved per-device-domain-ID patch to end
- Added condition check for iommu_group_mutex_assert()
- Moving per-device-domain-id allocation/free to setup_gcr3_table()/free_gcr3_table
- Pass iommu to setup_gcr3_table instead of passing nid

v5: https://lore.kernel.org/linux-iommu/[email protected]/T/#t

Changes from v4 -> v5:
- Added get_amd_iommu_from_dev_data()
- pass gcr3_info instead of dev_data to setup/free_gcr3_table()
- Added path to EXPORT iommu_group_mutex_assert
- Moved dev_data->domid to gcr3_info->domid

v4: https://lore.kernel.org/linux-iommu/[email protected]/T/#t

Changes from v3 -> v4:
- Added new patch to enable IOMMU GT feature early
- Fixed dirty tracking path to use get_amd_iommu_from_dev()
- Fixed duplicate flush issue in do_attach() path
- Removed gcr3_info->giov variable. Instead we use domain page table mode to decide DTE[GIOV] bit.
- Free gcr3_table before calling set_dte_entry (otherwise there is a possibility of its setting up gcr3 table with glx 0)
- Adjusted gfp_t flag for GCR3 table allocation (GPF_ATOMIC -> GFP_KERNEL)
- Moved below patches from invalidation improvement series to this series
* Remove unused flush_pasid() related functions
(Originally it was part of Invalidation improvement series, I had to push it to
this series as set_gcr3() was still using __amd_iommu_flush_tlb()).
* Added patch to Rearrange device flush code

v3 : https://lore.kernel.org/linux-iommu/[email protected]/T/#t

Changes from v2 -> v3:
- Dropped "iommu/amd: Use struct protection_domain in helper functions" as flush related functions are already fixed and set_gcr3 related functions is reworked in this series.
- Removed moving to_pdomain() function from this series. It will be introduced in SVA series where it will be used.
- Added per device domain ID and per device invalidation functions
- Added functions to flush TLB for the given device
- Added Review-by tags

v2 : https://lore.kernel.org/linux-iommu/[email protected]/T/#t

Changes from v1 - v2:
- Dropped iommu_v2 module related support as newly introduced Part2 removed iommu_v2 module.
- Moved Patch 'Use struct protection_domain in helper functions' from Part1 to Part3
- Updated get_amd_iommu_from_dev() to retrieve iommu from device structure
- Removed 'PD_MODE_PT'

v1 : https://lore.kernel.org/linux-iommu/[email protected]/T/#t

Thank you,
Vasant / Suravee

Suravee Suthikulpanit (8):
iommu/amd: Introduce get_amd_iommu_from_dev()
iommu/amd: Introduce struct protection_domain.pd_mode iommu/amd: Introduce per-device GCR3 table
iommu/amd: Refactor helper function for setting / clearing GCR3 iommu/amd: Refactor attaching / detaching device functions iommu/amd: Refactor protection_domain helper functions iommu/amd: Refactor GCR3 table helper functions
iommu/amd: Remove unused GCR3 table parameters from struct protection_domain

Vasant Hegde (9):
iommu/amd: Pass struct iommu_dev_data to set_dte_entry() iommu/amd: Enable Guest Translation before registering devices iommu/amd: Use protection_domain.flags to check page table mode iommu/amd: Add support for device based TLB invalidation iommu/amd: Rearrange GCR3 table setup code
iommu: Introduce iommu_group_mutex_assert() iommu/amd: Remove unused flush pasid functions iommu/amd: Rearrange device flush code
iommu/amd: Introduce per-device domain ID to fix potential TLB
aliasing issue

 drivers/iommu/amd/amd_iommu.h       |  29 +-
 drivers/iommu/amd/amd_iommu_types.h |  26 +-
 drivers/iommu/amd/init.c            |   6 +-
 drivers/iommu/amd/io_pgtable_v2.c   |  21 +-
 drivers/iommu/amd/iommu.c           | 627 +++++++++++++---------------
 drivers/iommu/iommu.c               |  19 +
 include/linux/iommu.h               |  24 ++
 7 files changed, 376 insertions(+), 376 deletions(-)
Signature · 1 line
2.31.1