[PATCH V2 1/3] powerpc/jump_label: adjust inline asm to be consistent
Christophe Leroy (CS GROUP)
chleroy at kernel.org
Thu Feb 5 19:09:41 AEDT 2026
Le 04/02/2026 à 22:01, Mukesh Kumar Chaurasiya (IBM) a écrit :
> [Vous ne recevez pas souvent de courriers de mkchauras at gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>
> Added support for a new macro ARCH_STATIC_BRANCH_ASM in powerpc
> to avoid duplication of inline asm between C and Rust. This is
> inline with commit aecaf181651c '("jump_label: adjust inline asm to be consistent")'
>
> Signed-off-by: Madhavan Srinivasan <maddy at linux.ibm.com>
> Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras at gmail.com>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy at kernel.org>
> ---
> arch/powerpc/include/asm/jump_label.h | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
> index d4eaba459a0e..a6b211502bfe 100644
> --- a/arch/powerpc/include/asm/jump_label.h
> +++ b/arch/powerpc/include/asm/jump_label.h
> @@ -15,14 +15,20 @@
> #define JUMP_ENTRY_TYPE stringify_in_c(FTR_ENTRY_LONG)
> #define JUMP_LABEL_NOP_SIZE 4
>
> +#define JUMP_TABLE_ENTRY(key, label) \
> + ".pushsection __jump_table, \"aw\" \n\t" \
> + ".long 1b - ., " label " - . \n\t" \
> + JUMP_ENTRY_TYPE key " - . \n\t" \
> + ".popsection \n\t"
> +
> +#define ARCH_STATIC_BRANCH_ASM(key, label) \
> + "1: nop \n\t" \
> + JUMP_TABLE_ENTRY(key,label)
> +
> static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
> {
> - asm goto("1:\n\t"
> - "nop # arch_static_branch\n\t"
> - ".pushsection __jump_table, \"aw\"\n\t"
> - ".long 1b - ., %l[l_yes] - .\n\t"
> - JUMP_ENTRY_TYPE "%c0 - .\n\t"
> - ".popsection \n\t"
> + asm goto(
> + ARCH_STATIC_BRANCH_ASM("%c0", "%l[l_yes]")
> : : "i" (&((char *)key)[branch]) : : l_yes);
>
> return false;
> @@ -34,10 +40,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool
> {
> asm goto("1:\n\t"
> "b %l[l_yes] # arch_static_branch_jump\n\t"
> - ".pushsection __jump_table, \"aw\"\n\t"
> - ".long 1b - ., %l[l_yes] - .\n\t"
> - JUMP_ENTRY_TYPE "%c0 - .\n\t"
> - ".popsection \n\t"
> + JUMP_TABLE_ENTRY("%c0", "%l[l_yes]")
> : : "i" (&((char *)key)[branch]) : : l_yes);
>
> return false;
> --
> 2.52.0
>
More information about the Linuxppc-dev
mailing list