> From: Jason Gunthorpe <[email protected]>
> Sent: Wednesday, October 8, 2025 12:12 AM
>
> +
> +/**
> + * pt_clear_entry() - Make entries empty (non-present)
> + * @pts: Starting table index
> + * @num_contig_lg2: Number of contiguous items to clear
> + *
> + * Clear a run of entries. A cleared entry will load back as PT_ENTRY_EMPTY
> + * and does not have any effect on table walking. The starting index must be
> + * aligned to num_contig_lg2.
> + */
> +static inline void pt_clear_entry(struct pt_state *pts,
> + unsigned int num_contig_lg2);
better call it 'pt_clear_entries'. If it's single the size can be retrieved
from pts then num_contig_lg2 is not required.
> +
> +/**
> + * pt_entry_make_write_dirty() - Make an entry dirty
> + * @pts: Table entry to change
> + *
...
> +
> +/**
> + * pt_entry_set_write_clean() - Make the entry write clean
> + * @pts: Table entry to change
'pt_entry_make_write_clean', on par with pt_entry_make_write_dirty()
also put them together instead of mixing other unrelated helpers
in between.
> +
> +/**
> + * pt_entry_write_is_dirty() - True if the entry has been written to
> + * @pts: Entry to query
> + *
> + * "write dirty" means that the HW has written to the OA translated
> + * by this entry. If the entry is contiguous then the consolidated
> + * "write dirty" for all the items must be returned.
'pt_entry_is_write_dirty' to keep 'write dirty' as a term.
> +
> +/**
> + * pt_install_leaf_entry() - Write a leaf entry to the table
> + * @pts: Table index to change
> + * @oa: Output Address for this leaf
> + * @oasz_lg2: Size in VA for this leaf
s/VA/OA/, though the size is same in both spaces.
> +/* Returned by pt_load_entry() and for_each_pt_level_entry() */
> +enum pt_entry_type {
> + PT_ENTRY_EMPTY,
> + /* Item points to a lower table level */
/* Entry is valid and points to a lower table level */
> + PT_ENTRY_TABLE,
> + /* Entry is valid and returns an output address */
> + PT_ENTRY_OA,
> +};
> +
[...]
> +/**
> + * PT_MAKE_LEVELS() - Build an unwound walker
> + * @fn: Name of the walker function
> + * @do_fn: Function to call at each level
> + *
> + * This builds a function call tree that can be fully inlined.
> + * The caller must provide a function body in an __always_inline function::
> + *
> + * static __always_inline int do(struct pt_range *range, void *arg,
> + * unsigned int level, struct pt_table_p *table,
> + * pt_level_fn_t descend_fn)
s/do/do_fn/
Reviewed-by: Kevin Tian <[email protected]>