Skip to content

Commit 3263451

Browse files
mkchaurasmaddy-kerneldev
authored andcommitted
powerpc/jump_label: adjust inline asm to be consistent
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 aecaf18 ("jump_label: adjust inline asm to be consistent")' Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org> Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com> Co-developed-by: Madhavan Srinivasan <maddy@linux.ibm.com> [Maddy: Fixed the commit id format reported by checkpatch.py] Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260210090023.2587534-2-mkchauras@gmail.com
1 parent 07791ff commit 3263451

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

arch/powerpc/include/asm/jump_label.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@
1515
#define JUMP_ENTRY_TYPE stringify_in_c(FTR_ENTRY_LONG)
1616
#define JUMP_LABEL_NOP_SIZE 4
1717

18+
#define JUMP_TABLE_ENTRY(key, label) \
19+
".pushsection __jump_table, \"aw\" \n\t" \
20+
".long 1b - ., " label " - . \n\t" \
21+
JUMP_ENTRY_TYPE key " - . \n\t" \
22+
".popsection \n\t"
23+
24+
#define ARCH_STATIC_BRANCH_ASM(key, label) \
25+
"1: nop \n\t" \
26+
JUMP_TABLE_ENTRY(key,label)
27+
1828
static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
1929
{
20-
asm goto("1:\n\t"
21-
"nop # arch_static_branch\n\t"
22-
".pushsection __jump_table, \"aw\"\n\t"
23-
".long 1b - ., %l[l_yes] - .\n\t"
24-
JUMP_ENTRY_TYPE "%c0 - .\n\t"
25-
".popsection \n\t"
30+
asm goto(
31+
ARCH_STATIC_BRANCH_ASM("%c0", "%l[l_yes]")
2632
: : "i" (&((char *)key)[branch]) : : l_yes);
2733

2834
return false;
@@ -34,10 +40,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool
3440
{
3541
asm goto("1:\n\t"
3642
"b %l[l_yes] # arch_static_branch_jump\n\t"
37-
".pushsection __jump_table, \"aw\"\n\t"
38-
".long 1b - ., %l[l_yes] - .\n\t"
39-
JUMP_ENTRY_TYPE "%c0 - .\n\t"
40-
".popsection \n\t"
43+
JUMP_TABLE_ENTRY("%c0", "%l[l_yes]")
4144
: : "i" (&((char *)key)[branch]) : : l_yes);
4245

4346
return false;

0 commit comments

Comments
 (0)