@@ -194,6 +194,22 @@ enum kvm_pgtable_walk_flags {
KVM_PGTABLE_WALK_TABLE_POST = BIT(2),
};
+/**
+ * kvm_pgtable_visitor_fn_t - Page table traversal callback for visiting a PTE.
+ * @addr: Input address (IA) mapped by the PTE.
+ * @end: IA corresponding to the end of the page table traversal range.
+ * @ptep: Pointer to the PTE.
+ * @old: Value of the PTE observed by the visitor. Also used as an output
+ * parameter for returning the new PTE value.
+ * @flag: Flag identifying the entry type visited.
+ * @arg: Argument passed to the callback function.
+ *
+ * Callback function signature invoked during page table traversal. Optionally
+ * returns the new value of the PTE via @old if the new value requires further
+ * traversal (i.e. installing a new table).
+ *
+ * Return: 0 on success, negative error code on failure.
+ */
typedef int (*kvm_pgtable_visitor_fn_t)(u64 addr, u64 end, u32 level,
kvm_pte_t *ptep, kvm_pte_t *old,
enum kvm_pgtable_walk_flags flag,
The argument list to kvm_pgtable_visitor_fn_t has gotten rather long. Additionally, @old serves as both an input and output parameter, which isn't easily discerned from the declaration alone. Document the meaning of the visitor callback arguments and the conditions under which @old was written to. Signed-off-by: Oliver Upton <oliver.upton@linux.dev> --- arch/arm64/include/asm/kvm_pgtable.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)