Messages in this thread Patch in this message | | | From | Alexander Kuleshov <> | Subject | [PATCH] x86_64/setup: handle builtin command line early | Date | Mon, 1 Feb 2016 15:59:44 +0600 |
| |
We handle builtin command line during setup_arch() work of the setup_arch(). But it may be useful to handle it earlier for x86_64.
For example: x86_64 supports early update ucode from the feddc9de (x86/head64.c: Early update ucode in 64-bit) commit by the calling of load_ucode_bsp() which in turn checks 'dis_ucode_ldr' option which may be passed through builtin command line.
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com> --- arch/x86/include/asm/setup.h | 2 +- arch/x86/kernel/head64.c | 5 +++++ arch/x86/kernel/setup.c | 31 +++++++++++++++++++------------ 3 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h index 11af24e..7c6ca38 100644 --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h @@ -124,7 +124,7 @@ asmlinkage void __init i386_start_kernel(void); #else asmlinkage void __init x86_64_start_kernel(char *real_mode); asmlinkage void __init x86_64_start_reservations(char *real_mode_data); - +void __init setup_builtin_cmdline(void); #endif /* __i386__ */ #endif /* _SETUP */ #else diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index f129a9a..3a3f3b0 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -173,6 +173,8 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) copy_bootdata(__va(real_mode_data)); + setup_builtin_cmdline(); + /* * Load microcode early on BSP. */ @@ -188,7 +190,10 @@ void __init x86_64_start_reservations(char *real_mode_data) { /* version is always not zero if it is copied */ if (!boot_params.hdr.version) + { copy_bootdata(__va(real_mode_data)); + setup_builtin_cmdline(); + } reserve_ebda_region(); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index d3d80e6..0a19059 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -832,6 +832,23 @@ dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) return 0; } + +void __init setup_builtin_cmdline(void) +{ +#ifdef CONFIG_CMDLINE_BOOL +#ifdef CONFIG_CMDLINE_OVERRIDE + strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); +#else + if (builtin_cmdline[0]) { + /* append boot loader cmdline to builtin */ + strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE); + strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE); + strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); + } +#endif +#endif +} + /* * Determine if we were loaded by an EFI loader. If so, then we have also been * passed the efi memmap, systab, etc., so we should use these data structures @@ -955,19 +972,9 @@ void __init setup_arch(char **cmdline_p) bss_resource.start = __pa_symbol(__bss_start); bss_resource.end = __pa_symbol(__bss_stop)-1; -#ifdef CONFIG_CMDLINE_BOOL -#ifdef CONFIG_CMDLINE_OVERRIDE - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); -#else - if (builtin_cmdline[0]) { - /* append boot loader cmdline to builtin */ - strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE); - strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE); - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); - } -#endif +#ifdef CONFIG_X86_32 + setup_builtin_cmdline(); #endif - strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; -- 2.7.0.25.gfc10eb5
| |