]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
s390/boot: Replace boot_printk() with loglevel-specific helpers
authorVasily Gorbik <gor@linux.ibm.com>
Wed, 20 Nov 2024 16:07:56 +0000 (17:07 +0100)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Sun, 26 Jan 2025 16:24:00 +0000 (17:24 +0100)
Replaces boot_printk() calls with appropriate loglevel-specific helpers
such as boot_emerg(), boot_warn(), and boot_debug().

Using functions with explicit log levels improves log clarity and aligns
the boot code with standard kernel logging practices. This makes it
easier to filter and manage boot-time messages based on their severity.

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>
arch/s390/boot/als.c
arch/s390/boot/ipl_parm.c
arch/s390/boot/kaslr.c
arch/s390/boot/pgm_check_info.c
arch/s390/boot/physmem_info.c
arch/s390/boot/startup.c

index 11e0c3d5dbc8c143f68363b85fd093472d5aaf87..79afb5fa7f1f327d5b8154c2f1f839b9e9051316 100644 (file)
@@ -46,7 +46,7 @@ void print_missing_facilities(void)
                         * z/VM adds a four character prefix.
                         */
                        if (strlen(als_str) > 70) {
-                               boot_printk("%s\n", als_str);
+                               boot_emerg("%s\n", als_str);
                                *als_str = '\0';
                        }
                        u16_to_decimal(val_str, i * BITS_PER_LONG + j);
@@ -54,7 +54,7 @@ void print_missing_facilities(void)
                        first = 0;
                }
        }
-       boot_printk("%s\n", als_str);
+       boot_emerg("%s\n", als_str);
 }
 
 static void facility_mismatch(void)
@@ -62,10 +62,10 @@ static void facility_mismatch(void)
        struct cpuid id;
 
        get_cpu_id(&id);
-       boot_printk("The Linux kernel requires more recent processor hardware\n");
-       boot_printk("Detected machine-type number: %4x\n", id.machine);
+       boot_emerg("The Linux kernel requires more recent processor hardware\n");
+       boot_emerg("Detected machine-type number: %4x\n", id.machine);
        print_missing_facilities();
-       boot_printk("See Principles of Operations for facility bits\n");
+       boot_emerg("See Principles of Operations for facility bits\n");
        disabled_wait();
 }
 
index b3fb0b6729688afdcefb003d7e31a8d552bdab9a..3f775bd6d9a230c697c1e3c013b412a7b966d355 100644 (file)
@@ -215,7 +215,7 @@ static void check_cleared_facilities(void)
 
        for (i = 0; i < ARRAY_SIZE(als); i++) {
                if ((stfle_fac_list[i] & als[i]) != als[i]) {
-                       boot_printk("Warning: The Linux kernel requires facilities cleared via command line option\n");
+                       boot_emerg("The Linux kernel requires facilities cleared via command line option\n");
                        print_missing_facilities();
                        break;
                }
index d6761e1e2f8d445f47036e2ffddaebada0c8dec5..941f4c9e27cca043a5c4e3c738d82bf95d70b4e8 100644 (file)
@@ -32,7 +32,7 @@ struct prng_parm {
 static int check_prng(void)
 {
        if (!cpacf_query_func(CPACF_KMC, CPACF_KMC_PRNG)) {
-               boot_printk("KASLR disabled: CPU has no PRNG\n");
+               boot_warn("KASLR disabled: CPU has no PRNG\n");
                return 0;
        }
        if (cpacf_query_func(CPACF_PRNO, CPACF_PRNO_TRNG))
index 5abe59fb3bc08ec36f536522e70373c302e90d0b..0d20336e170b78b4c896374eacbe0ed9ca1b4fb3 100644 (file)
@@ -17,13 +17,14 @@ void print_stacktrace(unsigned long sp)
                                         (unsigned long)_stack_end };
        bool first = true;
 
-       boot_printk("Call Trace:\n");
+       boot_emerg("Call Trace:\n");
        while (!(sp & 0x7) && on_stack(&boot_stack, sp, sizeof(struct stack_frame))) {
                struct stack_frame *sf = (struct stack_frame *)sp;
 
-               boot_printk(first ? "(sp:%016lx [<%016lx>] %pS)\n" :
-                                   " sp:%016lx [<%016lx>] %pS\n",
-                           sp, sf->gprs[8], (void *)sf->gprs[8]);
+               if (first)
+                       boot_emerg("(sp:%016lx [<%016lx>] %pS)\n", sp, sf->gprs[8], (void *)sf->gprs[8]);
+               else
+                       boot_emerg(" sp:%016lx [<%016lx>] %pS\n", sp, sf->gprs[8], (void *)sf->gprs[8]);
                if (sf->back_chain <= sp)
                        break;
                sp = sf->back_chain;
@@ -36,30 +37,28 @@ void print_pgm_check_info(void)
        unsigned long *gpregs = (unsigned long *)get_lowcore()->gpregs_save_area;
        struct psw_bits *psw = &psw_bits(get_lowcore()->psw_save_area);
 
-       boot_printk("Linux version %s\n", kernel_version);
+       boot_emerg("Linux version %s\n", kernel_version);
        if (!is_prot_virt_guest() && early_command_line[0])
-               boot_printk("Kernel command line: %s\n", early_command_line);
-       boot_printk("Kernel fault: interruption code %04x ilc:%x\n",
-                   get_lowcore()->pgm_code, get_lowcore()->pgm_ilc >> 1);
+               boot_emerg("Kernel command line: %s\n", early_command_line);
+       boot_emerg("Kernel fault: interruption code %04x ilc:%x\n",
+                  get_lowcore()->pgm_code, get_lowcore()->pgm_ilc >> 1);
        if (kaslr_enabled()) {
-               boot_printk("Kernel random base: %lx\n", __kaslr_offset);
-               boot_printk("Kernel random base phys: %lx\n", __kaslr_offset_phys);
+               boot_emerg("Kernel random base: %lx\n", __kaslr_offset);
+               boot_emerg("Kernel random base phys: %lx\n", __kaslr_offset_phys);
        }
-       boot_printk("PSW : %016lx %016lx (%pS)\n",
-                   get_lowcore()->psw_save_area.mask,
-                   get_lowcore()->psw_save_area.addr,
-                   (void *)get_lowcore()->psw_save_area.addr);
-       boot_printk(
-               "      R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x P:%x AS:%x CC:%x PM:%x RI:%x EA:%x\n",
-               psw->per, psw->dat, psw->io, psw->ext, psw->key, psw->mcheck,
-               psw->wait, psw->pstate, psw->as, psw->cc, psw->pm, psw->ri,
-               psw->eaba);
-       boot_printk("GPRS: %016lx %016lx %016lx %016lx\n", gpregs[0], gpregs[1], gpregs[2], gpregs[3]);
-       boot_printk("      %016lx %016lx %016lx %016lx\n", gpregs[4], gpregs[5], gpregs[6], gpregs[7]);
-       boot_printk("      %016lx %016lx %016lx %016lx\n", gpregs[8], gpregs[9], gpregs[10], gpregs[11]);
-       boot_printk("      %016lx %016lx %016lx %016lx\n", gpregs[12], gpregs[13], gpregs[14], gpregs[15]);
+       boot_emerg("PSW : %016lx %016lx (%pS)\n",
+                  get_lowcore()->psw_save_area.mask,
+                  get_lowcore()->psw_save_area.addr,
+                  (void *)get_lowcore()->psw_save_area.addr);
+       boot_emerg("      R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x P:%x AS:%x CC:%x PM:%x RI:%x EA:%x\n",
+                  psw->per, psw->dat, psw->io, psw->ext, psw->key, psw->mcheck,
+                  psw->wait, psw->pstate, psw->as, psw->cc, psw->pm, psw->ri, psw->eaba);
+       boot_emerg("GPRS: %016lx %016lx %016lx %016lx\n", gpregs[0], gpregs[1], gpregs[2], gpregs[3]);
+       boot_emerg("      %016lx %016lx %016lx %016lx\n", gpregs[4], gpregs[5], gpregs[6], gpregs[7]);
+       boot_emerg("      %016lx %016lx %016lx %016lx\n", gpregs[8], gpregs[9], gpregs[10], gpregs[11]);
+       boot_emerg("      %016lx %016lx %016lx %016lx\n", gpregs[12], gpregs[13], gpregs[14], gpregs[15]);
        print_stacktrace(get_lowcore()->gpregs_save_area[15]);
-       boot_printk("Last Breaking-Event-Address:\n");
-       boot_printk(" [<%016lx>] %pS\n", (unsigned long)get_lowcore()->pgm_last_break,
-                   (void *)get_lowcore()->pgm_last_break);
+       boot_emerg("Last Breaking-Event-Address:\n");
+       boot_emerg(" [<%016lx>] %pS\n", (unsigned long)get_lowcore()->pgm_last_break,
+                  (void *)get_lowcore()->pgm_last_break);
 }
index f585f015abfe2fb0a0bc5ad929ac21463f3c338b..4cfd5ef1af4f7fbce4b1a46180e42baeaf605ff1 100644 (file)
@@ -241,27 +241,27 @@ static void die_oom(unsigned long size, unsigned long align, unsigned long min,
        enum reserved_range_type t;
        int i;
 
-       boot_printk("Linux version %s\n", kernel_version);
+       boot_emerg("Linux version %s\n", kernel_version);
        if (!is_prot_virt_guest() && early_command_line[0])
-               boot_printk("Kernel command line: %s\n", early_command_line);
-       boot_printk("Out of memory allocating %lx bytes %lx aligned in range %lx:%lx\n",
-                   size, align, min, max);
-       boot_printk("Reserved memory ranges:\n");
+               boot_emerg("Kernel command line: %s\n", early_command_line);
+       boot_emerg("Out of memory allocating %lx bytes %lx aligned in range %lx:%lx\n",
+                  size, align, min, max);
+       boot_emerg("Reserved memory ranges:\n");
        for_each_physmem_reserved_range(t, range, &start, &end) {
-               boot_printk("%016lx %016lx %s\n", start, end, get_rr_type_name(t));
+               boot_emerg("%016lx %016lx %s\n", start, end, get_rr_type_name(t));
                total_reserved_mem += end - start;
        }
-       boot_printk("Usable online memory ranges (info source: %s [%x]):\n",
-                   get_physmem_info_source(), physmem_info.info_source);
+       boot_emerg("Usable online memory ranges (info source: %s [%x]):\n",
+                  get_physmem_info_source(), physmem_info.info_source);
        for_each_physmem_usable_range(i, &start, &end) {
-               boot_printk("%016lx %016lx\n", start, end);
+               boot_emerg("%016lx %016lx\n", start, end);
                total_mem += end - start;
        }
-       boot_printk("Usable online memory total: %lx Reserved: %lx Free: %lx\n",
-                   total_mem, total_reserved_mem,
-                   total_mem > total_reserved_mem ? total_mem - total_reserved_mem : 0);
+       boot_emerg("Usable online memory total: %lx Reserved: %lx Free: %lx\n",
+                  total_mem, total_reserved_mem,
+                  total_mem > total_reserved_mem ? total_mem - total_reserved_mem : 0);
        print_stacktrace(current_frame_address());
-       boot_printk("\n\n -- System halted\n");
+       boot_emerg(" -- System halted\n");
        disabled_wait();
 }
 
index 70f90a19007a0a834520bfadc43d0447625321ea..e9ae589c616944c61e276c1839bbc51ecccd404e 100644 (file)
@@ -42,7 +42,8 @@ struct machine_info machine;
 
 void error(char *x)
 {
-       boot_printk("\n\n%s\n\n -- System halted", x);
+       boot_emerg("%s\n", x);
+       boot_emerg(" -- System halted\n");
        disabled_wait();
 }
 
@@ -305,7 +306,7 @@ static unsigned long setup_kernel_memory_layout(unsigned long kernel_size)
                kernel_start = round_down(kernel_end - kernel_size, THREAD_SIZE);
        } else if (vmax < __NO_KASLR_END_KERNEL || vsize > __NO_KASLR_END_KERNEL) {
                kernel_start = round_down(vmax - kernel_size, THREAD_SIZE);
-               boot_printk("The kernel base address is forced to %lx\n", kernel_start);
+               boot_debug("The kernel base address is forced to %lx\n", kernel_start);
        } else {
                kernel_start = __NO_KASLR_START_KERNEL;
        }