Le 04/02/2026 à 22:01, Mukesh Kumar Chaurasiya (IBM) a écrit :
[Vous ne recevez pas souvent de courriers de [email protected]. 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 <[email protected]>
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <[email protected]>

Reviewed-by: Christophe Leroy (CS GROUP) <[email protected]>

---
  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



Reply via email to