[PATCH v3 07/13] iommupt/armv8: Add DBM support

Nicolin Chen nicolinc at nvidia.com
Thu Dec 3 17:38:55 PST 2026


On Sun, Nov 15, 2026 at 07:30:37PM -0400, Jason Gunthorpe wrote:
> Provide the functions required to do dirty tracking with variations for S1
> and S2 formats. This follows the same scheme as iopgtable where the table
> starts off dirty to avoid any HW updates, and once dirty tracking is
> started it will be cleaned.
> 
> Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>

Reviewed-by: Nicolin Chen <nicolinc at nvidia.com>

Two nits below, but they are ignorable.

> +static inline bool armv8pt_check_is_dirty_s1(u64 *tablep, u64 entry)
> +{
> +	return (entry & (ARMV8PT_FMT_DBM |
> +			 FIELD_PREP(ARMV8PT_FMT_AP, ARMV8PT_AP_RDONLY))) ==
> +	       ARMV8PT_FMT_DBM;
> +}
> +
> +static bool armv8pt_clear_dirty_s1(u64 *tablep, u64 entry)
> +{
> +	WRITE_ONCE(*tablep,
> +		   entry | FIELD_PREP(ARMV8PT_FMT_AP, ARMV8PT_AP_RDONLY));
> +	return false;
> +}

Could this be "inline", matching with armv8pt_check_is_dirty_s1?

> +static inline bool armv8pt_check_is_dirty_s2(u64 *tablep, u64 entry)
> +{
> +	const u64 DIRTY = ARMV8PT_FMT_DBM |
> +			  FIELD_PREP(ARMV8PT_FMT_S2AP, ARMV8PT_S2AP_WRITE);
> +
> +	return (entry & DIRTY) == DIRTY;
> +}
> +
> +static bool armv8pt_clear_dirty_s2(u64 *tablep, u64 entry)
> +{
> +	WRITE_ONCE(*tablep, entry & ~(u64)FIELD_PREP(ARMV8PT_FMT_S2AP,
> +						     ARMV8PT_S2AP_WRITE));
> +	return false;
> +}

Ditto

Nicolin



More information about the linux-arm-kernel mailing list