From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753006AbcBAKDj (ORCPT ); Mon, 1 Feb 2016 05:03:39 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:35708 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751780AbcBAKDi (ORCPT ); Mon, 1 Feb 2016 05:03:38 -0500 From: Alexander Kuleshov To: Thomas Gleixner Cc: Ingo Molnar , "H . Peter Anvin" , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , Denys Vlasenko , Jiang Liu , linux-kernel@vger.kernel.org, Alexander Kuleshov Subject: [PATCH] x86_64/setup: handle builtin command line early Date: Mon, 1 Feb 2016 15:59:44 +0600 Message-Id: <1454320784-32161-1-git-send-email-kuleshovmail@gmail.com> X-Mailer: git-send-email 2.7.0.25.gfc10eb5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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