* [PATCH 0/8] generic command line v5 @ 2022-09-29 2:32 Daniel Walker 2022-09-29 2:32 ` [PATCH 7/8] of: replace command line handling Daniel Walker 2023-01-24 16:30 ` [PATCH 0/8] generic command line v5 Sean Anderson 0 siblings, 2 replies; 7+ messages in thread From: Daniel Walker @ 2022-09-29 2:32 UTC (permalink / raw) To: Will Deacon, Christophe Leroy, Rob Herring, Daniel Gimpelevich, Andrew Morton, Sean Anderson, H. Peter Anvin, Nick Desaulniers, linux-arm-kernel, linux-mips, linux-kernel, devicetree, linux-kbuild Cc: xe-linux-external, linux-efi v5 release changes. Generally a rebase from v4. * Modified OF changes to move the ugly code into the cmdline.h * Minor compliation update in arm64. Added ifndef __ASSEMBLY__ in a few places. * Worked around arm64 kaslr_early.c. This code needs some additional review and consideration. It appears this code is missing the opposite option to nokaslr which is kaslr.disabled=1/0 which would allow kaslr to be turn back on later in the command line. For example, console=ttyS0 nokaslr root=/dev/ram0 nosmp kaslr.disabled=0 loglevel=7 On arm64 in arch/arm64/kernel/idreg-override.c this is parsed correctly to turn on kaslr, but the kaslr_early.c is missing this logic. Doing this results in kaslr getting disabled with the following message, KASLR disabled due to lack of seed Even when there is a seed in the device tree. So change to the generic command line would leave built in command lines with nokaslr with no option to re-enable kaslr in in the bootloader arguments. Daniel Walker (8): CMDLINE: add generic builtin command line scripts: insert-sys-cert: add command line insert capability scripts: insert-sys-cert: change name to insert-symbol CMDLINE: mips: convert to generic builtin command line drivers: firmware: efi: libstub: enable generic commandline CMDLINE: x86: convert to generic builtin command line of: replace command line handling CMDLINE: arm64: convert to generic builtin command line arch/arm64/Kconfig | 33 +-- arch/arm64/include/asm/setup.h | 4 + arch/arm64/include/uapi/asm/setup.h | 2 + arch/arm64/kernel/idreg-override.c | 9 +- arch/arm64/kernel/pi/kaslr_early.c | 14 +- arch/mips/Kconfig | 4 +- arch/mips/Kconfig.debug | 44 ---- arch/mips/configs/ar7_defconfig | 9 +- arch/mips/configs/bcm47xx_defconfig | 8 +- arch/mips/configs/bcm63xx_defconfig | 15 +- arch/mips/configs/bmips_be_defconfig | 11 +- arch/mips/configs/bmips_stb_defconfig | 6 +- arch/mips/configs/ci20_defconfig | 9 +- arch/mips/configs/cu1000-neo_defconfig | 10 +- arch/mips/configs/cu1830-neo_defconfig | 10 +- arch/mips/configs/generic_defconfig | 6 +- arch/mips/configs/gpr_defconfig | 18 +- arch/mips/configs/loongson3_defconfig | 12 +- arch/mips/include/asm/setup.h | 2 + arch/mips/kernel/relocate.c | 17 +- arch/mips/kernel/setup.c | 36 +-- arch/mips/pic32/pic32mzda/early_console.c | 2 +- arch/mips/pic32/pic32mzda/init.c | 3 +- arch/x86/Kconfig | 44 +--- arch/x86/kernel/setup.c | 18 +- .../firmware/efi/libstub/efi-stub-helper.c | 29 +++ drivers/firmware/efi/libstub/efi-stub.c | 9 + drivers/firmware/efi/libstub/efistub.h | 1 + drivers/firmware/efi/libstub/x86-stub.c | 13 +- drivers/of/fdt.c | 22 +- include/linux/cmdline.h | 137 ++++++++++ init/Kconfig | 78 ++++++ lib/Kconfig | 4 + lib/Makefile | 3 + lib/generic_cmdline.S | 53 ++++ lib/test_cmdline1.c | 139 ++++++++++ scripts/Makefile | 2 +- .../{insert-sys-cert.c => insert-symbol.c} | 243 ++++++++++++------ 38 files changed, 724 insertions(+), 355 deletions(-) create mode 100644 include/linux/cmdline.h create mode 100644 lib/generic_cmdline.S create mode 100644 lib/test_cmdline1.c rename scripts/{insert-sys-cert.c => insert-symbol.c} (72%) -- 2.25.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 7/8] of: replace command line handling 2022-09-29 2:32 [PATCH 0/8] generic command line v5 Daniel Walker @ 2022-09-29 2:32 ` Daniel Walker 2023-01-24 16:30 ` [PATCH 0/8] generic command line v5 Sean Anderson 1 sibling, 0 replies; 7+ messages in thread From: Daniel Walker @ 2022-09-29 2:32 UTC (permalink / raw) To: Will Deacon, Christophe Leroy, Rob Herring, Daniel Gimpelevich, Andrew Morton, Sean Anderson, Rob Herring, Frank Rowand Cc: xe-linux-external, devicetree, linux-kernel Rob Herring has complained about this section of code. I removed the command line handling code to the cmdline.h header. This hopefully makes it easier for Rob to maintain it (at least he doesn't have to look at it directly anymore). I would like to add a Kconfig option called OF_DEPRECATED_CMDLINE which an architecture would set if it uses this code. This would allow a platform to use the cmdline.h and the added function directly and remove the Kconfig option. This change would be in a subsequent patch. This code was boot tested on powerpc 32bit, powerpc 64bit without any generic command line conversion. Cc: xe-linux-external@cisco.com Signed-off-by: Daniel Walker <danielwa@cisco.com> --- drivers/of/fdt.c | 22 ++-------------------- include/linux/cmdline.h | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 1c573e7a60bc..94e8fa277857 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -27,6 +27,7 @@ #include <linux/sysfs.h> #include <linux/random.h> #include <linux/kmemleak.h> +#include <linux/cmdline.h> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ #include <asm/page.h> @@ -1177,26 +1178,7 @@ int __init early_init_dt_scan_chosen(char *cmdline) /* Retrieve command line */ p = of_get_flat_dt_prop(node, "bootargs", &l); - if (p != NULL && l > 0) - strlcpy(cmdline, p, min(l, COMMAND_LINE_SIZE)); - - /* - * CONFIG_CMDLINE is meant to be a default in case nothing else - * managed to set the command line, unless CONFIG_CMDLINE_FORCE - * is set in which case we override whatever was found earlier. - */ -#ifdef CONFIG_CMDLINE -#if defined(CONFIG_CMDLINE_EXTEND) - strlcat(cmdline, " ", COMMAND_LINE_SIZE); - strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -#elif defined(CONFIG_CMDLINE_FORCE) - strlcpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -#else - /* No arguments from boot loader, use kernel's cmdl*/ - if (!((char *)cmdline)[0]) - strlcpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -#endif -#endif /* CONFIG_CMDLINE */ + of_deprecated_cmdline_update(cmdline, p, l); pr_debug("Command line is: %s\n", (char *)cmdline); diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h index a94758a0f257..dc7793265aa3 100644 --- a/include/linux/cmdline.h +++ b/include/linux/cmdline.h @@ -103,4 +103,35 @@ __cmdline_add_builtin( #define cmdline_get_static_builtin(dest) \ (CMDLINE_STATIC_PREPEND CMDLINE_STATIC_APPEND) -#endif + +#ifndef CONFIG_GENERIC_CMDLINE +static inline bool of_deprecated_cmdline_update(char *cmdline, const char *dt_bootargs, int length) +{ + if (dt_bootargs != NULL && length > 0) + strlcpy(cmdline, dt_bootargs, min(length, COMMAND_LINE_SIZE)); + /* + * CONFIG_CMDLINE is meant to be a default in case nothing else + * managed to set the command line, unless CONFIG_CMDLINE_FORCE + * is set in which case we override whatever was found earlier. + */ +#ifdef CONFIG_CMDLINE +#if defined(CONFIG_CMDLINE_EXTEND) + strlcat(cmdline, " ", COMMAND_LINE_SIZE); + strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); +#elif defined(CONFIG_CMDLINE_FORCE) + strlcpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); +#else + /* No arguments from boot loader, use kernel's cmdl*/ + if (!((char *)cmdline)[0]) + strlcpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); +#endif /* CONFIG_CMDLINE_EXTEND */ +#endif /* CONFIG_CMDLINE */ + + return true; +} +#else +static inline bool of_deprecated_cmdline_update(char *cmdline, const char *dt_bootargs, int length) { return false; } +#endif /* CONFIG_GENERIC_CMDLINE */ + + +#endif /* _LINUX_CMDLINE_H */ -- 2.25.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/8] generic command line v5 2022-09-29 2:32 [PATCH 0/8] generic command line v5 Daniel Walker 2022-09-29 2:32 ` [PATCH 7/8] of: replace command line handling Daniel Walker @ 2023-01-24 16:30 ` Sean Anderson 1 sibling, 0 replies; 7+ messages in thread From: Sean Anderson @ 2023-01-24 16:30 UTC (permalink / raw) To: Daniel Walker, Will Deacon, Christophe Leroy, Rob Herring, Daniel Gimpelevich, Andrew Morton, H. Peter Anvin, Nick Desaulniers, linux-arm-kernel, linux-mips, linux-kernel, devicetree, linux-kbuild Cc: xe-linux-external, linux-efi On 9/28/22 22:32, Daniel Walker wrote: > v5 release changes. Generally a rebase from v4. > > * Modified OF changes to move the ugly code into the cmdline.h > > * Minor compliation update in arm64. Added ifndef __ASSEMBLY__ in > a few places. > > * Worked around arm64 kaslr_early.c. > > This code needs some additional review and consideration. > It appears this code is missing the opposite option to nokaslr > which is kaslr.disabled=1/0 which would allow kaslr to be turn > back on later in the command line. For example, > > console=ttyS0 nokaslr root=/dev/ram0 nosmp kaslr.disabled=0 loglevel=7 > > On arm64 in arch/arm64/kernel/idreg-override.c this is parsed correctly > to turn on kaslr, but the kaslr_early.c is missing this logic. > Doing this results in kaslr getting disabled with the following message, > > KASLR disabled due to lack of seed > > Even when there is a seed in the device tree. > > So change to the generic command line would leave built in command > lines with nokaslr with no option to re-enable kaslr in in the bootloader > arguments. > > > Daniel Walker (8): > CMDLINE: add generic builtin command line > scripts: insert-sys-cert: add command line insert capability > scripts: insert-sys-cert: change name to insert-symbol > CMDLINE: mips: convert to generic builtin command line > drivers: firmware: efi: libstub: enable generic commandline > CMDLINE: x86: convert to generic builtin command line > of: replace command line handling > CMDLINE: arm64: convert to generic builtin command line > > arch/arm64/Kconfig | 33 +-- > arch/arm64/include/asm/setup.h | 4 + > arch/arm64/include/uapi/asm/setup.h | 2 + > arch/arm64/kernel/idreg-override.c | 9 +- > arch/arm64/kernel/pi/kaslr_early.c | 14 +- > arch/mips/Kconfig | 4 +- > arch/mips/Kconfig.debug | 44 ---- > arch/mips/configs/ar7_defconfig | 9 +- > arch/mips/configs/bcm47xx_defconfig | 8 +- > arch/mips/configs/bcm63xx_defconfig | 15 +- > arch/mips/configs/bmips_be_defconfig | 11 +- > arch/mips/configs/bmips_stb_defconfig | 6 +- > arch/mips/configs/ci20_defconfig | 9 +- > arch/mips/configs/cu1000-neo_defconfig | 10 +- > arch/mips/configs/cu1830-neo_defconfig | 10 +- > arch/mips/configs/generic_defconfig | 6 +- > arch/mips/configs/gpr_defconfig | 18 +- > arch/mips/configs/loongson3_defconfig | 12 +- > arch/mips/include/asm/setup.h | 2 + > arch/mips/kernel/relocate.c | 17 +- > arch/mips/kernel/setup.c | 36 +-- > arch/mips/pic32/pic32mzda/early_console.c | 2 +- > arch/mips/pic32/pic32mzda/init.c | 3 +- > arch/x86/Kconfig | 44 +--- > arch/x86/kernel/setup.c | 18 +- > .../firmware/efi/libstub/efi-stub-helper.c | 29 +++ > drivers/firmware/efi/libstub/efi-stub.c | 9 + > drivers/firmware/efi/libstub/efistub.h | 1 + > drivers/firmware/efi/libstub/x86-stub.c | 13 +- > drivers/of/fdt.c | 22 +- > include/linux/cmdline.h | 137 ++++++++++ > init/Kconfig | 78 ++++++ > lib/Kconfig | 4 + > lib/Makefile | 3 + > lib/generic_cmdline.S | 53 ++++ > lib/test_cmdline1.c | 139 ++++++++++ > scripts/Makefile | 2 +- > .../{insert-sys-cert.c => insert-symbol.c} | 243 ++++++++++++------ > 38 files changed, 724 insertions(+), 355 deletions(-) > create mode 100644 include/linux/cmdline.h > create mode 100644 lib/generic_cmdline.S > create mode 100644 lib/test_cmdline1.c > rename scripts/{insert-sys-cert.c => insert-symbol.c} (72%) > For arm64: Tested-by: Sean Anderson <sean.anderson@seco.com> Thanks! ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/8] generic command line v6 @ 2023-11-10 1:38 Daniel Walker 2023-11-10 1:38 ` [PATCH 7/8] of: replace command line handling Daniel Walker 0 siblings, 1 reply; 7+ messages in thread From: Daniel Walker @ 2023-11-10 1:38 UTC (permalink / raw) To: Will Deacon, Christophe Leroy, Rob Herring, Daniel Gimpelevich, Andrew Morton, Pratyush Brahma, Tomas Mudrunka, Sean Anderson, x86, linux-mips, linuxppc-dev, H. Peter Anvin, Nathan Chancellor, Nick Desaulniers, Nicolas Schier, linux-arm-kernel, linux-kernel, devicetree, linux-kbuild Cc: linux-efi This release is an up-rev of the v5 patches. No additional features have been added. Some changes were mode to function names and some changes to Kconfig dependencies. Also updated the config conversion for mips. There are a number of people who have expressed interest in these patches either by asking for them to be merge or testing them. If people are so inclined please continue to request them to be merge or to ask the status of the next release. It's helpful to motivate me to release them again and for the maintainers to see the interest generated. These patches have been used by Cisco Systems, Inc. on millions of released products to great effect. Hopefully they can be used by the entire Linux eco system. My apologies on the length between releases. I will try to release more often. Daniel Walker (8): CMDLINE: add generic builtin command line scripts: insert-sys-cert: add command line insert capability scripts: insert-sys-cert: change name to insert-symbol CMDLINE: mips: convert to generic builtin command line drivers: firmware: efi: libstub: enable generic commandline CMDLINE: x86: convert to generic builtin command line of: replace command line handling CMDLINE: arm64: convert to generic builtin command line arch/arm64/Kconfig | 33 +-- arch/arm64/include/asm/setup.h | 4 + arch/arm64/include/uapi/asm/setup.h | 2 + arch/arm64/kernel/idreg-override.c | 9 +- arch/arm64/kernel/pi/kaslr_early.c | 14 +- arch/mips/Kconfig | 4 +- arch/mips/Kconfig.debug | 44 ---- arch/mips/configs/ar7_defconfig | 12 +- arch/mips/configs/bcm47xx_defconfig | 10 +- arch/mips/configs/bcm63xx_defconfig | 21 +- arch/mips/configs/bmips_be_defconfig | 17 +- arch/mips/configs/bmips_stb_defconfig | 139 ++++------ arch/mips/configs/ci20_defconfig | 8 +- arch/mips/configs/cu1000-neo_defconfig | 19 +- arch/mips/configs/cu1830-neo_defconfig | 19 +- arch/mips/configs/generic_defconfig | 15 +- arch/mips/configs/gpr_defconfig | 33 +-- arch/mips/configs/loongson3_defconfig | 29 +-- arch/mips/include/asm/setup.h | 2 + arch/mips/kernel/relocate.c | 17 +- arch/mips/kernel/setup.c | 36 +-- arch/mips/pic32/pic32mzda/early_console.c | 2 +- arch/mips/pic32/pic32mzda/init.c | 3 +- arch/x86/Kconfig | 44 +--- arch/x86/kernel/setup.c | 18 +- .../firmware/efi/libstub/efi-stub-helper.c | 29 +++ drivers/firmware/efi/libstub/efi-stub.c | 9 + drivers/firmware/efi/libstub/efistub.h | 1 + drivers/firmware/efi/libstub/x86-stub.c | 14 +- drivers/of/fdt.c | 22 +- include/linux/cmdline.h | 137 ++++++++++ init/Kconfig | 79 ++++++ lib/Kconfig | 4 + lib/Makefile | 3 + lib/generic_cmdline.S | 53 ++++ lib/test_cmdline1.c | 139 ++++++++++ scripts/Makefile | 2 +- .../{insert-sys-cert.c => insert-symbol.c} | 243 ++++++++++++------ 38 files changed, 807 insertions(+), 482 deletions(-) create mode 100644 include/linux/cmdline.h create mode 100644 lib/generic_cmdline.S create mode 100644 lib/test_cmdline1.c rename scripts/{insert-sys-cert.c => insert-symbol.c} (72%) -- 2.39.2 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 7/8] of: replace command line handling 2023-11-10 1:38 [PATCH 0/8] generic command line v6 Daniel Walker @ 2023-11-10 1:38 ` Daniel Walker 2023-11-16 16:09 ` Rob Herring 2023-11-23 6:39 ` Christophe Leroy 0 siblings, 2 replies; 7+ messages in thread From: Daniel Walker @ 2023-11-10 1:38 UTC (permalink / raw) To: Will Deacon, Christophe Leroy, Rob Herring, Daniel Gimpelevich, Andrew Morton, Pratyush Brahma, Tomas Mudrunka, Sean Anderson, x86, linux-mips, linuxppc-dev, Rob Herring, Frank Rowand Cc: xe-linux-external, devicetree, linux-kernel Rob Herring has complained about this section of code. I removed the command line handling code to the cmdline.h header. This hopefully makes it easier for Rob to maintain it (at least he doesn't have to look at it directly anymore). I would like to add a Kconfig option called OF_DEPRECATED_CMDLINE which an architecture would set if it uses this code. This would allow a platform to use the cmdline.h and the added function directly and remove the Kconfig option. This change would be in a subsequent patch. This code was boot tested on powerpc 32bit, powerpc 64bit without any generic command line conversion. Cc: xe-linux-external@cisco.com Signed-off-by: Daniel Walker <danielwa@cisco.com> --- drivers/of/fdt.c | 22 +++------------------- include/linux/cmdline.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index bf502ba8da95..1fc1b17d04dc 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -26,6 +26,7 @@ #include <linux/serial_core.h> #include <linux/sysfs.h> #include <linux/random.h> +#include <linux/cmdline.h> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ #include <asm/page.h> @@ -1183,27 +1184,10 @@ int __init early_init_dt_scan_chosen(char *cmdline) /* Retrieve command line */ p = of_get_flat_dt_prop(node, "bootargs", &l); - if (p != NULL && l > 0) - strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE)); handle_cmdline: - /* - * CONFIG_CMDLINE is meant to be a default in case nothing else - * managed to set the command line, unless CONFIG_CMDLINE_FORCE - * is set in which case we override whatever was found earlier. - */ -#ifdef CONFIG_CMDLINE -#if defined(CONFIG_CMDLINE_EXTEND) - strlcat(cmdline, " ", COMMAND_LINE_SIZE); - strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -#elif defined(CONFIG_CMDLINE_FORCE) - strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -#else - /* No arguments from boot loader, use kernel's cmdl*/ - if (!((char *)cmdline)[0]) - strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); -#endif -#endif /* CONFIG_CMDLINE */ + + of_deprecated_cmdline_update(cmdline, p, l); pr_debug("Command line is: %s\n", (char *)cmdline); diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h index a94758a0f257..c772afb7340f 100644 --- a/include/linux/cmdline.h +++ b/include/linux/cmdline.h @@ -103,4 +103,35 @@ __cmdline_add_builtin( #define cmdline_get_static_builtin(dest) \ (CMDLINE_STATIC_PREPEND CMDLINE_STATIC_APPEND) + +#ifndef CONFIG_GENERIC_CMDLINE +static inline bool of_deprecated_cmdline_update(char *cmdline, const char *dt_bootargs, int length) +{ + if (dt_bootargs != NULL && length > 0) + strlcpy(cmdline, dt_bootargs, min(length, COMMAND_LINE_SIZE)); + /* + * CONFIG_CMDLINE is meant to be a default in case nothing else + * managed to set the command line, unless CONFIG_CMDLINE_FORCE + * is set in which case we override whatever was found earlier. + */ + +#ifdef CONFIG_CMDLINE +#if defined(CONFIG_CMDLINE_EXTEND) + strlcat(cmdline, " ", COMMAND_LINE_SIZE); + strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); +#elif defined(CONFIG_CMDLINE_FORCE) + strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); +#else + /* No arguments from boot loader, use kernel's cmdl*/ + if (!((char *)cmdline)[0]) + strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); #endif +#endif /* CONFIG_CMDLINE */ + return true; +} +#else +static inline bool of_deprecated_cmdline_update(char *cmdline, const char *dt_bootargs, int length) { return false; } +#endif /* CONFIG_GENERIC_CMDLINE */ + + +#endif /* _LINUX_CMDLINE_H */ -- 2.39.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 7/8] of: replace command line handling 2023-11-10 1:38 ` [PATCH 7/8] of: replace command line handling Daniel Walker @ 2023-11-16 16:09 ` Rob Herring 2023-11-16 16:33 ` Daniel Walker (danielwa) 2023-11-23 6:39 ` Christophe Leroy 1 sibling, 1 reply; 7+ messages in thread From: Rob Herring @ 2023-11-16 16:09 UTC (permalink / raw) To: Daniel Walker Cc: Will Deacon, Christophe Leroy, Daniel Gimpelevich, Andrew Morton, Pratyush Brahma, Tomas Mudrunka, Sean Anderson, x86, linux-mips, linuxppc-dev, Frank Rowand, xe-linux-external, devicetree, linux-kernel On Thu, Nov 09, 2023 at 05:38:11PM -0800, Daniel Walker wrote: > Rob Herring has complained about this section of code. I removed the > command line handling code to the cmdline.h header. This hopefully makes > it easier for Rob to maintain it (at least he doesn't have to look at it > directly anymore). Well, my goal is to eliminate drivers/of/, but no. > I would like to add a Kconfig option called > OF_DEPRECATED_CMDLINE which an architecture would set if it uses this code. Which architecture needs this code? Do we wait and see who complains their platform broke and then go set this option? In the meantime, new platforms started depending on the new behavior and setting the option may break them. So we can't have a kconfig option. > This would allow a platform to use the cmdline.h and the added function > directly and remove the Kconfig option. This change would be in a subsequent > patch. Per platform code handling the cmdline is completely the wrong direction. Per arch behavior is bad enough. Rob ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 7/8] of: replace command line handling 2023-11-16 16:09 ` Rob Herring @ 2023-11-16 16:33 ` Daniel Walker (danielwa) 0 siblings, 0 replies; 7+ messages in thread From: Daniel Walker (danielwa) @ 2023-11-16 16:33 UTC (permalink / raw) To: Rob Herring Cc: Will Deacon, Christophe Leroy, Daniel Gimpelevich, Andrew Morton, Pratyush Brahma, Tomas Mudrunka, Sean Anderson, x86@kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Frank Rowand, xe-linux-external(mailer list), devicetree@vger.kernel.org, linux-kernel@vger.kernel.org On Thu, Nov 16, 2023 at 10:09:36AM -0600, Rob Herring wrote: > On Thu, Nov 09, 2023 at 05:38:11PM -0800, Daniel Walker wrote: > > Rob Herring has complained about this section of code. I removed the > > command line handling code to the cmdline.h header. This hopefully makes > > it easier for Rob to maintain it (at least he doesn't have to look at it > > directly anymore). > > Well, my goal is to eliminate drivers/of/, but no. > > > I would like to add a Kconfig option called > > OF_DEPRECATED_CMDLINE which an architecture would set if it uses this code. > > Which architecture needs this code? Do we wait and see who complains > their platform broke and then go set this option? In the meantime, new > platforms started depending on the new behavior and setting the option > may break them. So we can't have a kconfig option. I think you misunderstood the comments. The objective is, 1) Remove the code in drivers/of/ 2) Remove platform specific command line handling > > This would allow a platform to use the cmdline.h and the added function > > directly and remove the Kconfig option. This change would be in a subsequent > > patch. > > Per platform code handling the cmdline is completely the wrong > direction. Per arch behavior is bad enough. This code unifies the handling into generic code outside drivers/of/ . Daniel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 7/8] of: replace command line handling 2023-11-10 1:38 ` [PATCH 7/8] of: replace command line handling Daniel Walker 2023-11-16 16:09 ` Rob Herring @ 2023-11-23 6:39 ` Christophe Leroy 1 sibling, 0 replies; 7+ messages in thread From: Christophe Leroy @ 2023-11-23 6:39 UTC (permalink / raw) To: Daniel Walker, Will Deacon, Rob Herring, Daniel Gimpelevich, Andrew Morton, Pratyush Brahma, Tomas Mudrunka, Sean Anderson, x86@kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Rob Herring, Frank Rowand Cc: xe-linux-external@cisco.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Le 10/11/2023 à 02:38, Daniel Walker a écrit : > Rob Herring has complained about this section of code. I removed the This kind of considerations shouldn't appear in the commit message, it may appear after the --- so that it gets dropped when applying. > command line handling code to the cmdline.h header. This hopefully makes > it easier for Rob to maintain it (at least he doesn't have to look at it > directly anymore). I would like to add a Kconfig option called > OF_DEPRECATED_CMDLINE which an architecture would set if it uses this code. Not sure to understand what you want to do and why that is needed. Why can't that work for everyone ? Avoid unnecessary options. > This would allow a platform to use the cmdline.h and the added function > directly and remove the Kconfig option. This change would be in a subsequent > patch. would or will ? Not sure it is worth mentioning if it won't. > > This code was boot tested on powerpc 32bit, powerpc 64bit without > any generic command line conversion. > > Cc: xe-linux-external@cisco.com > Signed-off-by: Daniel Walker <danielwa@cisco.com> > --- > drivers/of/fdt.c | 22 +++------------------- > include/linux/cmdline.h | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+), 19 deletions(-) > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > index bf502ba8da95..1fc1b17d04dc 100644 > --- a/drivers/of/fdt.c > +++ b/drivers/of/fdt.c > @@ -26,6 +26,7 @@ > #include <linux/serial_core.h> > #include <linux/sysfs.h> > #include <linux/random.h> > +#include <linux/cmdline.h> > > #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ > #include <asm/page.h> > @@ -1183,27 +1184,10 @@ int __init early_init_dt_scan_chosen(char *cmdline) > > /* Retrieve command line */ > p = of_get_flat_dt_prop(node, "bootargs", &l); > - if (p != NULL && l > 0) > - strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE)); > > handle_cmdline: > - /* > - * CONFIG_CMDLINE is meant to be a default in case nothing else > - * managed to set the command line, unless CONFIG_CMDLINE_FORCE > - * is set in which case we override whatever was found earlier. > - */ > -#ifdef CONFIG_CMDLINE > -#if defined(CONFIG_CMDLINE_EXTEND) > - strlcat(cmdline, " ", COMMAND_LINE_SIZE); > - strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > -#elif defined(CONFIG_CMDLINE_FORCE) > - strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > -#else > - /* No arguments from boot loader, use kernel's cmdl*/ > - if (!((char *)cmdline)[0]) > - strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > -#endif > -#endif /* CONFIG_CMDLINE */ > + > + of_deprecated_cmdline_update(cmdline, p, l); > > pr_debug("Command line is: %s\n", (char *)cmdline); > > diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h > index a94758a0f257..c772afb7340f 100644 > --- a/include/linux/cmdline.h > +++ b/include/linux/cmdline.h > @@ -103,4 +103,35 @@ __cmdline_add_builtin( > > #define cmdline_get_static_builtin(dest) \ > (CMDLINE_STATIC_PREPEND CMDLINE_STATIC_APPEND) > + > +#ifndef CONFIG_GENERIC_CMDLINE > +static inline bool of_deprecated_cmdline_update(char *cmdline, const char *dt_bootargs, int length) Add a comment explaining why it is deprecated. > +{ > + if (dt_bootargs != NULL && length > 0) > + strlcpy(cmdline, dt_bootargs, min(length, COMMAND_LINE_SIZE)); > + /* > + * CONFIG_CMDLINE is meant to be a default in case nothing else > + * managed to set the command line, unless CONFIG_CMDLINE_FORCE > + * is set in which case we override whatever was found earlier. > + */ > + > +#ifdef CONFIG_CMDLINE > +#if defined(CONFIG_CMDLINE_EXTEND) > + strlcat(cmdline, " ", COMMAND_LINE_SIZE); > + strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > +#elif defined(CONFIG_CMDLINE_FORCE) > + strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > +#else > + /* No arguments from boot loader, use kernel's cmdl*/ > + if (!((char *)cmdline)[0]) > + strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > #endif > +#endif /* CONFIG_CMDLINE */ > + return true; > +} > +#else > +static inline bool of_deprecated_cmdline_update(char *cmdline, const char *dt_bootargs, int length) { return false; } > +#endif /* CONFIG_GENERIC_CMDLINE */ > + > + > +#endif /* _LINUX_CMDLINE_H */ ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-11-23 6:39 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-09-29 2:32 [PATCH 0/8] generic command line v5 Daniel Walker 2022-09-29 2:32 ` [PATCH 7/8] of: replace command line handling Daniel Walker 2023-01-24 16:30 ` [PATCH 0/8] generic command line v5 Sean Anderson -- strict thread matches above, loose matches on Subject: below -- 2023-11-10 1:38 [PATCH 0/8] generic command line v6 Daniel Walker 2023-11-10 1:38 ` [PATCH 7/8] of: replace command line handling Daniel Walker 2023-11-16 16:09 ` Rob Herring 2023-11-16 16:33 ` Daniel Walker (danielwa) 2023-11-23 6:39 ` Christophe Leroy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).