diff options
author | Vasily Gorbik <gor@linux.ibm.com> | 2024-11-20 16:56:12 +0100 |
---|---|---|
committer | Alexander Gordeev <agordeev@linux.ibm.com> | 2025-01-26 17:24:00 +0100 |
commit | d538fdc49a7d7dd068fc29bcc6093e8dd45abbd9 (patch) | |
tree | d3ad6f86da45ee48ef9f065c6d05467a79f87646 | |
parent | 92b712fa7d5b67ffa3d1ee6147643e9f60154c10 (diff) |
s390/boot: Add support for boot messages loglevels
Add message severity levels for boot messages, similar to the main
kernel. Support command-line options that control console output
verbosity, including "loglevel," "ignore_loglevel," "debug," and "quiet".
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-rw-r--r-- | arch/s390/boot/boot.h | 12 | ||||
-rw-r--r-- | arch/s390/boot/ipl_parm.c | 11 | ||||
-rw-r--r-- | arch/s390/boot/printk.c | 29 |
3 files changed, 51 insertions, 1 deletions
diff --git a/arch/s390/boot/boot.h b/arch/s390/boot/boot.h index ce8422d8f9a8..80e86387bee5 100644 --- a/arch/s390/boot/boot.h +++ b/arch/s390/boot/boot.h @@ -8,6 +8,7 @@ #ifndef __ASSEMBLY__ +#include <linux/printk.h> #include <asm/physmem_info.h> struct machine_info { @@ -76,7 +77,18 @@ void print_stacktrace(unsigned long sp); void error(char *m); int get_random(unsigned long limit, unsigned long *value); +#define boot_emerg(fmt, ...) boot_printk(KERN_EMERG fmt, ##__VA_ARGS__) +#define boot_alert(fmt, ...) boot_printk(KERN_ALERT fmt, ##__VA_ARGS__) +#define boot_crit(fmt, ...) boot_printk(KERN_CRIT fmt, ##__VA_ARGS__) +#define boot_err(fmt, ...) boot_printk(KERN_ERR fmt, ##__VA_ARGS__) +#define boot_warn(fmt, ...) boot_printk(KERN_WARNING fmt, ##__VA_ARGS__) +#define boot_notice(fmt, ...) boot_printk(KERN_NOTICE fmt, ##__VA_ARGS__) +#define boot_info(fmt, ...) boot_printk(KERN_INFO fmt, ##__VA_ARGS__) +#define boot_debug(fmt, ...) boot_printk(KERN_DEBUG fmt, ##__VA_ARGS__) + extern struct machine_info machine; +extern int boot_console_loglevel; +extern bool boot_ignore_loglevel; /* Symbols defined by linker scripts */ extern const char kernel_version[]; diff --git a/arch/s390/boot/ipl_parm.c b/arch/s390/boot/ipl_parm.c index 557462e62cd7..b3fb0b672968 100644 --- a/arch/s390/boot/ipl_parm.c +++ b/arch/s390/boot/ipl_parm.c @@ -313,5 +313,16 @@ void parse_boot_command_line(void) #endif if (!strcmp(param, "relocate_lowcore") && test_facility(193)) relocate_lowcore = 1; + if (!strcmp(param, "debug")) + boot_console_loglevel = CONSOLE_LOGLEVEL_DEBUG; + if (!strcmp(param, "quiet")) + boot_console_loglevel = CONSOLE_LOGLEVEL_QUIET; + if (!strcmp(param, "ignore_loglevel")) + boot_ignore_loglevel = true; + if (!strcmp(param, "loglevel")) { + boot_console_loglevel = simple_strtoull(val, NULL, 10); + if (boot_console_loglevel < CONSOLE_LOGLEVEL_MIN) + boot_console_loglevel = CONSOLE_LOGLEVEL_MIN; + } } } diff --git a/arch/s390/boot/printk.c b/arch/s390/boot/printk.c index 41e576da1a4f..7eeb43821cd0 100644 --- a/arch/s390/boot/printk.c +++ b/arch/s390/boot/printk.c @@ -11,6 +11,9 @@ #include <asm/uv.h> #include "boot.h" +int boot_console_loglevel = CONFIG_CONSOLE_LOGLEVEL_DEFAULT; +bool boot_ignore_loglevel; + const char hex_asc[] = "0123456789abcdef"; static char *as_hex(char *dst, unsigned long val, int pad) @@ -131,6 +134,25 @@ static noinline char *strsym(char *buf, void *ip) return buf; } +static inline int printk_loglevel(const char *buf) +{ + if (buf[0] == KERN_SOH_ASCII && buf[1]) { + switch (buf[1]) { + case '0' ... '7': + return buf[1] - '0'; + } + } + return MESSAGE_LOGLEVEL_DEFAULT; +} + +static void boot_console_earlyprintk(const char *buf) +{ + int level = printk_loglevel(buf); + + if (boot_ignore_loglevel || level < boot_console_loglevel) + sclp_early_printk(printk_skip_level(buf)); +} + #define va_arg_len_type(args, lenmod, typemod) \ ((lenmod == 'l') ? va_arg(args, typemod long) : \ (lenmod == 'h') ? (typemod short)va_arg(args, typemod int) : \ @@ -150,6 +172,11 @@ void boot_printk(const char *fmt, ...) ssize_t len; int pad; + if (!printk_get_level(fmt)) { + *p++ = KERN_SOH_ASCII; + *p++ = '0' + MESSAGE_LOGLEVEL_DEFAULT; + } + va_start(args, fmt); for (; p < end && *fmt; fmt++) { if (*fmt != '%') { @@ -202,5 +229,5 @@ void boot_printk(const char *fmt, ...) } out: va_end(args); - sclp_early_printk(buf); + boot_console_earlyprintk(buf); } |