Skip to content

Improve TLB invalidation logic

Vasant Hegde linux-iommu 2 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. v2 Latest9 patches 4 repliesApplied
  2. v113 patches 31 repliesSuperseded

Changes in v2 from the cover letter

- Rebased on top of v6.7-rc2
- Based on review comments removed PASID related helper functions
- Reworked domain_flush_pages() code path to detect/handle v2 page table flush.
- Re-organized code made it difficult to fix __set_gcr3() code path. It still uses __amd_iommu_flush_tlb(). Also as part of SVA part3, we are reworking this code path. Hence dropped __flush_pasid() removal patch from this series. It will be added to SVA part3 series.
- Dropped code re-arragement patch as I think it should be done after removing flush_pasid() related code. It will be added to SVA part3.

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/9iommu/amd: Rename iommu_flush_all_caches() -> amd_iommu_flush_all_caches()drivers/iommu/amd/amd_iommu.h drivers/iommu/amd/amd_iommu_types.h drivers/iommu/amd/init.c +1 more+10 -110 replies
2/9iommu/amd: Remove redundant domain flush from attach_device()drivers/iommu/amd/iommu.c+0 -90 replies
3/9iommu/amd: Remove redundant passing of PDE bitdrivers/iommu/amd/iommu.c+13 -140 replies
4/9iommu/amd: Add support to invalidate multiple guest pagesdrivers/iommu/amd/iommu.c+13 -180 replies
5/9iommu/amd: Refactor IOMMU tlb invalidation codedrivers/iommu/amd/iommu.c+14 -220 replies
6/9iommu/amd: Refactor device iotlb invalidation codedrivers/iommu/amd/iommu.c+12 -210 replies
7/9iommu/amd: Consolidate amd_iommu_domain_flush_complete() calldrivers/iommu/amd/io_pgtable.c drivers/iommu/amd/iommu.c+10 -121 reply
8/9iommu/amd: Make domain_flush_pages as global functiondrivers/iommu/amd/amd_iommu.h drivers/iommu/amd/io_pgtable.c drivers/iommu/amd/iommu.c+17 -121 reply
9/9iommu/amd/pgtbl_v2: Invalidate updated page ranges onlydrivers/iommu/amd/io_pgtable_v2.c drivers/iommu/amd/iommu.c+22 -161 reply

Reviews trailers per patch

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

PatchSuravee SuthikulpanitJason Gunthorpe
1/9R-b R-b
2/9R-b R-b
3/9R-b R-b
4/9R-b R-b
5/9R-b R-b
6/9R-b R-b
7/9R-b
8/9R-b
9/9R-b

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

Read the v2 thread

Cover letter [PATCH v2 0/9] Improve TLB invalidation logic

Current code invalidates single page or entire range for the given domain ID. IOMMU hardware supports multiple page invalidation. This series adds support to invalidate range of pages. Also consolidate various invalidation functions.

Note that this series doesn't add support for PASID based invalidation. We will include necessary changes in SVA series.

Testing:
- This series is tested with v1 and v2 page table and it works fine.

This patch series is based on top of upstream v6.7-rc2.

This is also available at github :
https://github.com/AMDESE/linux/tree/iommu_flush_improvement_v2_v6.7_rc2

Thanks Jason for reviewing previous versions and providing valuable feedbacks.

Changes from v1 -> v2:
- Rebased on top of v6.7-rc2
- Based on review comments removed PASID related helper functions
- Reworked domain_flush_pages() code path to detect/handle v2 page table flush.
- Re-organized code made it difficult to fix __set_gcr3() code path. It still uses __amd_iommu_flush_tlb(). Also as part of SVA part3, we are reworking this code path. Hence dropped __flush_pasid() removal patch from this series. It will be added to SVA part3 series.
- Dropped code re-arragement patch as I think it should be done after removing flush_pasid() related code. It will be added to SVA part3.

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

Thank you,
Vasant

Vasant Hegde (9):
iommu/amd: Rename iommu_flush_all_caches() -> amd_iommu_flush_all_caches() iommu/amd: Remove redundant domain flush from attach_device() iommu/amd: Remove redundant passing of PDE bit
iommu/amd: Add support to invalidate multiple guest pages iommu/amd: Refactor IOMMU tlb invalidation code
iommu/amd: Refactor device iotlb invalidation code
iommu/amd: Consolidate amd_iommu_domain_flush_complete() call iommu/amd: Make domain_flush_pages as global function iommu/amd/pgtbl_v2: Invalidate updated page ranges only

 drivers/iommu/amd/amd_iommu.h       |   8 +-
 drivers/iommu/amd/amd_iommu_types.h |   6 -
 drivers/iommu/amd/init.c            |   8 +-
 drivers/iommu/amd/io_pgtable.c      |   5 +-
 drivers/iommu/amd/io_pgtable_v2.c   |  10 +-
 drivers/iommu/amd/iommu.c           | 163 ++++++++++++----------------
 6 files changed, 88 insertions(+), 112 deletions(-)
Signature · 1 line
2.31.1