Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Vasily Gorbik and committed by
Alexander Gordeev
d538fdc4 92b712fa

+51 -1
+12
arch/s390/boot/boot.h
··· 8 8 9 9 #ifndef __ASSEMBLY__ 10 10 11 + #include <linux/printk.h> 11 12 #include <asm/physmem_info.h> 12 13 13 14 struct machine_info { ··· 77 76 void error(char *m); 78 77 int get_random(unsigned long limit, unsigned long *value); 79 78 79 + #define boot_emerg(fmt, ...) boot_printk(KERN_EMERG fmt, ##__VA_ARGS__) 80 + #define boot_alert(fmt, ...) boot_printk(KERN_ALERT fmt, ##__VA_ARGS__) 81 + #define boot_crit(fmt, ...) boot_printk(KERN_CRIT fmt, ##__VA_ARGS__) 82 + #define boot_err(fmt, ...) boot_printk(KERN_ERR fmt, ##__VA_ARGS__) 83 + #define boot_warn(fmt, ...) boot_printk(KERN_WARNING fmt, ##__VA_ARGS__) 84 + #define boot_notice(fmt, ...) boot_printk(KERN_NOTICE fmt, ##__VA_ARGS__) 85 + #define boot_info(fmt, ...) boot_printk(KERN_INFO fmt, ##__VA_ARGS__) 86 + #define boot_debug(fmt, ...) boot_printk(KERN_DEBUG fmt, ##__VA_ARGS__) 87 + 80 88 extern struct machine_info machine; 89 + extern int boot_console_loglevel; 90 + extern bool boot_ignore_loglevel; 81 91 82 92 /* Symbols defined by linker scripts */ 83 93 extern const char kernel_version[];
+11
arch/s390/boot/ipl_parm.c
··· 313 313 #endif 314 314 if (!strcmp(param, "relocate_lowcore") && test_facility(193)) 315 315 relocate_lowcore = 1; 316 + if (!strcmp(param, "debug")) 317 + boot_console_loglevel = CONSOLE_LOGLEVEL_DEBUG; 318 + if (!strcmp(param, "quiet")) 319 + boot_console_loglevel = CONSOLE_LOGLEVEL_QUIET; 320 + if (!strcmp(param, "ignore_loglevel")) 321 + boot_ignore_loglevel = true; 322 + if (!strcmp(param, "loglevel")) { 323 + boot_console_loglevel = simple_strtoull(val, NULL, 10); 324 + if (boot_console_loglevel < CONSOLE_LOGLEVEL_MIN) 325 + boot_console_loglevel = CONSOLE_LOGLEVEL_MIN; 326 + } 316 327 } 317 328 }
+28 -1
arch/s390/boot/printk.c
··· 11 11 #include <asm/uv.h> 12 12 #include "boot.h" 13 13 14 + int boot_console_loglevel = CONFIG_CONSOLE_LOGLEVEL_DEFAULT; 15 + bool boot_ignore_loglevel; 16 + 14 17 const char hex_asc[] = "0123456789abcdef"; 15 18 16 19 static char *as_hex(char *dst, unsigned long val, int pad) ··· 134 131 return buf; 135 132 } 136 133 134 + static inline int printk_loglevel(const char *buf) 135 + { 136 + if (buf[0] == KERN_SOH_ASCII && buf[1]) { 137 + switch (buf[1]) { 138 + case '0' ... '7': 139 + return buf[1] - '0'; 140 + } 141 + } 142 + return MESSAGE_LOGLEVEL_DEFAULT; 143 + } 144 + 145 + static void boot_console_earlyprintk(const char *buf) 146 + { 147 + int level = printk_loglevel(buf); 148 + 149 + if (boot_ignore_loglevel || level < boot_console_loglevel) 150 + sclp_early_printk(printk_skip_level(buf)); 151 + } 152 + 137 153 #define va_arg_len_type(args, lenmod, typemod) \ 138 154 ((lenmod == 'l') ? va_arg(args, typemod long) : \ 139 155 (lenmod == 'h') ? (typemod short)va_arg(args, typemod int) : \ ··· 171 149 char lenmod; 172 150 ssize_t len; 173 151 int pad; 152 + 153 + if (!printk_get_level(fmt)) { 154 + *p++ = KERN_SOH_ASCII; 155 + *p++ = '0' + MESSAGE_LOGLEVEL_DEFAULT; 156 + } 174 157 175 158 va_start(args, fmt); 176 159 for (; p < end && *fmt; fmt++) { ··· 229 202 } 230 203 out: 231 204 va_end(args); 232 - sclp_early_printk(buf); 205 + boot_console_earlyprintk(buf); 233 206 }