linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT
@ 2024-12-02  8:38 Anshuman Khandual
  2024-12-02 11:42 ` Ryan Roberts
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Anshuman Khandual @ 2024-12-02  8:38 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, Ard Biesheuvel,
	Ryan Roberts, Mark Rutland, linux-kernel

[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 <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
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>
---
This patch applies on v6.13-rc1

 arch/arm64/include/asm/pgtable.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 6986345b537a..e20b80229910 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -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)
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT
  2024-12-02  8:38 Anshuman Khandual
@ 2024-12-02 11:42 ` Ryan Roberts
  2024-12-03  2:46 ` Gavin Shan
  2024-12-10 18:34 ` Will Deacon
  2 siblings, 0 replies; 7+ messages in thread
From: Ryan Roberts @ 2024-12-02 11:42 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel
  Cc: Catalin Marinas, Will Deacon, Ard Biesheuvel, Mark Rutland,
	linux-kernel

On 02/12/2024 08:38, Anshuman Khandual wrote:
> [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 <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Ryan Roberts <ryan.roberts@arm.com>
> 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: Ryan Roberts <ryan.roberts@arm.com>

> ---
> This patch applies on v6.13-rc1
> 
>  arch/arm64/include/asm/pgtable.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index 6986345b537a..e20b80229910 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -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)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT
  2024-12-02  8:38 Anshuman Khandual
  2024-12-02 11:42 ` Ryan Roberts
@ 2024-12-03  2:46 ` Gavin Shan
  2024-12-10 18:34 ` Will Deacon
  2 siblings, 0 replies; 7+ messages in thread
From: Gavin Shan @ 2024-12-03  2:46 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel
  Cc: Catalin Marinas, Will Deacon, Ard Biesheuvel, Ryan Roberts,
	Mark Rutland, linux-kernel

On 12/2/24 6:38 PM, Anshuman Khandual wrote:
> [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 <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Ryan Roberts <ryan.roberts@arm.com>
> 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>
> ---
> This patch applies on v6.13-rc1
> 
>   arch/arm64/include/asm/pgtable.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT
  2024-12-02  8:38 Anshuman Khandual
  2024-12-02 11:42 ` Ryan Roberts
  2024-12-03  2:46 ` Gavin Shan
@ 2024-12-10 18:34 ` Will Deacon
  2 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2024-12-10 18:34 UTC (permalink / raw)
  To: linux-arm-kernel, Anshuman Khandual
  Cc: catalin.marinas, kernel-team, Will Deacon, Ard Biesheuvel,
	Ryan Roberts, Mark Rutland, linux-kernel

On Mon, 02 Dec 2024 14:08:50 +0530, Anshuman Khandual wrote:
> [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,
-- 
Will

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT
@ 2025-01-07  1:55 Anshuman Khandual
  2025-01-07 12:24 ` Catalin Marinas
  2025-01-08 16:38 ` Will Deacon
  0 siblings, 2 replies; 7+ messages in thread
From: Anshuman Khandual @ 2025-01-07  1:55 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, Ard Biesheuvel,
	Ryan Roberts, Mark Rutland, linux-kernel

[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 <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
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>
---
This patch applies on v6.13-rc6

 arch/arm64/include/asm/pgtable.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 6986345b537a..e20b80229910 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -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)
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT
  2025-01-07  1:55 [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT Anshuman Khandual
@ 2025-01-07 12:24 ` Catalin Marinas
  2025-01-08 16:38 ` Will Deacon
  1 sibling, 0 replies; 7+ messages in thread
From: Catalin Marinas @ 2025-01-07 12:24 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-arm-kernel, Will Deacon, Ard Biesheuvel, Ryan Roberts,
	Mark Rutland, linux-kernel

On Tue, Jan 07, 2025 at 07:25:29AM +0530, Anshuman Khandual wrote:
> [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 <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Ryan Roberts <ryan.roberts@arm.com>
> 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>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT
  2025-01-07  1:55 [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT Anshuman Khandual
  2025-01-07 12:24 ` Catalin Marinas
@ 2025-01-08 16:38 ` Will Deacon
  1 sibling, 0 replies; 7+ messages in thread
From: Will Deacon @ 2025-01-08 16:38 UTC (permalink / raw)
  To: linux-arm-kernel, Anshuman Khandual
  Cc: catalin.marinas, kernel-team, Will Deacon, Ard Biesheuvel,
	Ryan Roberts, Mark Rutland, linux-kernel

On Tue, 07 Jan 2025 07:25:29 +0530, Anshuman Khandual wrote:
> [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/mm), thanks!

[1/1] arm64/mm: Replace open encodings with PXD_TABLE_BIT
      https://git.kernel.org/arm64/c/fe2169f556a1

Cheers,
-- 
Will

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-01-08 16:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07  1:55 [PATCH] arm64/mm: Replace open encodings with PXD_TABLE_BIT Anshuman Khandual
2025-01-07 12:24 ` Catalin Marinas
2025-01-08 16:38 ` Will Deacon
  -- strict thread matches above, loose matches on Subject: below --
2024-12-02  8:38 Anshuman Khandual
2024-12-02 11:42 ` Ryan Roberts
2024-12-03  2:46 ` Gavin Shan
2024-12-10 18:34 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).