[RFC PATCH v1 0/8] iommu: Add contiguous MSI mapping support

From: Andrew Jones

Date: Wed Aug 26 2026 - 10:54:31 EST


The RISC-V IOMMU MSI remapping series [1] needs to prepare mappings for
every possible IMSIC target before MSI composition may occur in atomic
context. The previous approach mapped each physical address separately
and kept a driver-owned PA-to-IOVA lookup table.

Jason Gunthorpe suggested passing the complete list of physical
addresses through the existing MSI preparation flow. This series
implements that idea as iommu_dma_prepare_msi_list(), which maps the
ordered list into one contiguous IOVA range and records its base and
granule shift in the MSI descriptor. The interrupt-remapping driver can
then derive the IOVA for each list entry without maintaining a separate
IOVA array.

Both DMA-IOMMU and iommufd backends are extended to support these list
mappings. The existing per-page mapping objects are retained, while
the first object identifies the complete range so identical lists can
reuse an existing mapping. iommufd allocates and installs a complete
range atomically and grows its software-MSI bitmaps beyond their
previous 64-entry limit.

This is being posted separately from the RISC-V MSI remapping work for
early RFC review of the common DMA-IOMMU and iommufd interfaces. The
RISC-V adaptation to iommu_dma_prepare_msi_list() is still in progress
and will be posted later.

LLM-based coding assistants were used during development for code
exploration, patch review, test execution, and drafting and editing
commit messages and this cover letter. I reviewed and finalized all
resulting code and text. Per-patch Assisted-by tags are omitted in
light of the ongoing discussion about simplifying coding-assistant
attribution[2].

Thanks,
drew

[1] https://lore.kernel.org/all/20260820214150.545737-1-andrew.jones@xxxxxxxxxxxxxxxx/
[2] https://lore.kernel.org/all/20260701-work-coding-assistants-v1-1-a20a94d1d606@xxxxxxxxxx/

Andrew Jones (8):
iommu/dma: Prepare MSI physical address lists
iommufd: Convert struct iommufd_sw_msi_maps to a growable bitmap
iommufd: Split software MSI map lookup and allocation
iommufd: Bound software MSI mappings to the reserved range
iommufd: Prepare software MSI maps for address lists
iommufd: Install software MSI map ranges atomically
iommufd: Prepare software MSI installation for address lists
iommu/dma: Introduce iommu_dma_prepare_msi_list()

drivers/iommu/dma-iommu.c | 116 ++++++---
drivers/iommu/dma-iommu.h | 13 +-
drivers/iommu/iommu-priv.h | 7 +-
drivers/iommu/iommu.c | 109 ++++++--
drivers/iommu/iommufd/device.c | 20 +-
drivers/iommu/iommufd/driver.c | 315 ++++++++++++++++++++----
drivers/iommu/iommufd/hw_pagetable.c | 1 +
drivers/iommu/iommufd/io_pagetable.c | 9 +-
drivers/iommu/iommufd/iommufd_private.h | 51 +++-
include/linux/iommu.h | 8 +
10 files changed, 528 insertions(+), 121 deletions(-)

--
2.43.0