From patchwork Sun Feb 21 17:49:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lakshmi Ramasubramanian X-Patchwork-Id: 12097521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7D2DC433E6 for ; Sun, 21 Feb 2021 17:50:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D8D564DEC for ; Sun, 21 Feb 2021 17:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229910AbhBURuV (ORCPT ); Sun, 21 Feb 2021 12:50:21 -0500 Received: from linux.microsoft.com ([13.77.154.182]:45130 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbhBURuT (ORCPT ); Sun, 21 Feb 2021 12:50:19 -0500 Received: from localhost.localdomain (c-73-42-176-67.hsd1.wa.comcast.net [73.42.176.67]) by linux.microsoft.com (Postfix) with ESMTPSA id D6D7E20B57A0; Sun, 21 Feb 2021 09:49:37 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D6D7E20B57A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1613929778; bh=Hqz5rjYgPmheQdI+jnp77oRTr6wTnE3ljaY8476eY94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N90zXZVQeek+N0w16uhc1rnRB34kSd/W6uJfgXvytxT0QkDFJBp23ZOcNUisxHFbX dxFD5K8F9MWF97Kqs/nLV+3tbK5mafDeUBxQ9V9HUXcy31cNWWdyrwcjZV5wtcxYsE YvgWrKHjC2eLUj3JHDDF22yFtJ7mdRM8MdI80gmU= From: Lakshmi Ramasubramanian To: zohar@linux.ibm.com, bauerman@linux.ibm.com, robh@kernel.org, takahiro.akashi@linaro.org, gregkh@linuxfoundation.org, will@kernel.org, joe@perches.com, catalin.marinas@arm.com, mpe@ellerman.id.au, sfr@canb.auug.org.au Cc: james.morse@arm.com, sashal@kernel.org, benh@kernel.crashing.org, paulus@samba.org, frowand.list@gmail.com, vincenzo.frascino@arm.com, mark.rutland@arm.com, dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com, pasha.tatashin@soleen.com, allison@lohutok.net, masahiroy@kernel.org, mbrugger@suse.com, hsinyi@chromium.org, tao.li@vivo.com, christophe.leroy@c-s.fr, prsriva@linux.microsoft.com, balajib@linux.microsoft.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v19 03/13] powerpc: Use ELF fields defined in 'struct kimage' Date: Sun, 21 Feb 2021 09:49:20 -0800 Message-Id: <20210221174930.27324-4-nramas@linux.microsoft.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210221174930.27324-1-nramas@linux.microsoft.com> References: <20210221174930.27324-1-nramas@linux.microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org ELF related fields elf_headers, elf_headers_sz, and elfcorehdr_addr have been moved from 'struct kimage_arch' to 'struct kimage' as elf_headers, elf_headers_sz, and elf_load_addr respectively. Use the ELF fields defined in 'struct kimage'. Signed-off-by: Lakshmi Ramasubramanian Suggested-by: Rob Herring Fixes: 33488dc4d61f ("of: Add a common kexec FDT setup function") Reported-by: kernel test robot Reviewed-by: Thiago Jung Bauermann --- arch/powerpc/include/asm/kexec.h | 4 ---- arch/powerpc/kexec/file_load.c | 6 +++--- arch/powerpc/kexec/file_load_64.c | 14 +++++++------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index 55d6ede30c19..69c2a8aa142a 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -108,10 +108,6 @@ struct kimage_arch { unsigned long backup_start; void *backup_buf; - unsigned long elfcorehdr_addr; - unsigned long elf_headers_sz; - void *elf_headers; - #ifdef CONFIG_IMA_KEXEC phys_addr_t ima_buffer_addr; size_t ima_buffer_size; diff --git a/arch/powerpc/kexec/file_load.c b/arch/powerpc/kexec/file_load.c index 9a232bc36c8f..19d2c5f49daf 100644 --- a/arch/powerpc/kexec/file_load.c +++ b/arch/powerpc/kexec/file_load.c @@ -45,7 +45,7 @@ char *setup_kdump_cmdline(struct kimage *image, char *cmdline, return NULL; elfcorehdr_strlen = sprintf(cmdline_ptr, "elfcorehdr=0x%lx ", - image->arch.elfcorehdr_addr); + image->elf_load_addr); if (elfcorehdr_strlen + cmdline_len > COMMAND_LINE_SIZE) { pr_err("Appending elfcorehdr= exceeds cmdline size\n"); @@ -263,8 +263,8 @@ int setup_new_fdt(const struct kimage *image, void *fdt, * Avoid elfcorehdr from being stomped on in kdump kernel by * setting up memory reserve map. */ - ret = fdt_add_mem_rsv(fdt, image->arch.elfcorehdr_addr, - image->arch.elf_headers_sz); + ret = fdt_add_mem_rsv(fdt, image->elf_load_addr, + image->elf_headers_sz); if (ret) { pr_err("Error reserving elfcorehdr memory: %s\n", fdt_strerror(ret)); diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index c69bcf9b547a..4350f225bb67 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -815,9 +815,9 @@ static int load_elfcorehdr_segment(struct kimage *image, struct kexec_buf *kbuf) goto out; } - image->arch.elfcorehdr_addr = kbuf->mem; - image->arch.elf_headers_sz = headers_sz; - image->arch.elf_headers = headers; + image->elf_load_addr = kbuf->mem; + image->elf_headers_sz = headers_sz; + image->elf_headers = headers; out: kfree(cmem); return ret; @@ -851,7 +851,7 @@ int load_crashdump_segments_ppc64(struct kimage *image, return ret; } pr_debug("Loaded elf core header at 0x%lx, bufsz=0x%lx memsz=0x%lx\n", - image->arch.elfcorehdr_addr, kbuf->bufsz, kbuf->memsz); + image->elf_load_addr, kbuf->bufsz, kbuf->memsz); return 0; } @@ -1107,9 +1107,9 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image) vfree(image->arch.backup_buf); image->arch.backup_buf = NULL; - vfree(image->arch.elf_headers); - image->arch.elf_headers = NULL; - image->arch.elf_headers_sz = 0; + vfree(image->elf_headers); + image->elf_headers = NULL; + image->elf_headers_sz = 0; return kexec_image_post_load_cleanup_default(image); }