@@ -608,22 +608,26 @@ int kvm_pgtable_stage2_wrprotect(struct kvm_pgtable *pgt, u64 addr, u64 size);
608608kvm_pte_t kvm_pgtable_stage2_mkyoung (struct kvm_pgtable * pgt , u64 addr );
609609
610610/**
611- * kvm_pgtable_stage2_mkold() - Clear the access flag in a page-table entry.
611+ * kvm_pgtable_stage2_test_clear_young() - Test and optionally clear the access
612+ * flag in a page-table entry.
612613 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
613614 * @addr: Intermediate physical address to identify the page-table entry.
615+ * @size: Size of the address range to visit.
616+ * @mkold: True if the access flag should be cleared.
614617 *
615618 * The offset of @addr within a page is ignored.
616619 *
617- * If there is a valid, leaf page-table entry used to translate @addr, then
618- * clear the access flag in that entry .
620+ * Tests and conditionally clears the access flag for every valid, leaf
621+ * page-table entry used to translate the range [@addr, @addr + @size) .
619622 *
620623 * Note that it is the caller's responsibility to invalidate the TLB after
621624 * calling this function to ensure that the updated permissions are visible
622625 * to the CPUs.
623626 *
624- * Return: The old page-table entry prior to clearing the flag, 0 on failure .
627+ * Return: True if any of the visited PTEs had the access flag set .
625628 */
626- kvm_pte_t kvm_pgtable_stage2_mkold (struct kvm_pgtable * pgt , u64 addr );
629+ bool kvm_pgtable_stage2_test_clear_young (struct kvm_pgtable * pgt , u64 addr ,
630+ u64 size , bool mkold );
627631
628632/**
629633 * kvm_pgtable_stage2_relax_perms() - Relax the permissions enforced by a
@@ -645,18 +649,6 @@ kvm_pte_t kvm_pgtable_stage2_mkold(struct kvm_pgtable *pgt, u64 addr);
645649int kvm_pgtable_stage2_relax_perms (struct kvm_pgtable * pgt , u64 addr ,
646650 enum kvm_pgtable_prot prot );
647651
648- /**
649- * kvm_pgtable_stage2_is_young() - Test whether a page-table entry has the
650- * access flag set.
651- * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().
652- * @addr: Intermediate physical address to identify the page-table entry.
653- *
654- * The offset of @addr within a page is ignored.
655- *
656- * Return: True if the page-table entry has the access flag set, false otherwise.
657- */
658- bool kvm_pgtable_stage2_is_young (struct kvm_pgtable * pgt , u64 addr );
659-
660652/**
661653 * kvm_pgtable_stage2_flush_range() - Clean and invalidate data cache to Point
662654 * of Coherency for guest stage-2 address
0 commit comments