All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] MIPS: allow keeping the dtb command line
@ 2015-09-12 16:26 Jonas Gorski
  2015-09-12 16:26 ` [PATCH 1/3] MIPS: use USE_OF as the guard for appended dtb Jonas Gorski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jonas Gorski @ 2015-09-12 16:26 UTC (permalink / raw)
  To: linux-mips
  Cc: Ralf Baechle, Kevin Cernekee, Florian Fainelli,
	Zubair Lutfullah Kakakhel, James Hogan, John Crispin,
	Ganesan Ramalingam, Jayachandran C, Andrew Bresticker,
	James Hartley

Currently MIPS kernel code overwrites any bootargs from devicetree
unconditionally with the arcscmdline. Several targets work around this
by copying the devicetree bootargs into the arcscmdline after parsing
the device tree.

This patchset adds a new kernel option for keeping the devicetree
bootargs, then removes the workarounds and lets the targets instead make
use of that option.

Since some targets use OF but don't make use of the devicetree bootargs,
treat them like non-OF enabled targets and only use the prom commandline/

Jonas Gorski (3):
  MIPS: use USE_OF as the guard for appended dtb
  MIPS: make the kernel arguments from dtb available
  MIPS: make MIPS_CMDLINE_DTB default

 arch/mips/Kconfig           | 21 ++++++++++++++++++++-
 arch/mips/bmips/setup.c     |  1 -
 arch/mips/kernel/setup.c    | 24 +++++++++++++++++-------
 arch/mips/lantiq/prom.c     |  2 --
 arch/mips/netlogic/xlp/dt.c |  1 -
 arch/mips/pistachio/init.c  |  1 -
 arch/mips/ralink/of.c       |  2 --
 7 files changed, 37 insertions(+), 15 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] MIPS: use USE_OF as the guard for appended dtb
  2015-09-12 16:26 [PATCH 0/3] MIPS: allow keeping the dtb command line Jonas Gorski
@ 2015-09-12 16:26 ` Jonas Gorski
  2015-09-12 16:26 ` [PATCH 2/3] MIPS: make the kernel arguments from dtb available Jonas Gorski
  2015-09-12 16:26 ` [PATCH 3/3] MIPS: make MIPS_CMDLINE_DTB default Jonas Gorski
  2 siblings, 0 replies; 6+ messages in thread
From: Jonas Gorski @ 2015-09-12 16:26 UTC (permalink / raw)
  To: linux-mips
  Cc: Ralf Baechle, Kevin Cernekee, Florian Fainelli,
	Zubair Lutfullah Kakakhel, James Hogan, John Crispin,
	Ganesan Ramalingam, Jayachandran C, Andrew Bresticker,
	James Hartley

Since OF is now a user selectable symbol, the choice for appended dtb
support should only be visible when USE_OF is selected, as this
indicates actual machine support for device tree in MIPS.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 arch/mips/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 752acca..10fcd93 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2684,7 +2684,7 @@ config BUILTIN_DTB
 	bool
 
 choice
-	prompt "Kernel appended dtb support" if OF
+	prompt "Kernel appended dtb support" if USE_OF
 	default MIPS_NO_APPENDED_DTB
 
 	config MIPS_NO_APPENDED_DTB
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] MIPS: make the kernel arguments from dtb available
  2015-09-12 16:26 [PATCH 0/3] MIPS: allow keeping the dtb command line Jonas Gorski
  2015-09-12 16:26 ` [PATCH 1/3] MIPS: use USE_OF as the guard for appended dtb Jonas Gorski
@ 2015-09-12 16:26 ` Jonas Gorski
  2015-09-12 16:26 ` [PATCH 3/3] MIPS: make MIPS_CMDLINE_DTB default Jonas Gorski
  2 siblings, 0 replies; 6+ messages in thread
From: Jonas Gorski @ 2015-09-12 16:26 UTC (permalink / raw)
  To: linux-mips
  Cc: Ralf Baechle, Kevin Cernekee, Florian Fainelli,
	Zubair Lutfullah Kakakhel, James Hogan, John Crispin,
	Ganesan Ramalingam, Jayachandran C, Andrew Bresticker,
	James Hartley

Similar to how arm allows using selecting between bootloader arguments,
dtb arguments and both, allow to select them on mips. But since we have
less control over the place of the dtb do not modify it but instead use
the boot_command_line for merging them.

The default is "use bootloader arguments" to keep the current behaviour
as default.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 arch/mips/Kconfig        | 16 ++++++++++++++++
 arch/mips/kernel/setup.c | 24 +++++++++++++++++-------
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 10fcd93..3753437 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2728,6 +2728,22 @@ choice
 		  if you don't intend to always append a DTB.
 endchoice
 
+choice
+	prompt "Kernel command line type" if !CMDLINE_OVERRIDE
+	default MIPS_CMDLINE_FROM_BOOTLOADER
+
+	config MIPS_CMDLINE_FROM_DTB
+		depends on USE_OF
+		bool "Dtb kernel arguments if available"
+
+	config MIPS_CMDLINE_DTB_EXTEND
+		depends on USE_OF
+		bool "Extend dtb kernel arguments with bootloader arguments"
+
+	config MIPS_CMDLINE_FROM_BOOTLOADER
+		bool "Bootloader kernel arguments if available"
+endchoice
+
 endmenu
 
 config LOCKDEP_SUPPORT
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 35b8316..2f33bbf 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -608,6 +608,10 @@ static void __init request_crashkernel(struct resource *res)
 }
 #endif /* !defined(CONFIG_KEXEC)  */
 
+#define USE_PROM_CMDLINE	IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER)
+#define USE_DTB_CMDLINE		IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB)
+#define EXTEND_WITH_PROM	IS_ENABLED(CONFIG_MIPS_CMDLINE_EXTEND)
+
 static void __init arch_mem_init(char **cmdline_p)
 {
 	struct memblock_region *reg;
@@ -632,18 +636,24 @@ static void __init arch_mem_init(char **cmdline_p)
 	pr_info("Determined physical RAM map:\n");
 	print_memory_map();
 
-#ifdef CONFIG_CMDLINE_BOOL
-#ifdef CONFIG_CMDLINE_OVERRIDE
+#if defined(CONFIG_CMDLINE_BOOL) && defined(CONFIG_CMDLINE_OVERRIDE)
 	strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 #else
+	if ((USE_PROM_CMDLINE && arcs_cmdline[0]) ||
+	    (USE_DTB_CMDLINE && !boot_command_line[0]))
+		strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE);
+
+	if (EXTEND_WITH_PROM && arcs_cmdline[0]) {
+		strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
+		strlcat(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE);
+	}
+
+#if defined(CONFIG_CMDLINE_BOOL)
 	if (builtin_cmdline[0]) {
-		strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
-		strlcat(arcs_cmdline, builtin_cmdline, COMMAND_LINE_SIZE);
+		strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
+		strlcat(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 	}
-	strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE);
 #endif
-#else
-	strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE);
 #endif
 	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] MIPS: make MIPS_CMDLINE_DTB default
  2015-09-12 16:26 [PATCH 0/3] MIPS: allow keeping the dtb command line Jonas Gorski
  2015-09-12 16:26 ` [PATCH 1/3] MIPS: use USE_OF as the guard for appended dtb Jonas Gorski
  2015-09-12 16:26 ` [PATCH 2/3] MIPS: make the kernel arguments from dtb available Jonas Gorski
@ 2015-09-12 16:26 ` Jonas Gorski
  2015-09-12 18:53   ` Hauke Mehrtens
  2 siblings, 1 reply; 6+ messages in thread
From: Jonas Gorski @ 2015-09-12 16:26 UTC (permalink / raw)
  To: linux-mips
  Cc: Ralf Baechle, Kevin Cernekee, Florian Fainelli,
	Zubair Lutfullah Kakakhel, James Hogan, John Crispin,
	Ganesan Ramalingam, Jayachandran C, Andrew Bresticker,
	James Hartley

Seval of-enabled machines (bmips, lantiq, xlp, pistachio, ralink) copied
the arguments from dtb to arcs_command_line to prevent the kernel from
overwriting them.

Since there is now an option to keep the dtb arguments, default to the
new option remove the "backup" to arcs_command_line in case of USE_OF is
enabled, except for those platforms that still take the bootloader
arguments or do not use any at all.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 arch/mips/Kconfig           | 3 +++
 arch/mips/bmips/setup.c     | 1 -
 arch/mips/lantiq/prom.c     | 2 --
 arch/mips/netlogic/xlp/dt.c | 1 -
 arch/mips/pistachio/init.c  | 1 -
 arch/mips/ralink/of.c       | 2 --
 6 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 3753437..703142b 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2730,6 +2730,9 @@ endchoice
 
 choice
 	prompt "Kernel command line type" if !CMDLINE_OVERRIDE
+	default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATh79 && !MACH_INGENIC && \
+					 !MIPS_MALTA && !MIPS_SEAD3 && \
+					 !CAVIUM_OCTEON_SOC
 	default MIPS_CMDLINE_FROM_BOOTLOADER
 
 	config MIPS_CMDLINE_FROM_DTB
diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
index 526ec27..5b16d29 100644
--- a/arch/mips/bmips/setup.c
+++ b/arch/mips/bmips/setup.c
@@ -157,7 +157,6 @@ void __init plat_mem_setup(void)
 		panic("no dtb found");
 
 	__dt_setup_arch(dtb);
-	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 
 	for (q = bmips_quirk_list; q->quirk_fn; q++) {
 		if (of_flat_dt_is_compatible(of_get_flat_dt_root(),
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index 0db099e..297bcaa 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -77,8 +77,6 @@ void __init plat_mem_setup(void)
 	 * parsed resulting in our memory appearing
 	 */
 	__dt_setup_arch(__dtb_start);
-
-	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 }
 
 void __init device_tree_init(void)
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index a625bdb..856a6e6 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -87,7 +87,6 @@ void __init *xlp_dt_init(void *fdtp)
 void __init xlp_early_init_devtree(void)
 {
 	__dt_setup_arch(xlp_fdt_blob);
-	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 }
 
 void __init device_tree_init(void)
diff --git a/arch/mips/pistachio/init.c b/arch/mips/pistachio/init.c
index 8bd8ebb..96ba2cc 100644
--- a/arch/mips/pistachio/init.c
+++ b/arch/mips/pistachio/init.c
@@ -58,7 +58,6 @@ void __init plat_mem_setup(void)
 		panic("Device-tree not present");
 
 	__dt_setup_arch((void *)fw_arg1);
-	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 
 	plat_setup_iocoherency();
 }
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 0d30dcd..f9eda5d 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -74,8 +74,6 @@ void __init plat_mem_setup(void)
 	 */
 	__dt_setup_arch(__dtb_start);
 
-	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
-
 	of_scan_flat_dt(early_init_dt_find_memory, NULL);
 	if (memory_dtb)
 		of_scan_flat_dt(early_init_dt_scan_memory, NULL);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] MIPS: make MIPS_CMDLINE_DTB default
  2015-09-12 16:26 ` [PATCH 3/3] MIPS: make MIPS_CMDLINE_DTB default Jonas Gorski
@ 2015-09-12 18:53   ` Hauke Mehrtens
  2015-09-12 19:01     ` Jonas Gorski
  0 siblings, 1 reply; 6+ messages in thread
From: Hauke Mehrtens @ 2015-09-12 18:53 UTC (permalink / raw)
  To: Jonas Gorski, linux-mips
  Cc: Ralf Baechle, Kevin Cernekee, Florian Fainelli,
	Zubair Lutfullah Kakakhel, James Hogan, John Crispin,
	Ganesan Ramalingam, Jayachandran C, Andrew Bresticker,
	James Hartley

On 09/12/2015 06:26 PM, Jonas Gorski wrote:
> Seval of-enabled machines (bmips, lantiq, xlp, pistachio, ralink) copied
> the arguments from dtb to arcs_command_line to prevent the kernel from
> overwriting them.
> 
> Since there is now an option to keep the dtb arguments, default to the
> new option remove the "backup" to arcs_command_line in case of USE_OF is
> enabled, except for those platforms that still take the bootloader
> arguments or do not use any at all.
> 
> Signed-off-by: Jonas Gorski <jogo@openwrt.org>
> ---
>  arch/mips/Kconfig           | 3 +++
>  arch/mips/bmips/setup.c     | 1 -
>  arch/mips/lantiq/prom.c     | 2 --
>  arch/mips/netlogic/xlp/dt.c | 1 -
>  arch/mips/pistachio/init.c  | 1 -
>  arch/mips/ralink/of.c       | 2 --
>  6 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 3753437..703142b 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -2730,6 +2730,9 @@ endchoice
>  
>  choice
>  	prompt "Kernel command line type" if !CMDLINE_OVERRIDE
> +	default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATh79 && !MACH_INGENIC && \

ATh79 does not exist, ATH79 does.

> +					 !MIPS_MALTA && !MIPS_SEAD3 && \
> +					 !CAVIUM_OCTEON_SOC
>  	default MIPS_CMDLINE_FROM_BOOTLOADER
>  
>  	config MIPS_CMDLINE_FROM_DTB
> diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
> index 526ec27..5b16d29 100644
> --- a/arch/mips/bmips/setup.c
> +++ b/arch/mips/bmips/setup.c
> @@ -157,7 +157,6 @@ void __init plat_mem_setup(void)
>  		panic("no dtb found");
>  
>  	__dt_setup_arch(dtb);
> -	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
>  
>  	for (q = bmips_quirk_list; q->quirk_fn; q++) {
>  		if (of_flat_dt_is_compatible(of_get_flat_dt_root(),
> diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
> index 0db099e..297bcaa 100644
> --- a/arch/mips/lantiq/prom.c
> +++ b/arch/mips/lantiq/prom.c
> @@ -77,8 +77,6 @@ void __init plat_mem_setup(void)
>  	 * parsed resulting in our memory appearing
>  	 */
>  	__dt_setup_arch(__dtb_start);
> -
> -	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
>  }
>  
>  void __init device_tree_init(void)
> diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
> index a625bdb..856a6e6 100644
> --- a/arch/mips/netlogic/xlp/dt.c
> +++ b/arch/mips/netlogic/xlp/dt.c
> @@ -87,7 +87,6 @@ void __init *xlp_dt_init(void *fdtp)
>  void __init xlp_early_init_devtree(void)
>  {
>  	__dt_setup_arch(xlp_fdt_blob);
> -	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
>  }
>  
>  void __init device_tree_init(void)
> diff --git a/arch/mips/pistachio/init.c b/arch/mips/pistachio/init.c
> index 8bd8ebb..96ba2cc 100644
> --- a/arch/mips/pistachio/init.c
> +++ b/arch/mips/pistachio/init.c
> @@ -58,7 +58,6 @@ void __init plat_mem_setup(void)
>  		panic("Device-tree not present");
>  
>  	__dt_setup_arch((void *)fw_arg1);
> -	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
>  
>  	plat_setup_iocoherency();
>  }
> diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
> index 0d30dcd..f9eda5d 100644
> --- a/arch/mips/ralink/of.c
> +++ b/arch/mips/ralink/of.c
> @@ -74,8 +74,6 @@ void __init plat_mem_setup(void)
>  	 */
>  	__dt_setup_arch(__dtb_start);
>  
> -	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
> -
>  	of_scan_flat_dt(early_init_dt_find_memory, NULL);
>  	if (memory_dtb)
>  		of_scan_flat_dt(early_init_dt_scan_memory, NULL);
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] MIPS: make MIPS_CMDLINE_DTB default
  2015-09-12 18:53   ` Hauke Mehrtens
@ 2015-09-12 19:01     ` Jonas Gorski
  0 siblings, 0 replies; 6+ messages in thread
From: Jonas Gorski @ 2015-09-12 19:01 UTC (permalink / raw)
  To: Hauke Mehrtens
  Cc: MIPS Mailing List, Ralf Baechle, Kevin Cernekee, Florian Fainelli,
	Zubair Lutfullah Kakakhel, James Hogan, John Crispin,
	Ganesan Ramalingam, Jayachandran C, Andrew Bresticker,
	James Hartley

On Sat, Sep 12, 2015 at 8:53 PM, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> On 09/12/2015 06:26 PM, Jonas Gorski wrote:
>> Seval of-enabled machines (bmips, lantiq, xlp, pistachio, ralink) copied
>> the arguments from dtb to arcs_command_line to prevent the kernel from
>> overwriting them.
>>
>> Since there is now an option to keep the dtb arguments, default to the
>> new option remove the "backup" to arcs_command_line in case of USE_OF is
>> enabled, except for those platforms that still take the bootloader
>> arguments or do not use any at all.
>>
>> Signed-off-by: Jonas Gorski <jogo@openwrt.org>
>> ---
>>  arch/mips/Kconfig           | 3 +++
>>  arch/mips/bmips/setup.c     | 1 -
>>  arch/mips/lantiq/prom.c     | 2 --
>>  arch/mips/netlogic/xlp/dt.c | 1 -
>>  arch/mips/pistachio/init.c  | 1 -
>>  arch/mips/ralink/of.c       | 2 --
>>  6 files changed, 3 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>> index 3753437..703142b 100644
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -2730,6 +2730,9 @@ endchoice
>>
>>  choice
>>       prompt "Kernel command line type" if !CMDLINE_OVERRIDE
>> +     default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATh79 && !MACH_INGENIC && \
>
> ATh79 does not exist, ATH79 does.

Indeed. Maybe I should learn to use the caps-lock key ;). Will fix it for v2.


Jonas

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-09-12 19:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-12 16:26 [PATCH 0/3] MIPS: allow keeping the dtb command line Jonas Gorski
2015-09-12 16:26 ` [PATCH 1/3] MIPS: use USE_OF as the guard for appended dtb Jonas Gorski
2015-09-12 16:26 ` [PATCH 2/3] MIPS: make the kernel arguments from dtb available Jonas Gorski
2015-09-12 16:26 ` [PATCH 3/3] MIPS: make MIPS_CMDLINE_DTB default Jonas Gorski
2015-09-12 18:53   ` Hauke Mehrtens
2015-09-12 19:01     ` Jonas Gorski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.