Archive-only list for patches
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>
Cc: Kevin Tian <kevin.tian@intel.com>,
	patches@lists.linux.dev, Samiullah Khawaja <skhawaja@google.com>
Subject: [PATCH v3 0/2] Let iommupt manage changes in page size internally
Date: Fri, 27 Feb 2026 15:30:09 -0400	[thread overview]
Message-ID: <0-v3-a1777ea76519+370f-iommpt_map_direct_jgg@nvidia.com> (raw)

Currently the core code has some helpers that use iommu_pgsize() to
fragment operations into single page-size chunks and then the driver has a
simplified single-page size implementation. This was helpful in
simplifying the driver code.

However, iommupt has a single shared implementation for all formats so we
can accept a little more complexity. Have the core code directly call
iommupt with the requested range to map/unmap and rely on it to change the
page size across the range as required.

The iommupt implementation of unmap is already fine to work like this, and
the map implementation can reset its walking paramters in-place with a
little more code.

The net result is about a 5% performance bump in the simple iommupt
map/unmap benchmarks of mapped alignment, and probably more for
unaligned/oddly sized ranges that are changing page sizes.

Introduce a iommupt_from_domain() function as a general way to convert
an iommu_domain to a struct pt_iommu if it is a iommupt based domain. I
expect to keep using this as more optimizations are introduced.

v3:
 - Rebase to v7.0-rc1
v2: https://patch.msgid.link/r/0-v2-973a6bdc820f+693-iommpt_map_direct_jgg@nvidia.com
 - Rebase to latest iommu tree
 - Adjust to the IOMMU_DEBUG_PAGEALLOC work
 - Fix missed trace calls for both map and unmap
 - Add a comment explaining the level changes
v1: https://patch.msgid.link/r/0-v1-d7be57da596d+3f8c0-iommpt_map_direct_jgg@nvidia.com

Jason Gunthorpe (2):
  iommupt: Directly call iommupt's unmap_range()
  iommupt: Avoid rewalking during map

 drivers/iommu/generic_pt/iommu_pt.h         | 162 +++++++++++---------
 drivers/iommu/generic_pt/kunit_generic_pt.h |  12 ++
 drivers/iommu/generic_pt/pt_iter.h          |  22 +++
 drivers/iommu/iommu.c                       |  66 ++++++--
 include/linux/generic_pt/iommu.h            |  69 +++++++--
 include/linux/iommu.h                       |   1 +
 6 files changed, 231 insertions(+), 101 deletions(-)


base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
-- 
2.43.0


             reply	other threads:[~2026-02-27 19:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 19:30 Jason Gunthorpe [this message]
2026-02-27 19:30 ` [PATCH v3 1/2] iommupt: Directly call iommupt's unmap_range() Jason Gunthorpe
2026-02-27 19:30 ` [PATCH v3 2/2] iommupt: Avoid rewalking during map Jason Gunthorpe
2026-05-09 17:41   ` Josua Mayer
2026-05-09 19:40     ` Jason Gunthorpe
2026-05-09 20:25       ` Josua Mayer
2026-05-09 23:39         ` Jason Gunthorpe
2026-03-03  3:55 ` [PATCH v3 0/2] Let iommupt manage changes in page size internally Baolu Lu
2026-03-17 12:58 ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0-v3-a1777ea76519+370f-iommpt_map_direct_jgg@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=patches@lists.linux.dev \
    --cc=robin.murphy@arm.com \
    --cc=skhawaja@google.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox