提交 689ffc56 编写于 作者: W Wenting Zhang 提交者: Lipeng Sang

riscv: always honor the CONFIG_CMDLINE_FORCE when parsing dtb

stable inclusion
from stable-v5.10.152
commit 86e995f964f6ebc1ff48b0e1649f03b2c8931088
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I73HJ0

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=86e995f964f6ebc1ff48b0e1649f03b2c8931088

--------------------------------

[ Upstream commit 10f6913c ]

When CONFIG_CMDLINE_FORCE is enabled, cmdline provided by
CONFIG_CMDLINE are always used. This allows CONFIG_CMDLINE to be
used regardless of the result of device tree scanning.

This especially fixes the case where a device tree without the
chosen node is supplied to the kernel. In such cases,
early_init_dt_scan would return true. But inside
early_init_dt_scan_chosen, the cmdline won't be updated as there
is no chosen node in the device tree. As a result, CONFIG_CMDLINE
is not copied into boot_command_line even if CONFIG_CMDLINE_FORCE
is enabled. This commit allows properly update boot_command_line
in this situation.

Fixes: 8fd6e05c ("arch: riscv: support kernel command line forcing when no DTB passed")
Signed-off-by: NWenting Zhang <zephray@outlook.com>
Reviewed-by: NBjörn Töpel <bjorn@kernel.org>
Reviewed-by: NConor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/PSBPR04MB399135DFC54928AB958D0638B1829@PSBPR04MB3991.apcprd04.prod.outlook.com
Cc: stable@vger.kernel.org
Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NLipeng Sang <sanglipeng1@jd.com>
上级 3cfa5d64
...@@ -61,10 +61,10 @@ static void __init parse_dtb(void) ...@@ -61,10 +61,10 @@ static void __init parse_dtb(void)
pr_info("Machine model: %s\n", name); pr_info("Machine model: %s\n", name);
dump_stack_set_arch_desc("%s (DT)", name); dump_stack_set_arch_desc("%s (DT)", name);
} }
return; } else {
pr_err("No DTB passed to the kernel\n");
} }
pr_err("No DTB passed to the kernel\n");
#ifdef CONFIG_CMDLINE_FORCE #ifdef CONFIG_CMDLINE_FORCE
strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
pr_info("Forcing kernel command line to: %s\n", boot_command_line); pr_info("Forcing kernel command line to: %s\n", boot_command_line);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册