]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/bug: Provide ARCH_WARN_ASM for Rust WARN/BUG support
authorJan Polensky <japo@linux.ibm.com>
Mon, 1 Jun 2026 17:46:20 +0000 (19:46 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Wed, 10 Jun 2026 14:25:12 +0000 (16:25 +0200)
Rust WARN and BUG support relies on ARCH_WARN_ASM to emit __bug_table
entries. On s390 the macro is missing, so Rust code cannot generate
proper WARN/BUG metadata for the kernel's bug reporting infrastructure.

Define ARCH_WARN_ASM to produce the same assembly sequence and
__bug_table entry format as the existing s390 BUG handling, including
the monitor call. Define ARCH_WARN_REACHABLE as empty since s390 does
not provide reachability analysis for warning paths.

Acked-by: Gary Guo <gary@garyguo.net>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/include/asm/bug.h

index 59017fd3d9358d495fc06ec9775b12cbb4c27f37..d8e65885e9355e72258e36ad565ea4522e02e589 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <linux/compiler.h>
 #include <linux/const.h>
+#include <linux/stringify.h>
 
 #define        MONCODE_BUG     _AC(0, U)
 #define        MONCODE_BUG_ARG _AC(1, U)
@@ -121,6 +122,17 @@ do {                                                                       \
 #define HAVE_ARCH_BUG_FORMAT
 #define HAVE_ARCH_BUG_FORMAT_ARGS
 
+#define ARCH_WARN_ASM(file, line, flags, size)                         \
+       ".section .rodata.str,\"aMS\",@progbits,1\n"                    \
+       "9:\n"                                                          \
+       ".asciz \"\"\n"         /* Empty string for compatibility */    \
+       ".previous\n"                                                   \
+       "0:\n"                                                          \
+       __stringify(mc 0(%r0),0) "\n"                                   \
+       __BUG_ENTRY("9b", file, line, flags, size)
+
+#define ARCH_WARN_REACHABLE
+
 #endif /* CONFIG_BUG && CONFIG_CC_HAS_ASM_IMMEDIATE_STRINGS */
 #endif /* __ASSEMBLER__ */