[PATCH 0/7] Support non-leaf and range invalidation features in RISC-V

Tomasz Jeznach tjeznach at rivosinc.com
Tue May 5 09:31:55 PDT 2026


Thanks Jason for this series.
I've verified github/iommu_pt_arm64 on RISC-V, looks good.

- Tomasz

On Fri, Apr 10, 2026 at 8:57 AM Jason Gunthorpe <jgg at nvidia.com> wrote:
>
> 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