Re: [RFC PATCH 10/11] iommupt: Add RISC-V dirty tracking PTE ops

From: Jason Gunthorpe

Date: Tue Apr 28 2026 - 09:47:46 EST


On Tue, Apr 28, 2026 at 09:13:58PM +0800, fangyu.yu@xxxxxxxxxxxxxxxxx wrote:
> From: Fangyu Yu <fangyu.yu@xxxxxxxxxxxxxxxxx>
>
> Implement the three dirty-tracking hooks required by the generic page
> table framework for the RISC-V format:
>
> pt_entry_is_write_dirty():
> Check the D bit (bit 7) in the PTE.
>
> pt_entry_make_write_clean():
> Clear the D bit across the full contiguous range.
>
> pt_entry_make_write_dirty():
> Atomically set D via try_cmpxchg64() on a single PTE.
>
> Signed-off-by: Fangyu Yu <fangyu.yu@xxxxxxxxxxxxxxxxx>
> ---
> drivers/iommu/generic_pt/fmt/riscv.h | 43 ++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)

This patch should probably go earlier in your series, before adding
the alloc_paging flags at least.

Jason