Re: [PATCH v4 11/21] arm64: gpr-num: add __GPR_NUM() helper
From: Vladimir Murzin <hidden>
Date: 2026-09-10 14:24:58
Also in:
stable
On 9/8/26 16:17, Mark Rutland wrote:
quoted hunk ↗ jump to hunk
The gpr-num infrastructure requires users to concatenate the register name with a long prefix in order to get a symbol that evaluates to a compile-time constant. Doing this manually is error-prone and painful to read. Add a new __GPR_NUM() helper which wraps the concatenation. For the moment I've left existing open-coded concatenation as-is. In particular, the DEFINE_MRS_S() and DEFINE_MSR_S() macros have awkward stringification requirements and would require invasive changes that outweigh the benefit. I have plans to rework those in the near future to remove the need to use gpr-num values. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Muhammad Usama Anjum <redacted> Cc: Ada Couprie Diaz <redacted> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Jinjie Ruan <redacted> Cc: Marc Zyngier <maz@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Vladimir Murzin <redacted> Cc: Will Deacon <will@kernel.org> Cc: Yang Shi <redacted> --- arch/arm64/include/asm/gpr-num.h | 4 ++++ 1 file changed, 4 insertions(+)diff --git a/arch/arm64/include/asm/gpr-num.h b/arch/arm64/include/asm/gpr-num.h index 240cd25d55c5a..30fb8a67b19f0 100644 --- a/arch/arm64/include/asm/gpr-num.h +++ b/arch/arm64/include/asm/gpr-num.h@@ -11,6 +11,8 @@ .equ .L__gpr_num_xzr, 31 .equ .L__gpr_num_wzr, 31 +#define __GPR_NUM(gpr) (.L__gpr_num_##gpr) + #else /* __ASSEMBLER__ */ #define __DEFINE_ASM_GPR_NUMS \@@ -26,6 +28,8 @@ " wx\\n .req w\\n\n" \ " .endr\n" +#define __GPR_NUM(gpr) "(.L__gpr_num_" gpr ")" + #endif /* __ASSEMBLER__ */ #endif /* __ASM_GPR_NUM_H */ -- 2.30.2
Brilliant! FWIW, Reviewed-by: Vladimir Murzin <redacted>