Re: [PATCH 2/2] iommupt: Encode IOMMU_MMIO/IOMMU_CACHE via RISC-V Svpbmt bits

From: Jason Gunthorpe

Date: Sat Apr 11 2026 - 08:48:05 EST


On Sat, Apr 11, 2026 at 10:22:23AM +0800, fangyu.yu@xxxxxxxxxxxxxxxxx wrote:
> From: Fangyu Yu <fangyu.yu@xxxxxxxxxxxxxxxxx>
>
> When the RISC-V IOMMU page table format support Svpbmt, PBMT provides
> a way to tag mappings with page-based memory types. Encode memory type
> via PBMT in RISC-V IOMMU PTEs:
>
> - IOMMU_MMIO -> PBMT=IO
> - !IOMMU_CACHE -> PBMT=NC
> - otherwise -> PBMT=Normal (PBMT=0)
>
> Clear the PBMT field before applying the selected encoding, and only
> touch PBMT when PT_FEAT_RISCV_SVPBMT is advertised.
>
> Signed-off-by: Fangyu Yu <fangyu.yu@xxxxxxxxxxxxxxxxx>
> ---
> drivers/iommu/generic_pt/fmt/riscv.h | 9 +++++++++
> 1 file changed, 9 insertions(+)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

This is similar to ARM now with the 3 kinds..

Jason