Skip to content

Commit c09f8d0

Browse files
Vasily GorbikAlexander Gordeev
authored andcommitted
s390/boot: Defer boot messages when earlyprintk is not enabled
When earlyprintk is not specified, boot messages are only stored in a ring buffer to be printed later by printk when console driver is registered. Critical messages from boot_emerg() are always printed immediately, even without earlyprintk. Signed-off-by: Vasily Gorbik <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 847e5a4 commit c09f8d0

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

arch/s390/boot/ipl_parm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ void parse_boot_command_line(void)
313313
#endif
314314
if (!strcmp(param, "relocate_lowcore") && test_facility(193))
315315
relocate_lowcore = 1;
316+
if (!strcmp(param, "earlyprintk"))
317+
boot_earlyprintk = true;
316318
if (!strcmp(param, "debug"))
317319
boot_console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
318320
if (!strcmp(param, "quiet"))

arch/s390/boot/printk.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/ctype.h>
66
#include <asm/stacktrace.h>
77
#include <asm/boot_data.h>
8+
#include <asm/sections.h>
89
#include <asm/lowcore.h>
910
#include <asm/setup.h>
1011
#include <asm/sclp.h>
@@ -13,8 +14,9 @@
1314

1415
int boot_console_loglevel = CONFIG_CONSOLE_LOGLEVEL_DEFAULT;
1516
bool boot_ignore_loglevel;
16-
char boot_rb[PAGE_SIZE * 2];
17-
size_t boot_rb_off;
17+
char __bootdata(boot_rb)[PAGE_SIZE * 2];
18+
bool __bootdata(boot_earlyprintk);
19+
size_t __bootdata(boot_rb_off);
1820

1921
static void boot_rb_add(const char *str, size_t len)
2022
{
@@ -163,6 +165,9 @@ static void boot_console_earlyprintk(const char *buf)
163165
{
164166
int level = printk_loglevel(buf);
165167

168+
/* always print emergency messages */
169+
if (level > LOGLEVEL_EMERG && !boot_earlyprintk)
170+
return;
166171
if (boot_ignore_loglevel || level < boot_console_loglevel)
167172
sclp_early_printk(printk_skip_level(buf));
168173
}

arch/s390/include/asm/boot_data.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extern unsigned long early_ipl_comp_list_addr;
1616
extern unsigned long early_ipl_comp_list_size;
1717

1818
extern char boot_rb[PAGE_SIZE * 2];
19+
extern bool boot_earlyprintk;
1920
extern size_t boot_rb_off;
2021

2122
#define boot_rb_foreach(cb) \

arch/s390/kernel/setup.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ u64 __bootdata_preserved(stfle_fac_list[16]);
157157
EXPORT_SYMBOL(stfle_fac_list);
158158
struct oldmem_data __bootdata_preserved(oldmem_data);
159159

160+
char __bootdata(boot_rb)[PAGE_SIZE * 2];
161+
bool __bootdata(boot_earlyprintk);
162+
size_t __bootdata(boot_rb_off);
163+
160164
unsigned long __bootdata_preserved(VMALLOC_START);
161165
EXPORT_SYMBOL(VMALLOC_START);
162166

@@ -877,6 +881,17 @@ static void __init log_component_list(void)
877881
}
878882
}
879883

884+
/*
885+
* Print avoiding interpretation of % in buf
886+
*/
887+
static void __init print_rb_entry(char *buf)
888+
{
889+
char fmt[] = KERN_SOH "0boot: %s";
890+
891+
fmt[1] = printk_get_level(buf);
892+
printk(fmt, printk_skip_level(buf));
893+
}
894+
880895
/*
881896
* Setup function called from init/main.c just after the banner
882897
* was printed.
@@ -896,6 +911,9 @@ void __init setup_arch(char **cmdline_p)
896911
pr_info("Linux is running natively in 64-bit mode\n");
897912
else
898913
pr_info("Linux is running as a guest in 64-bit mode\n");
914+
/* Print decompressor messages if not already printed */
915+
if (!boot_earlyprintk)
916+
boot_rb_foreach(print_rb_entry);
899917

900918
if (have_relocated_lowcore())
901919
pr_info("Lowcore relocated to 0x%px\n", get_lowcore());

0 commit comments

Comments
 (0)