Skip to contentSkip to conversation

arm64/mm: Replace open encodings with PXD_TABLE_BIT

PATCH Applied Anshuman Khandual 4 participants 4 messages Dec 2, 2024 – Dec 10, 2024 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64/mm: Replace open encodings with PXD_TABLE_BIT

[pgd|p4d]_bad() helpers have open encodings for their respective table bits which can be replaced with corresponding macros. This makes things clearer, thus improving their readability as well.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Mark Rutland <[email protected]>

---
This patch applies on v6.13-rc1

 arch/arm64/include/asm/pgtable.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/pgtable.h +2 -2
index 6986345b537a..e20b80229910 100644
@@ -896,7 +896,7 @@ static inline bool mm_pud_folded(const struct mm_struct *mm)
 	pr_err("%s:%d: bad pud %016llx.\n", __FILE__, __LINE__, pud_val(e))
 
 #define p4d_none(p4d)		(pgtable_l4_enabled() && !p4d_val(p4d))
-#define p4d_bad(p4d)		(pgtable_l4_enabled() && !(p4d_val(p4d) & 2))
+#define p4d_bad(p4d)		(pgtable_l4_enabled() && !(p4d_val(p4d) & P4D_TABLE_BIT))
 #define p4d_present(p4d)	(!p4d_none(p4d))
 
 static inline void set_p4d(p4d_t *p4dp, p4d_t p4d)
@@ -1023,7 +1023,7 @@ static inline bool mm_p4d_folded(const struct mm_struct *mm)
 	pr_err("%s:%d: bad p4d %016llx.\n", __FILE__, __LINE__, p4d_val(e))
 
 #define pgd_none(pgd)		(pgtable_l5_enabled() && !pgd_val(pgd))
-#define pgd_bad(pgd)		(pgtable_l5_enabled() && !(pgd_val(pgd) & 2))
+#define pgd_bad(pgd)		(pgtable_l5_enabled() && !(pgd_val(pgd) & PGD_TABLE_BIT))
 #define pgd_present(pgd)	(!pgd_none(pgd))
 
 static inline void set_pgd(pgd_t *pgdp, pgd_t pgd)
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Anshuman Khandual

[pgd|p4d]_bad() helpers have open encodings for their respective table bits which can be replaced with corresponding macros. This makes things clearer, thus improving their readability as well.

Quoted 8 lines
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Mark Rutland <[email protected]>
Quoted 28 lines

---
This patch applies on v6.13-rc1

 arch/arm64/include/asm/pgtable.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/include/asm/pgtable.h +2 -2
index 6986345b537a..e20b80229910 100644
@@ -896,7 +896,7 @@ static inline bool mm_pud_folded(const struct mm_struct *mm)
 	pr_err("%s:%d: bad pud %016llx.\n", __FILE__, __LINE__, pud_val(e))
 
 #define p4d_none(p4d)		(pgtable_l4_enabled() && !p4d_val(p4d))
-#define p4d_bad(p4d)		(pgtable_l4_enabled() && !(p4d_val(p4d) & 2))
+#define p4d_bad(p4d)		(pgtable_l4_enabled() && !(p4d_val(p4d) & P4D_TABLE_BIT))
 #define p4d_present(p4d)	(!p4d_none(p4d))
 
 static inline void set_p4d(p4d_t *p4dp, p4d_t p4d)
@@ -1023,7 +1023,7 @@ static inline bool mm_p4d_folded(const struct mm_struct *mm)
 	pr_err("%s:%d: bad p4d %016llx.\n", __FILE__, __LINE__, p4d_val(e))
 
 #define pgd_none(pgd)		(pgtable_l5_enabled() && !pgd_val(pgd))
-#define pgd_bad(pgd)		(pgtable_l5_enabled() && !(pgd_val(pgd) & 2))
+#define pgd_bad(pgd)		(pgtable_l5_enabled() && !(pgd_val(pgd) & PGD_TABLE_BIT))
 #define pgd_present(pgd)	(!pgd_none(pgd))
 
 static inline void set_pgd(pgd_t *pgdp, pgd_t pgd)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Anshuman Khandual
Quoted 12 lines · Anshuman Khandual

[pgd|p4d]_bad() helpers have open encodings for their respective table bits which can be replaced with corresponding macros. This makes things clearer, thus improving their readability as well.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Mark Rutland <[email protected]>
Quoted 6 lines

---
This patch applies on v6.13-rc1

  arch/arm64/include/asm/pgtable.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
maintainer Applied
#3 lore raw
In reply to Anshuman Khandual
Quoted 5 lines · Anshuman Khandual

[pgd|p4d]_bad() helpers have open encodings for their respective table bits which can be replaced with corresponding macros. This makes things clearer, thus improving their readability as well.

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

[1/1] arm64/mm: Replace open encodings with PXD_TABLE_BIT

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

Cheers,

Signature · 5 lines
Will

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