From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932481AbdCGJMd (ORCPT ); Tue, 7 Mar 2017 04:12:33 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36629 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932402AbdCGJMX (ORCPT ); Tue, 7 Mar 2017 04:12:23 -0500 Date: Tue, 7 Mar 2017 10:11:40 +0100 From: Ingo Molnar To: Borislav Petkov Cc: X86 ML , LKML , Thomas Gleixner Subject: Re: [PATCH 2/2] x86/head_64.S: Pass struct boot_params' virtual address to C Message-ID: <20170307091140.GD6946@gmail.com> References: <20170304095611.11355-1-bp@alien8.de> <20170304095611.11355-2-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170304095611.11355-2-bp@alien8.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Borislav Petkov wrote: > From: Borislav Petkov > > ... so that callees don't have to convert it and can use it directly. > Simplifies C code a bit. Cleanup comments and formatting in the > vicinity, while at it. > > Also, document what phys_base really is. > > No functionality change. > > Signed-off-by: Borislav Petkov > --- > arch/x86/kernel/head64.c | 8 ++++---- > arch/x86/kernel/head_64.S | 10 +++++++--- > 2 files changed, 11 insertions(+), 7 deletions(-) > > diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c > index 54a2372f5dbb..17ee20a9b4e4 100644 > --- a/arch/x86/kernel/head64.c > +++ b/arch/x86/kernel/head64.c > @@ -118,7 +118,7 @@ static unsigned long get_cmd_line_ptr(void) > > static void __init copy_bootdata(char *real_mode_data) > { > - char * command_line; > + char *command_line; > unsigned long cmd_line_ptr; > > memcpy(&boot_params, real_mode_data, sizeof boot_params); > @@ -130,7 +130,7 @@ static void __init copy_bootdata(char *real_mode_data) > } > } > > -asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) > +asmlinkage __visible void __init x86_64_start_kernel(char *real_mode_data) > { > int i; > > @@ -163,7 +163,7 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) > set_intr_gate(i, early_idt_handler_array[i]); > load_idt((const struct desc_ptr *)&idt_descr); > > - copy_bootdata(__va(real_mode_data)); > + copy_bootdata(real_mode_data); > > /* > * Load microcode early on BSP. > @@ -180,7 +180,7 @@ 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)); > + copy_bootdata(real_mode_data); > > x86_early_init_platform_quirks(); > > diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S > index ac9d327d2e42..506de36293bc 100644 > --- a/arch/x86/kernel/head_64.S > +++ b/arch/x86/kernel/head_64.S > @@ -266,9 +266,12 @@ ENTRY(secondary_startup_64) > movl initial_gs+4(%rip),%edx > wrmsr > > - /* rsi is pointer to real mode structure with interesting info. > - pass it to C */ > - movq %rsi, %rdi > + /* > + * %rsi is pointer to real mode struct boot_params with interesting info. > + * Pass its virtual address to C. > + */ > + movq $__PAGE_OFFSET_BASE, %rdi > + addq %rsi, %rdi The updated comments and other details are fine, but I'm not sure about the __va() change: the patch essentially open codes __va() in assembly - which would make any changes to __va() [for whatever reason] more difficult, right? Right now we don't seem to have a single such line of assembly, so changes to __va() can be done in C alone. Thanks, Ingo