Skip to content

Commit fbe22d2

Browse files
committed
xtensa: ISS: update kernel command line in platform_setup
Move platform_setup call higher in initialization sequence so that it could change kernel command line. Check command line passed to simulator in ISS platform_stup and update kernel command line if there's anything. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
1 parent e8cd8da commit fbe22d2

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎arch/xtensa/kernel/setup.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,9 @@ static inline int mem_reserve(unsigned long start, unsigned long end)
317317

318318
void __init setup_arch(char **cmdline_p)
319319
{
320-
strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
321320
*cmdline_p = command_line;
321+
platform_setup(cmdline_p);
322+
strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
322323

323324
/* Reserve some memory regions */
324325

@@ -379,8 +380,6 @@ void __init setup_arch(char **cmdline_p)
379380

380381
unflatten_and_copy_device_tree();
381382

382-
platform_setup(cmdline_p);
383-
384383
#ifdef CONFIG_SMP
385384
smp_init_cpus();
386385
#endif

‎arch/xtensa/platforms/iss/setup.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
* Joe Taylor <joe@tensilica.com>
99
*
1010
* Copyright 2001 - 2005 Tensilica Inc.
11+
* Copyright 2017 Cadence Design Systems Inc.
1112
*
1213
* This program is free software; you can redistribute it and/or modify it
1314
* under the terms of the GNU General Public License as published by the
1415
* Free Software Foundation; either version 2 of the License, or (at your
1516
* option) any later version.
1617
*
1718
*/
19+
#include <linux/bootmem.h>
1820
#include <linux/stddef.h>
1921
#include <linux/kernel.h>
2022
#include <linux/init.h>
@@ -76,5 +78,24 @@ static struct notifier_block iss_panic_block = {
7678

7779
void __init platform_setup(char **p_cmdline)
7880
{
81+
int argc = simc_argc();
82+
int argv_size = simc_argv_size();
83+
84+
if (argc > 1) {
85+
void **argv = alloc_bootmem(argv_size);
86+
char *cmdline = alloc_bootmem(argv_size);
87+
int i;
88+
89+
cmdline[0] = 0;
90+
simc_argv((void *)argv);
91+
92+
for (i = 1; i < argc; ++i) {
93+
if (i > 1)
94+
strcat(cmdline, " ");
95+
strcat(cmdline, argv[i]);
96+
}
97+
*p_cmdline = cmdline;
98+
}
99+
79100
atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
80101
}

0 commit comments

Comments
 (0)