]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/bug: Introduce and use monitor code macro
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 9 Jan 2026 15:31:39 +0000 (16:31 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 27 Jan 2026 11:16:16 +0000 (12:16 +0100)
The first operand address of the monitor call (mc) instruction is the
monitor code. Currently the monitor code is ignored, but this will
change. Therefore add and use MONCODE_BUG instead of a hardcoded zero.

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/bug.h
arch/s390/kernel/traps.c

index 7e0498f22f2a2ba373c63993eb8d256f601d7392..faa556226c0053c659bb4c15fa6bcfcf328b924d 100644 (file)
@@ -3,7 +3,11 @@
 #define _ASM_S390_BUG_H
 
 #include <linux/compiler.h>
+#include <linux/const.h>
 
+#define        MONCODE_BUG     _AC(0, U)
+
+#ifndef __ASSEMBLER__
 #if defined(CONFIG_BUG) && defined(CONFIG_CC_HAS_ASM_IMMEDIATE_STRINGS)
 
 #ifdef CONFIG_DEBUG_BUGVERBOSE
@@ -24,7 +28,7 @@
 #define __BUG_ASM(cond_str, flags)                                     \
 do {                                                                   \
        asm_inline volatile("\n"                                        \
-               "0:     mc      0,0\n"                                  \
+               "0:     mc      %[monc](%%r0),0\n"                      \
                "       .section __bug_table,\"aw\"\n"                  \
                "1:     .long   0b - .  # bug_entry::bug_addr\n"        \
                __BUG_ENTRY_VERBOSE("%[frmt]", "%[file]", "%[line]")    \
@@ -32,7 +36,8 @@ do {                                                                  \
                "       .org    1b+%[size]\n"                           \
                "       .previous"                                      \
                :                                                       \
-               : [frmt] "i" (WARN_CONDITION_STR(cond_str)),            \
+               : [monc] "i" (MONCODE_BUG),                             \
+                 [frmt] "i" (WARN_CONDITION_STR(cond_str)),            \
                  [file] "i" (__FILE__),                                \
                  [line] "i" (__LINE__),                                \
                  [flgs] "i" (flags),                                   \
@@ -54,6 +59,7 @@ do {                                                                  \
 #define HAVE_ARCH_BUG_FORMAT
 
 #endif /* CONFIG_BUG && CONFIG_CC_HAS_ASM_IMMEDIATE_STRINGS */
+#endif /* __ASSEMBLER__ */
 
 #include <asm-generic/bug.h>
 
index 19687dab32f7ab89891348ab509cd0cefa9c0328..de63e98e724bf66b6d22bd6118e156fe300fec44 100644 (file)
@@ -258,11 +258,12 @@ static void __init test_monitor_call(void)
        if (!IS_ENABLED(CONFIG_BUG))
                return;
        asm_inline volatile(
-               "       mc      0,0\n"
+               "       mc      %[monc](%%r0),0\n"
                "0:     lhi     %[val],0\n"
                "1:\n"
                EX_TABLE(0b, 1b)
-               : [val] "+d" (val));
+               : [val] "+d" (val)
+               : [monc] "i" (MONCODE_BUG));
        if (!val)
                panic("Monitor call doesn't work!\n");
 }