Skip to contentSkip to conversation

arm64/mm: Add pte_rdonly() helper

PATCH Applied Anshuman Khandual 4 participants 4 messages Jul 13, 2023 – Jul 27, 2023 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
This applies on v6.5-rc1

 arch/arm64/include/asm/pgtable.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/include/asm/pgtable.h +2 -1
index 171d6d7f8087..72c2e8431360 100644
@@ -103,6 +103,7 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
 #define pte_young(pte)		(!!(pte_val(pte) & PTE_AF))
 #define pte_special(pte)	(!!(pte_val(pte) & PTE_SPECIAL))
 #define pte_write(pte)		(!!(pte_val(pte) & PTE_WRITE))
+#define pte_rdonly(pte)		(!!(pte_val(pte) & PTE_RDONLY))
 #define pte_user(pte)		(!!(pte_val(pte) & PTE_USER))
 #define pte_user_exec(pte)	(!(pte_val(pte) & PTE_UXN))
 #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)
 	(__boundary - 1 < (end) - 1) ? __boundary : (end);			\
 })
 
-#define pte_hw_dirty(pte)	(pte_write(pte) && !(pte_val(pte) & PTE_RDONLY))
+#define pte_hw_dirty(pte)	(pte_write(pte) && !pte_rdonly(pte))
 #define pte_sw_dirty(pte)	(!!(pte_val(pte) & PTE_DIRTY))
 #define pte_dirty(pte)		(pte_sw_dirty(pte) || pte_hw_dirty(pte))
 
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Anshuman Khandual

This replaces open coding PTE_RDONLY check with a new helper pte_rdonly(). No functional change is intended here.

---
This applies on v6.5-rc1

  arch/arm64/include/asm/pgtable.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/include/asm/pgtable.h +1 -0
index 171d6d7f8087..72c2e8431360 100644
@@ -103,6 +103,7 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
  #define pte_young(pte)		(!!(pte_val(pte) & PTE_AF))
  #define pte_special(pte)	(!!(pte_val(pte) & PTE_SPECIAL))
  #define pte_write(pte)		(!!(pte_val(pte) & PTE_WRITE))
+#define pte_rdonly(pte)		(!!(pte_val(pte) & PTE_RDONLY))
  #define pte_user(pte)		(!!(pte_val(pte) & PTE_USER))
  #define pte_user_exec(pte)	(!(pte_val(pte) & PTE_UXN))
  #define pte_cont(pte)		(!!(pte_val(pte) & PTE_CONT))

arch/arm64/include/asm/pgtable.h static inline pteval_t __phys_to_pte_val(phys_addr_t phys) · line 127

Quoted 8 lines
arch/arm64/include/asm/pgtable.h +1 -1
@@ -120,7 +121,7 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
  	(__boundary - 1 < (end) - 1) ? __boundary : (end);			\
  })
 
-#define pte_hw_dirty(pte)	(pte_write(pte) && !(pte_val(pte) & PTE_RDONLY))
+#define pte_hw_dirty(pte)	(pte_write(pte) && !pte_rdonly(pte))
  #define pte_sw_dirty(pte)	(!!(pte_val(pte) & PTE_DIRTY))
  #define pte_dirty(pte)		(pte_sw_dirty(pte) || pte_hw_dirty(pte))
 
Signature · 9 lines
Cheers,

David / dhildenb


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Anshuman Khandual
Quoted 9 lines · Anshuman Khandual

This replaces open coding PTE_RDONLY check with a new helper pte_rdonly(). No functional change is intended here.

maintainer Applied
#3 lore raw
In reply to Anshuman Khandual
Quoted 4 lines · Anshuman Khandual

This replaces open coding PTE_RDONLY check with a new helper pte_rdonly(). No functional change is intended here.

Applied to arm64 (for-next/mm), thanks!

[1/1] arm64/mm: Add pte_rdonly() helper

      https://git.kernel.org/arm64/c/d0ba961217e0

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev