diff mbox series

[2/5] RISC-V: Setup init_mm before parse_early_param()

Message ID 20190107161047.10516-3-anup@brainfault.org (mailing list archive)
State New, archived
Headers show
Series Fixmap support and MM cleanups | expand

Commit Message

Anup Patel Jan. 7, 2019, 4:10 p.m. UTC
From: Anup Patel <anup.patel@wdc.com>

We should setup init_mm before doing parse_early_param()
in setup_arch() to be consistent with setup_arch() of
other architectures such as x86, ARM, and ARM64.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
---
 arch/riscv/kernel/setup.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Christoph Hellwig Jan. 15, 2019, 1:44 p.m. UTC | #1
On Mon, Jan 07, 2019 at 09:40:44PM +0530, Anup Patel wrote:
> From: Anup Patel <anup.patel@wdc.com>
> 
> We should setup init_mm before doing parse_early_param()
> in setup_arch() to be consistent with setup_arch() of
> other architectures such as x86, ARM, and ARM64.
> 
> Signed-off-by: Anup Patel <anup.patel@wdc.com>

Is there any good inherent reason why the order matters?  Not that I
really care either way..
Anup Patel Jan. 19, 2019, 10:42 a.m. UTC | #2
On Tue, Jan 15, 2019 at 7:14 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Mon, Jan 07, 2019 at 09:40:44PM +0530, Anup Patel wrote:
> > From: Anup Patel <anup.patel@wdc.com>
> >
> > We should setup init_mm before doing parse_early_param()
> > in setup_arch() to be consistent with setup_arch() of
> > other architectures such as x86, ARM, and ARM64.
> >
> > Signed-off-by: Anup Patel <anup.patel@wdc.com>
>
> Is there any good inherent reason why the order matters?  Not that I
> really care either way..

The parse_early_param() calls param callbacks in variety
of subsystems including MM. Doing init_mm setup before
parse_early_param() ensures that initial MM state is
available when MM param callbacks are called.

My intention was mainly to make boot-up flow similar
to x86, ARM and ARM64 so that it is easy to add
features already present in these arch ports.

Regards,
Anup
diff mbox series

Patch

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 64646d0b4d53..f7132547b8b3 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -201,15 +201,15 @@  static void __init setup_bootmem(void)
 
 void __init setup_arch(char **cmdline_p)
 {
-	*cmdline_p = boot_command_line;
-
-	parse_early_param();
-
 	init_mm.start_code = (unsigned long) _stext;
 	init_mm.end_code   = (unsigned long) _etext;
 	init_mm.end_data   = (unsigned long) _edata;
 	init_mm.brk        = (unsigned long) _end;
 
+	*cmdline_p = boot_command_line;
+
+	parse_early_param();
+
 	setup_bootmem();
 	paging_init();
 	unflatten_device_tree();
@@ -228,4 +228,3 @@  void __init setup_arch(char **cmdline_p)
 
 	riscv_fill_hwcap();
 }
-