diff mbox series

[v1] arm64/mm: use GENMASK_ULL for TTBR_BADDR_MASK_52

Message ID 20220708140056.10123-1-joey.gouly@arm.com (mailing list archive)
State New, archived
Headers show
Series [v1] arm64/mm: use GENMASK_ULL for TTBR_BADDR_MASK_52 | expand

Commit Message

Joey Gouly July 8, 2022, 2 p.m. UTC
The comment says this should be GENMASK_ULL(47, 12), so do that!

GENMASK_ULL() is available in assembly since:
    95b980d62d52 ("linux/bits.h: make BIT(), GENMASK(), and friends available in assembly")

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Link: https://lore.kernel.org/all/20171221164851.edxq536yobjuagwe@armageddon.cambridge.arm.com/
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Kristina Martsenko <kristina.martsenko@arm.com>
---
 arch/arm64/include/asm/pgtable-hwdef.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Catalin Marinas July 8, 2022, 4:14 p.m. UTC | #1
On Fri, Jul 08, 2022 at 03:00:56PM +0100, Joey Gouly wrote:
> The comment says this should be GENMASK_ULL(47, 12), so do that!
> 
> GENMASK_ULL() is available in assembly since:
>     95b980d62d52 ("linux/bits.h: make BIT(), GENMASK(), and friends available in assembly")
> 
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Link: https://lore.kernel.org/all/20171221164851.edxq536yobjuagwe@armageddon.cambridge.arm.com/
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Kristina Martsenko <kristina.martsenko@arm.com>
> ---
>  arch/arm64/include/asm/pgtable-hwdef.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
> index dd3d12bce07b..5ab8d163198f 100644
> --- a/arch/arm64/include/asm/pgtable-hwdef.h
> +++ b/arch/arm64/include/asm/pgtable-hwdef.h
> @@ -281,10 +281,9 @@
>   */
>  #ifdef CONFIG_ARM64_PA_BITS_52
>  /*
> - * This should be GENMASK_ULL(47, 2).
>   * TTBR_ELx[1] is RES0 in this configuration.
>   */
> -#define TTBR_BADDR_MASK_52	(((UL(1) << 46) - 1) << 2)
> +#define TTBR_BADDR_MASK_52	GENMASK_ULL(47, 2)

This should be fine, it seems that GENMASK_ULL() can cope with asm
files.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Kristina Martšenko July 8, 2022, 6:29 p.m. UTC | #2
On 08/07/2022 15:00, Joey Gouly wrote:
> The comment says this should be GENMASK_ULL(47, 12), so do that!
> 
> GENMASK_ULL() is available in assembly since:
>     95b980d62d52 ("linux/bits.h: make BIT(), GENMASK(), and friends available in assembly")
> 
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Link: https://lore.kernel.org/all/20171221164851.edxq536yobjuagwe@armageddon.cambridge.arm.com/
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Kristina Martsenko <kristina.martsenko@arm.com>

FWIW,

Reviewed-by: Kristina Martsenko <kristina.martsenko@arm.com>

> ---
>  arch/arm64/include/asm/pgtable-hwdef.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
> index dd3d12bce07b..5ab8d163198f 100644
> --- a/arch/arm64/include/asm/pgtable-hwdef.h
> +++ b/arch/arm64/include/asm/pgtable-hwdef.h
> @@ -281,10 +281,9 @@
>   */
>  #ifdef CONFIG_ARM64_PA_BITS_52
>  /*
> - * This should be GENMASK_ULL(47, 2).
>   * TTBR_ELx[1] is RES0 in this configuration.
>   */
> -#define TTBR_BADDR_MASK_52	(((UL(1) << 46) - 1) << 2)
> +#define TTBR_BADDR_MASK_52	GENMASK_ULL(47, 2)
>  #endif
>  
>  #ifdef CONFIG_ARM64_VA_BITS_52
Will Deacon July 19, 2022, 7:56 p.m. UTC | #3
On Fri, 8 Jul 2022 15:00:56 +0100, Joey Gouly wrote:
> The comment says this should be GENMASK_ULL(47, 12), so do that!
> 
> GENMASK_ULL() is available in assembly since:
>     95b980d62d52 ("linux/bits.h: make BIT(), GENMASK(), and friends available in assembly")
> 
> 

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

[1/1] arm64/mm: use GENMASK_ULL for TTBR_BADDR_MASK_52
      https://git.kernel.org/arm64/c/19198abf3d81

Cheers,
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
index dd3d12bce07b..5ab8d163198f 100644
--- a/arch/arm64/include/asm/pgtable-hwdef.h
+++ b/arch/arm64/include/asm/pgtable-hwdef.h
@@ -281,10 +281,9 @@ 
  */
 #ifdef CONFIG_ARM64_PA_BITS_52
 /*
- * This should be GENMASK_ULL(47, 2).
  * TTBR_ELx[1] is RES0 in this configuration.
  */
-#define TTBR_BADDR_MASK_52	(((UL(1) << 46) - 1) << 2)
+#define TTBR_BADDR_MASK_52	GENMASK_ULL(47, 2)
 #endif
 
 #ifdef CONFIG_ARM64_VA_BITS_52