[PATCH 0/7] Support non-leaf and range invalidation features in RISC-V
Jason Gunthorpe
jgg at nvidia.com
Fri Apr 10 08:57:01 PDT 2026
This is part of the patch pile to get SMMUv3 moved to iommupt. From
that perspective it introduces the PT_FEAT_DETAILED_GATHER which will
be used by both RISC-V and SMMUv3 to generate optimized invalidation
commands.
I don't have any RISC-V anything so this needs to be tested by someone who
does.
Improve the invalidation flow in RISC-V:
- For single address invalidation, compute a stride based on what
IOPTEs were changed by having the gather track level changes in
bitmaps. This allows things like unmapping hugetlb-backed mappings
to avoid jumping to global invalidation.
- Support the NL bit to avoid global invalidation when table
structure is changed
- Support the S range invalidation feature to convert any gather
into a single invalidation command using an aligned power-of-2
size like AMD and VT-d.
This is also a requirement for the kunit iotlb series, which was used
to test the math used to generate the invalidation commands from the
gather in this series.
It replaces a similar series Fangyu sent prior to the iommupt
conversion:
https://lore.kernel.org/linux-iommu/20260208144213.94856-1-fangyu.yu@linux.alibaba.com/
The full patch pile is here:
https://github.com/jgunthorpe/linux/commits/iommu_pt_arm64/
Jason Gunthorpe (7):
iommu: Split the kdoc comment for struct iommu_iotlb_gather
iommupt: Add struct iommupt_pending_gather
iommupt: Add PT_FEAT_DETAILED_GATHER
iommu/riscv: Enable PT_FEAT_DETAILED_GATHER and pass gather to
iotlb_inval
iommu/riscv: Compute best stride for single invalidation
iommu/riscv: Add RISCV_IOMMU_CAPABILITIES_NL
iommu/riscv: Add NAPOT range invalidation support
drivers/iommu/generic_pt/fmt/iommu_riscv64.c | 4 +-
drivers/iommu/generic_pt/iommu_pt.h | 98 ++++++++----
drivers/iommu/riscv/iommu-bits.h | 24 +++
drivers/iommu/riscv/iommu.c | 160 ++++++++++++++-----
include/linux/generic_pt/common.h | 5 +
include/linux/iommu.h | 42 ++++-
6 files changed, 259 insertions(+), 74 deletions(-)
base-commit: ac81c0f2e6a779e444c5b6fd43756ef811656098
--
2.43.0
More information about the linux-riscv
mailing list