Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1660171

[PATCH 07/15] MIPS: Setup boot_command_line before plat_mem_setup

From Paul Cercueil <paul@crapouillou.net>
Newsgroups linux.kernel
Subject [PATCH 07/15] MIPS: Setup boot_command_line before plat_mem_setup
Date 2017-06-07 22:10 +0200
Message-ID <tPPrd-2PB-47@gated-at.bofh.it> (permalink)
References <tPPrb-2PB-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Paul Burton <paul.burton@imgtec.com>

Platforms using DT will typically call __dt_setup_arch from
plat_mem_setup. This in turn calls early_init_dt_scan. When
CONFIG_CMDLINE is set, this leads to its value being copied into
boot_command_line by early_init_dt_scan_chosen. If this happens before
the code setting up boot_command_line in arch_mem_init runs, that code
will go on to append CONFIG_CMDLINE (via builtin_cmdline) to
boot_command_line again, duplicating it. For some command line
parameters (eg. earlycon) this can be a problem. Set up
boot_command_line before early_init_dt_scan_chosen gets called such that
it will not write CONFIG_CMDLINE in this scenario & the arguments aren't
duplicated.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
 arch/mips/kernel/setup.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 01d1dbde5fbf..89785600fde4 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -785,25 +785,6 @@ static void __init arch_mem_init(char **cmdline_p)
 	struct memblock_region *reg;
 	extern void plat_mem_setup(void);
 
-	/* call board setup routine */
-	plat_mem_setup();
-
-	/*
-	 * Make sure all kernel memory is in the maps.  The "UP" and
-	 * "DOWN" are opposite for initdata since if it crosses over
-	 * into another memory section you don't want that to be
-	 * freed when the initdata is freed.
-	 */
-	arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT,
-			 PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT,
-			 BOOT_MEM_RAM);
-	arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT,
-			 PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT,
-			 BOOT_MEM_INIT_RAM);
-
-	pr_info("Determined physical RAM map:\n");
-	print_memory_map();
-
 #if defined(CONFIG_CMDLINE_BOOL) && defined(CONFIG_CMDLINE_OVERRIDE)
 	strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 #else
@@ -831,6 +812,26 @@ static void __init arch_mem_init(char **cmdline_p)
 	}
 #endif
 #endif
+
+	/* call board setup routine */
+	plat_mem_setup();
+
+	/*
+	 * Make sure all kernel memory is in the maps.  The "UP" and
+	 * "DOWN" are opposite for initdata since if it crosses over
+	 * into another memory section you don't want that to be
+	 * freed when the initdata is freed.
+	 */
+	arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT,
+			 PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT,
+			 BOOT_MEM_RAM);
+	arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT,
+			 PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT,
+			 BOOT_MEM_INIT_RAM);
+
+	pr_info("Determined physical RAM map:\n");
+	print_memory_map();
+
 	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
 
 	*cmdline_p = command_line;
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/15] Ingenic JZ4770 and GCW Zero patchset Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
  [PATCH 03/15] clk: ingenic: Add code to enable/disable PLLs Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
  [PATCH 14/15] devicetree/bindings: Add GCW vendor prefix Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
    Re: [PATCH 14/15] devicetree/bindings: Add GCW vendor prefix Rob Herring <robh@kernel.org> - 2017-06-09 16:30 +0200
  [PATCH 11/15] MIPS: ingenic: Initial JZ4770 support Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
  [PATCH 08/15] MIPS: ingenic: Use common cmdline handling code Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
  [PATCH 01/15] clk: ingenic: Fix recalc_rate for clocks with fixed divider Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
  [PATCH 07/15] MIPS: Setup boot_command_line before plat_mem_setup Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
  [PATCH 13/15] MIPS: JZ4770: Workaround for corrupted DMA transfers Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
  [PATCH 04/15] clk: Add Ingenic jz4770 CGU driver Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
    Re: [PATCH 04/15] clk: Add Ingenic jz4770 CGU driver Stephen Boyd <sboyd@codeaurora.org> - 2017-06-07 23:00 +0200
      Re: [PATCH 04/15] clk: Add Ingenic jz4770 CGU driver Maarten ter Huurne <maarten@treewalker.org> - 2017-06-08 11:00 +0200
      Re: [PATCH 04/15] clk: Add Ingenic jz4770 CGU driver Paul Cercueil <paul@crapouillou.net> - 2017-06-08 23:20 +0200
  [PATCH 09/15] MIPS: platform: add machtype IDs for more Ingenic SoCs Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200

csiph-web