[PATCH] riscv: Add machine name to kernel boot log and stack dump output
Palmer Dabbelt
palmerdabbelt at google.com
Sat Jan 9 17:21:21 EST 2021
On Mon, 14 Dec 2020 03:31:03 PST (-0800), wangkefeng.wang at huawei.com wrote:
> Hi Palmer, kindly ping..
>
> On 2020/11/25 19:44, Kefeng Wang wrote:
>> Add the machine name to kernel boot-up log, and install
>> the machine name to stack dump for DT boot mode.
>>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang at huawei.com>
>> ---
>>
>> Here is the message after patched,
>>
>> root@(none):~# dmesg |grep "Machine model"
>> [ 0.000000] Machine model: riscv-virtio,qemu
>>
>> root@(none):~# echo c > /proc/sysrq-trigger
>> [ 1519.475346] sysrq: Trigger a crash
>> [ 1519.476004] Kernel panic - not syncing: sysrq triggered crash
>> [ 1519.476480] CPU: 0 PID: 64 Comm: sh Not tainted 5.10.0-rc5 #246
>> [ 1519.476877] Hardware name: riscv-virtio,qemu (DT)
>> [ 1519.477169] Call Trace:
>> ...
>>
>> arch/riscv/kernel/setup.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
>> index c424cc6dd833..901ac0c680dd 100644
>> --- a/arch/riscv/kernel/setup.c
>> +++ b/arch/riscv/kernel/setup.c
>> @@ -54,8 +54,15 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
>> static void __init parse_dtb(void)
>> {
>> /* Early scan of device tree from init memory */
>> - if (early_init_dt_scan(dtb_early_va))
>> + if (early_init_dt_scan(dtb_early_va)) {
>> + const char *name = of_flat_dt_get_machine_name();
>> +
>> + if (name) {
>> + pr_info("Machine model: %s\n", name);
>> + dump_stack_set_arch_desc("%s (DT)", name);
>> + }
>> return;
>> + }
>>
>> pr_err("No DTB passed to the kernel\n");
>> #ifdef CONFIG_CMDLINE_FORCE
Thanks, this is on for-next.
More information about the linux-riscv
mailing list