Skip to content

Commit b3597eb

Browse files
hcahcaAlexander Gordeev
authored andcommitted
s390/boot: Add common boot_panic() code
Introduce a common boot_panic() helper macro, and use it to get rid of three more or less identical implementations. Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 parent 669bc57 commit b3597eb

4 files changed

Lines changed: 13 additions & 16 deletions

File tree

arch/s390/boot/boot.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <linux/printk.h>
1212
#include <asm/physmem_info.h>
13+
#include <asm/stacktrace.h>
1314

1415
struct vmlinux_info {
1516
unsigned long entry;
@@ -89,6 +90,13 @@ void __noreturn jump_to_kernel(psw_t *psw);
8990
#define boot_info(fmt, ...) boot_printk(KERN_INFO boot_fmt(fmt), ##__VA_ARGS__)
9091
#define boot_debug(fmt, ...) boot_printk(KERN_DEBUG boot_fmt(fmt), ##__VA_ARGS__)
9192

93+
#define boot_panic(...) do { \
94+
boot_emerg(__VA_ARGS__); \
95+
print_stacktrace(current_frame_address()); \
96+
boot_emerg(" -- System halted\n"); \
97+
disabled_wait(); \
98+
} while (0)
99+
92100
extern struct machine_info machine;
93101
extern int boot_console_loglevel;
94102
extern bool boot_ignore_loglevel;

arch/s390/boot/decompressor.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ static void decompress_error(char *m)
6868
{
6969
if (bootdebug)
7070
boot_rb_dump();
71-
boot_emerg("Decompression error: %s\n", m);
72-
boot_emerg(" -- System halted\n");
73-
disabled_wait();
71+
boot_panic("Decompression error: %s\n", m);
7472
}
7573

7674
unsigned long mem_safe_offset(void)

arch/s390/boot/physmem_info.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ static void die_oom(unsigned long size, unsigned long align, unsigned long min,
228228
boot_emerg("Usable online memory total: %lu Reserved: %lu Free: %lu\n",
229229
total_mem, total_reserved_mem,
230230
total_mem > total_reserved_mem ? total_mem - total_reserved_mem : 0);
231-
print_stacktrace(current_frame_address());
232-
boot_emerg(" -- System halted\n");
233-
disabled_wait();
231+
boot_panic("Oom\n");
234232
}
235233

236234
static void _physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size)

arch/s390/boot/startup.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ u64 __bootdata_preserved(clock_comparator_max) = -1UL;
4444
u64 __bootdata_preserved(stfle_fac_list[16]);
4545
struct oldmem_data __bootdata_preserved(oldmem_data);
4646

47-
void error(char *x)
48-
{
49-
boot_emerg("%s\n", x);
50-
boot_emerg(" -- System halted\n");
51-
disabled_wait();
52-
}
53-
5447
static char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE);
5548

5649
static void detect_machine_type(void)
@@ -220,10 +213,10 @@ static void rescue_initrd(unsigned long min, unsigned long max)
220213
static void copy_bootdata(void)
221214
{
222215
if (__boot_data_end - __boot_data_start != vmlinux.bootdata_size)
223-
error(".boot.data section size mismatch");
216+
boot_panic(".boot.data section size mismatch\n");
224217
memcpy((void *)vmlinux.bootdata_off, __boot_data_start, vmlinux.bootdata_size);
225218
if (__boot_data_preserved_end - __boot_data_preserved_start != vmlinux.bootdata_preserved_size)
226-
error(".boot.preserved.data section size mismatch");
219+
boot_panic(".boot.preserved.data section size mismatch\n");
227220
memcpy((void *)vmlinux.bootdata_preserved_off, __boot_data_preserved_start, vmlinux.bootdata_preserved_size);
228221
}
229222

@@ -237,7 +230,7 @@ static void kaslr_adjust_relocs(unsigned long min_addr, unsigned long max_addr,
237230
for (reloc = (int *)__vmlinux_relocs_64_start; reloc < (int *)__vmlinux_relocs_64_end; reloc++) {
238231
loc = (long)*reloc + phys_offset;
239232
if (loc < min_addr || loc > max_addr)
240-
error("64-bit relocation outside of kernel!\n");
233+
boot_panic("64-bit relocation outside of kernel!\n");
241234
*(u64 *)loc += offset;
242235
}
243236
}

0 commit comments

Comments
 (0)