* [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
@ 2023-07-09 13:32 Dong Zhihong
2023-07-09 13:34 ` Randy Dunlap
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Dong Zhihong @ 2023-07-09 13:32 UTC (permalink / raw)
To: chenhuacai, kernel
Cc: ardb, tangyouling, zhoubinbin, yangtiezhu, donmor3000, tglx,
loongarch, linux-kernel
This patch tends to fix broken CONFIG_CMDLINE, which is not working with
CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER. Some code is absent in
arch/loongarch/kernel/setup.c, which should handle built-in command lines
in CONFIG_CMDLINE. The absence of such code causes CONFIG_CMDLINE not
working if CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER is set to Y.
CONFIG_CMDLINE_FORCE is not affected.
Signed-off-by: Dong Zhihong <donmor3000@hotmail.com>
---
arch/loongarch/kernel/setup.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 78a00359bde3..504218b94879 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -335,6 +335,22 @@ static void __init bootcmdline_init(char **cmdline_p)
}
#endif
+#ifdef CONFIG_CMDLINE
+ /*
+ * If CONFIG_CMDLINE_BOOTLOADER is enabled then we use thei built-in
+ * command line if no command line given, or we append given command
+ * line to the built-in one if CONFIG_CMDLINE_EXTEND is enabled.
+ */
+ if (IS_ENABLED(CONFIG_CMDLINE_EXTEND)) {
+ strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+ strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
+ strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
+ }
+
+ if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
+ strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif
+
out:
*cmdline_p = boot_command_line;
}
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
2023-07-09 13:32 [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER Dong Zhihong
@ 2023-07-09 13:34 ` Randy Dunlap
2023-07-09 15:30 ` Huacai Chen
[not found] ` <380911b1-13b0-2c69-7adf-f40abb604c6c@web.de>
2 siblings, 0 replies; 8+ messages in thread
From: Randy Dunlap @ 2023-07-09 13:34 UTC (permalink / raw)
To: Dong Zhihong, chenhuacai, kernel
Cc: ardb, tangyouling, zhoubinbin, yangtiezhu, tglx, loongarch, linux-kernel
On 7/9/23 06:32, Dong Zhihong wrote:
> This patch tends to fix broken CONFIG_CMDLINE, which is not working with
> CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER. Some code is absent in
> arch/loongarch/kernel/setup.c, which should handle built-in command lines
> in CONFIG_CMDLINE. The absence of such code causes CONFIG_CMDLINE not
> working if CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER is set to Y.
> CONFIG_CMDLINE_FORCE is not affected.
>
> Signed-off-by: Dong Zhihong <donmor3000@hotmail.com>
> ---
> arch/loongarch/kernel/setup.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
> index 78a00359bde3..504218b94879 100644
> --- a/arch/loongarch/kernel/setup.c
> +++ b/arch/loongarch/kernel/setup.c
> @@ -335,6 +335,22 @@ static void __init bootcmdline_init(char **cmdline_p)
> }
> #endif
>
> +#ifdef CONFIG_CMDLINE
> + /*
> + * If CONFIG_CMDLINE_BOOTLOADER is enabled then we use thei built-in
the
> + * command line if no command line given, or we append given command
> + * line to the built-in one if CONFIG_CMDLINE_EXTEND is enabled.
> + */
> + if (IS_ENABLED(CONFIG_CMDLINE_EXTEND)) {
> + strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> + strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
> + strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
> + }
> +
> + if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
> + strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +#endif
> +
> out:
> *cmdline_p = boot_command_line;
> }
--
~Randy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
2023-07-09 13:32 [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER Dong Zhihong
2023-07-09 13:34 ` Randy Dunlap
@ 2023-07-09 15:30 ` Huacai Chen
2023-07-09 17:35 ` donmor
[not found] ` <380911b1-13b0-2c69-7adf-f40abb604c6c@web.de>
2 siblings, 1 reply; 8+ messages in thread
From: Huacai Chen @ 2023-07-09 15:30 UTC (permalink / raw)
To: Dong Zhihong
Cc: kernel, ardb, tangyouling, zhoubinbin, yangtiezhu, tglx,
loongarch, linux-kernel
On Sun, Jul 9, 2023 at 9:33 PM Dong Zhihong <donmor3000@hotmail.com> wrote:
>
> This patch tends to fix broken CONFIG_CMDLINE, which is not working with
> CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER. Some code is absent in
> arch/loongarch/kernel/setup.c, which should handle built-in command lines
> in CONFIG_CMDLINE. The absence of such code causes CONFIG_CMDLINE not
> working if CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER is set to Y.
> CONFIG_CMDLINE_FORCE is not affected.
How to reproduce? If you use UEFI firmware, this is handled in
drivers/firmware/efi/libstub/efi-stub.c; if you use non-UEFI firmware,
this is handled in drivers/of/fdt.c.
Huacai
>
> Signed-off-by: Dong Zhihong <donmor3000@hotmail.com>
> ---
> arch/loongarch/kernel/setup.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
> index 78a00359bde3..504218b94879 100644
> --- a/arch/loongarch/kernel/setup.c
> +++ b/arch/loongarch/kernel/setup.c
> @@ -335,6 +335,22 @@ static void __init bootcmdline_init(char **cmdline_p)
> }
> #endif
>
> +#ifdef CONFIG_CMDLINE
> + /*
> + * If CONFIG_CMDLINE_BOOTLOADER is enabled then we use thei built-in
> + * command line if no command line given, or we append given command
> + * line to the built-in one if CONFIG_CMDLINE_EXTEND is enabled.
> + */
> + if (IS_ENABLED(CONFIG_CMDLINE_EXTEND)) {
> + strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> + strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
> + strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
> + }
> +
> + if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
> + strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +#endif
> +
> out:
> *cmdline_p = boot_command_line;
> }
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
2023-07-09 15:30 ` Huacai Chen
@ 2023-07-09 17:35 ` donmor
2023-07-10 7:53 ` Huacai Chen
0 siblings, 1 reply; 8+ messages in thread
From: donmor @ 2023-07-09 17:35 UTC (permalink / raw)
To: chenhuacai
Cc: loongarch, kernel, yangtiezhu, zhoubinbin, linux-kernel, tglx,
ardb, tangyouling
在 2023-07-09星期日的 23:30 +0800,Huacai Chen写道:
> How to reproduce? If you use UEFI firmware, this is handled in
> drivers/firmware/efi/libstub/efi-stub.c; if you use non-UEFI firmware,
> this is handled in drivers/of/fdt.c.
In fact it 's not command line retrieved from efi or fdt, but the built-in
command line to be concerned. CONFIG_CMDLINE was never been touched during
boot on loongarch, unless CONFIG_CMDLINE_FORCE is set because there is code
handling this. There should be code handling CONFIG_CMDLINE_FORCE and
CONFIG_CMDLINE_EXTEND as well but is absent by now.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
[not found] ` <380911b1-13b0-2c69-7adf-f40abb604c6c@web.de>
@ 2023-07-09 17:35 ` donmor
0 siblings, 0 replies; 8+ messages in thread
From: donmor @ 2023-07-09 17:35 UTC (permalink / raw)
To: Markus.Elfring, kernel-janitors, chenhuacai, loongarch, kernel
Cc: tglx, tangyouling, linux-kernel, ardb, yangtiezhu, zhoubinbin
在 2023-07-09星期日的 17:43 +0200,Markus Elfring写道:
> > This patch tends to fix broken CONFIG_CMDLINE, which is not working with
> > CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER. Some code is absent in
> > arch/loongarch/kernel/setup.c, which should handle built-in command lines
> > in CONFIG_CMDLINE. The absence of such code causes CONFIG_CMDLINE not
> > working if CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER is set to Y.
> …
>
> Which circumstances did hinder you to choose another imperative change suggestion?
>
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4#n94
>
> Regards,
> Markus
I'm trying boot the system with a single bootloongarch64.efi and got stuck on mounting
rootfs. It turns out to be the malfunction of kernel which dropped my built-in command
line. It's quiet annoying to be lacking a feature compared to other architectures.
Also, a feature shown in config should be functioning, or be considered buggy and get
fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
2023-07-09 17:35 ` donmor
@ 2023-07-10 7:53 ` Huacai Chen
2023-07-10 15:10 ` donmor
2023-07-10 16:04 ` donmor
0 siblings, 2 replies; 8+ messages in thread
From: Huacai Chen @ 2023-07-10 7:53 UTC (permalink / raw)
To: donmor
Cc: loongarch, kernel, yangtiezhu, zhoubinbin, linux-kernel, tglx,
ardb, tangyouling
On Mon, Jul 10, 2023 at 1:35 AM donmor <donmor3000@hotmail.com> wrote:
>
> 在 2023-07-09星期日的 23:30 +0800,Huacai Chen写道:
> > How to reproduce? If you use UEFI firmware, this is handled in
> > drivers/firmware/efi/libstub/efi-stub.c; if you use non-UEFI firmware,
> > this is handled in drivers/of/fdt.c.
>
> In fact it 's not command line retrieved from efi or fdt, but the built-in
> command line to be concerned. CONFIG_CMDLINE was never been touched during
> boot on loongarch, unless CONFIG_CMDLINE_FORCE is set because there is code
> handling this. There should be code handling CONFIG_CMDLINE_FORCE and
> CONFIG_CMDLINE_EXTEND as well but is absent by now.
I mean the code in drivers/of/fdt.c already handles
CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_FORCE, understand?
On the other hand, I found that for non-FDT system
CONFIG_CMDLINE_FORCE indeed doesn't work, but
CONFIG_CMDLINE_BOOTLOADER works, so you needn't fix
CONFIG_CMDLINE_BOOTLOADER, and you need add "goto out" in the "if
(initial_boot_params)" condition.
Huacai
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
2023-07-10 7:53 ` Huacai Chen
@ 2023-07-10 15:10 ` donmor
2023-07-10 16:04 ` donmor
1 sibling, 0 replies; 8+ messages in thread
From: donmor @ 2023-07-10 15:10 UTC (permalink / raw)
To: chenhuacai
Cc: loongarch, kernel, yangtiezhu, zhoubinbin, linux-kernel, tglx,
ardb, tangyouling
在 2023-07-10星期一的 15:53 +0800,Huacai Chen写道:
> On Mon, Jul 10, 2023 at 1:35 AM donmor <donmor3000@hotmail.com> wrote:
> > 在 2023-07-09星期日的 23:30 +0800,Huacai Chen写道:
> > > How to reproduce? If you use UEFI firmware, this is handled in
> > > drivers/firmware/efi/libstub/efi-stub.c; if you use non-UEFI firmware,
> > > this is handled in drivers/of/fdt.c.
> >
> > In fact it 's not command line retrieved from efi or fdt, but the built-in
> > command line to be concerned. CONFIG_CMDLINE was never been touched during
> > boot on loongarch, unless CONFIG_CMDLINE_FORCE is set because there is code
> > handling this. There should be code handling CONFIG_CMDLINE_FORCE and
> > CONFIG_CMDLINE_EXTEND as well but is absent by now.
>
> I mean the code in drivers/of/fdt.c already handles
> CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_FORCE, understand?
>
> On the other hand, I found that for non-FDT system
> CONFIG_CMDLINE_FORCE indeed doesn't work, but
> CONFIG_CMDLINE_BOOTLOADER works, so you needn't fix
> CONFIG_CMDLINE_BOOTLOADER, and you need add "goto out" in the "if
> (initial_boot_params)" condition.
>
> Huacai
Got it. I'll make a v2 asap.
donmor
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
2023-07-10 7:53 ` Huacai Chen
2023-07-10 15:10 ` donmor
@ 2023-07-10 16:04 ` donmor
1 sibling, 0 replies; 8+ messages in thread
From: donmor @ 2023-07-10 16:04 UTC (permalink / raw)
To: chenhuacai
Cc: loongarch, kernel, yangtiezhu, zhoubinbin, linux-kernel, tglx,
ardb, tangyouling
在 2023-07-10星期一的 15:53 +0800,Huacai Chen写道:
>
> On the other hand, I found that for non-FDT system
> CONFIG_CMDLINE_FORCE indeed doesn't work, but
> CONFIG_CMDLINE_BOOTLOADER works, so you needn't fix
> CONFIG_CMDLINE_BOOTLOADER, and you need add "goto out" in the "if
> (initial_boot_params)" condition.
>
> Huacai
And It is CONFIG_CMDLINE_FORCE but not CONFIG_CMDLINE_BOOTLOADER
that does work.
donmor
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-07-10 16:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-09 13:32 [PATCH] loongarch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER Dong Zhihong
2023-07-09 13:34 ` Randy Dunlap
2023-07-09 15:30 ` Huacai Chen
2023-07-09 17:35 ` donmor
2023-07-10 7:53 ` Huacai Chen
2023-07-10 15:10 ` donmor
2023-07-10 16:04 ` donmor
[not found] ` <380911b1-13b0-2c69-7adf-f40abb604c6c@web.de>
2023-07-09 17:35 ` donmor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®