Received: by 10.223.185.116 with SMTP id b49csp8278434wrg; Thu, 1 Mar 2018 21:51:55 -0800 (PST) X-Google-Smtp-Source: AG47ELstkuKOmU5AQY13kZqgm4E2eDBizOqKGsMu8TCC6LPZiS2riA6rCVF9ZKSKmO3fGaRp+mey X-Received: by 10.99.112.77 with SMTP id a13mr3602820pgn.253.1519969915375; Thu, 01 Mar 2018 21:51:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519969915; cv=none; d=google.com; s=arc-20160816; b=og0tULvpbdTgXNl/pBb7HglRpXa++Jl0S+qhrf+UBGBEKBwW9Pbx4CvyC7K1t7prz7 XBStLEPkE+zk3jAWLvTqeGagKJJn8LlixPHkL9Eii5G7reYOpz1LhtthYVS2oC8b+54H hG4xFsAmQL1OEB6QmDLWp+xltEIhDzGxabybrbgWwd/Xu21FDYYaafO7stGSBj4cjEvY H+e1G0ulfi8UdKApPh0IK/apOVKX8CGlrCMRTcXRWYNWMXUtPv9uCzM8TZLBa9Js8XwM gIOLpW4Gas1wSq7nsV0Z0pGKOr9Ald+XGv+1vCz5QYZmtETgaRrFRxs6UUOrHDY2CSe6 INlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ity6Iy88zwm8dkR7FU0G4k/d3nG6wSmsT9aY05F0EL4=; b=F5FVAdUXLa+cbNYV+xyjDZN4/GqGFPTlQO/BeKOzTLeXrOznQ4fd6Ylj2G8QfDmHSP bK5LJAA6dfi5xaTnFn8vBO755vsKQHwIE96npk5unN5oAHs21wRovtxVkOkrOnZkQfv2 f7uefDJr++8mZwB5umKjM3+1HDbjWWsntCdKea5ByGhgnOrRq6IsL+OIxtkInyKzWBQ1 Dht+cHP1oCT6yQWGMk3rZ5A9S0RASjGHfT+glbrfhTC3uTYbR8mpWCTbAD48jxFvmNFZ 39tUjmwXHYmECuZ3NLlH+h3F98heVJhMI+CuMueMTmPOV6HKU4XlxXzOb9npnl5yB2Jw pYeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si1576046plb.607.2018.03.01.21.51.41; Thu, 01 Mar 2018 21:51:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753305AbeCBFUI (ORCPT + 99 others); Fri, 2 Mar 2018 00:20:08 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37418 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753285AbeCBFUG (ORCPT ); Fri, 2 Mar 2018 00:20:06 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8500EEAEA6; Fri, 2 Mar 2018 05:20:05 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-90.pek2.redhat.com [10.72.12.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60AE5AFD45; Fri, 2 Mar 2018 05:20:00 +0000 (UTC) Date: Fri, 2 Mar 2018 13:19:56 +0800 From: Dave Young To: AKASHI Takahiro Cc: vgoyal@redhat.com, bhe@redhat.com, mpe@ellerman.id.au, bauerman@linux.vnet.ibm.com, prudo@linux.vnet.ibm.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH 4/7] x86: kexec_file: remove X86_64 dependency from prepare_elf64_headers() Message-ID: <20180302051956.GB2952@dhcp-128-65.nay.redhat.com> References: <20180227044814.24808-1-takahiro.akashi@linaro.org> <20180227044814.24808-5-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180227044814.24808-5-takahiro.akashi@linaro.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 02 Mar 2018 05:20:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 02 Mar 2018 05:20:05 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dyoung@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/27/18 at 01:48pm, AKASHI Takahiro wrote: > The code guarded by CONFIG_X86_64 is necessary on some architectures > which have a dedicated kernel mapping outside of linear memory mapping. > (arm64 is among those.) > > In this patch, an additional argument, kernel_map, is added to enable/ > disable the code removing #ifdef. > > Signed-off-by: AKASHI Takahiro > Cc: Dave Young > Cc: Vivek Goyal > Cc: Baoquan He > --- > arch/x86/kernel/crash.c | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c > index 2123fa0efc17..913fd8021f8a 100644 > --- a/arch/x86/kernel/crash.c > +++ b/arch/x86/kernel/crash.c > @@ -347,7 +347,7 @@ static int prepare_elf64_ram_headers_callback(struct resource *res, void *arg) > return 0; > } > > -static int prepare_elf64_headers(struct crash_elf_data *ced, > +static int prepare_elf64_headers(struct crash_elf_data *ced, int kernel_map, > void **addr, unsigned long *sz) > { > Elf64_Ehdr *ehdr; > @@ -414,17 +414,17 @@ static int prepare_elf64_headers(struct crash_elf_data *ced, > phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE; > (ehdr->e_phnum)++; > > -#ifdef CONFIG_X86_64 > /* Prepare PT_LOAD type program header for kernel text region */ > - phdr = (Elf64_Phdr *)bufp; > - bufp += sizeof(Elf64_Phdr); > - phdr->p_type = PT_LOAD; > - phdr->p_flags = PF_R|PF_W|PF_X; > - phdr->p_vaddr = (Elf64_Addr)_text; > - phdr->p_filesz = phdr->p_memsz = _end - _text; > - phdr->p_offset = phdr->p_paddr = __pa_symbol(_text); > - (ehdr->e_phnum)++; > -#endif > + if (kernel_map) { > + phdr = (Elf64_Phdr *)bufp; > + bufp += sizeof(Elf64_Phdr); > + phdr->p_type = PT_LOAD; > + phdr->p_flags = PF_R|PF_W|PF_X; > + phdr->p_vaddr = (Elf64_Addr)_text; > + phdr->p_filesz = phdr->p_memsz = _end - _text; > + phdr->p_offset = phdr->p_paddr = __pa_symbol(_text); > + (ehdr->e_phnum)++; > + } > > /* Go through all the ranges in cmem->ranges[] and prepare phdr */ > for (i = 0; i < cmem->nr_ranges; i++) { > @@ -477,7 +477,8 @@ static int prepare_elf_headers(struct kimage *image, void **addr, > goto out; > > /* By default prepare 64bit headers */ > - ret = prepare_elf64_headers(ced, addr, sz); > + ret = prepare_elf64_headers(ced, > + (int)IS_ENABLED(CONFIG_X86_64), addr, sz); A bool would be enough for kernel_map > if (ret) > goto out; > Thanks Dave > -- > 2.16.2 >