public inbox for patches@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Improve the invalidation path in AMD
@ 2026-04-03 12:26 Jason Gunthorpe
  2026-04-03 12:26 ` [PATCH v2 1/5] iommu/amd: Simplify build_inv_address() Jason Gunthorpe
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Jason Gunthorpe @ 2026-04-03 12:26 UTC (permalink / raw)
  To: iommu, Joerg Roedel, Robin Murphy, Suravee Suthikulpanit,
	Will Deacon
  Cc: patches, Wei Wang

Auditing this path reveals some unnecessary complexity and some
confusion around end/size/last and types that may cause issues at the
ULONG_MAX limit.

First, fix up the call chains so that the gather start/last is
retained faithfully throughout. This avoids converting to a
start/size, and avoids various type conversions along this path. Fix
everything so the theoretical cases like start=0 last=U64_MAX work
correctly.

Simplify all the calculations for alignment/etc to use trivial bit
maths instead of the complicated versions. These are all intended to
be no functional change.

Finally, add support for PDE=0, deriving it from the gather. PDE=0
allows the HW to avoid scanning the page directory cache and
supporting it should improve performance.

v2:
 - Use start instead of address
v1: https://patch.msgid.link/r/0-v1-a7b77c25974e+115bf-iommupt_inv_amd_jgg@nvidia.com

Jason Gunthorpe (5):
  iommu/amd: Simplify build_inv_address()
  iommu/amd: Pass last in through to build_inv_address()
  iommu/amd: Have amd_iommu_domain_flush_pages() use last
  iommu/amd: Make CMD_INV_IOMMU_ALL_PAGES_ADDRESS match the spec
  iommu/amd: Control INVALIDATE_IOMMU_PAGES PDE from the gather

 drivers/iommu/amd/amd_iommu.h       |   4 +-
 drivers/iommu/amd/amd_iommu_types.h |   2 +-
 drivers/iommu/amd/iommu.c           | 177 +++++++++++++---------------
 drivers/iommu/amd/pasid.c           |   2 +-
 4 files changed, 88 insertions(+), 97 deletions(-)


base-commit: 2f8407f149b2763146903649fdebf2cc575c3ae3
-- 
2.43.0


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

end of thread, other threads:[~2026-04-07  1:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03 12:26 [PATCH v2 0/5] Improve the invalidation path in AMD Jason Gunthorpe
2026-04-03 12:26 ` [PATCH v2 1/5] iommu/amd: Simplify build_inv_address() Jason Gunthorpe
2026-04-06 13:18   ` Wei Wang
2026-04-06 13:30     ` Jason Gunthorpe
2026-04-07  1:15       ` Wei Wang
2026-04-07  1:26         ` Jason Gunthorpe
2026-04-03 12:26 ` [PATCH v2 2/5] iommu/amd: Pass last in through to build_inv_address() Jason Gunthorpe
2026-04-06 12:02   ` Wei Wang
2026-04-03 12:26 ` [PATCH v2 3/5] iommu/amd: Have amd_iommu_domain_flush_pages() use last Jason Gunthorpe
2026-04-03 12:26 ` [PATCH v2 4/5] iommu/amd: Make CMD_INV_IOMMU_ALL_PAGES_ADDRESS match the spec Jason Gunthorpe
2026-04-03 12:26 ` [PATCH v2 5/5] iommu/amd: Control INVALIDATE_IOMMU_PAGES PDE from the gather Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox