Skip to content

Commit d0ba961

Browse files
Anshuman Khandualwilldeacon
authored andcommitted
arm64/mm: Add pte_rdonly() helper
This replaces open coding PTE_RDONLY check with a new helper pte_rdonly(). No functional change is intended here. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Reviewed-by: David Hildenbrand <david@redhat.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20230713092004.693749-1-anshuman.khandual@arm.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 62ce7af commit d0ba961

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm64/include/asm/pgtable.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
103103
#define pte_young(pte) (!!(pte_val(pte) & PTE_AF))
104104
#define pte_special(pte) (!!(pte_val(pte) & PTE_SPECIAL))
105105
#define pte_write(pte) (!!(pte_val(pte) & PTE_WRITE))
106+
#define pte_rdonly(pte) (!!(pte_val(pte) & PTE_RDONLY))
106107
#define pte_user(pte) (!!(pte_val(pte) & PTE_USER))
107108
#define pte_user_exec(pte) (!(pte_val(pte) & PTE_UXN))
108109
#define pte_cont(pte) (!!(pte_val(pte) & PTE_CONT))
@@ -120,7 +121,7 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
120121
(__boundary - 1 < (end) - 1) ? __boundary : (end); \
121122
})
122123

123-
#define pte_hw_dirty(pte) (pte_write(pte) && !(pte_val(pte) & PTE_RDONLY))
124+
#define pte_hw_dirty(pte) (pte_write(pte) && !pte_rdonly(pte))
124125
#define pte_sw_dirty(pte) (!!(pte_val(pte) & PTE_DIRTY))
125126
#define pte_dirty(pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte))
126127

0 commit comments

Comments
 (0)