From mboxrd@z Thu Jan 1 00:00:00 1970 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=-25.0 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,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 DFA48C433E0 for ; Thu, 11 Feb 2021 01:56:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B27A964DF0 for ; Thu, 11 Feb 2021 01:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbhBKB4I (ORCPT ); Wed, 10 Feb 2021 20:56:08 -0500 Received: from linux.microsoft.com ([13.77.154.182]:34826 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbhBKBvX (ORCPT ); Wed, 10 Feb 2021 20:51:23 -0500 Received: from [192.168.0.104] (c-73-42-176-67.hsd1.wa.comcast.net [73.42.176.67]) by linux.microsoft.com (Postfix) with ESMTPSA id AB9BA20B6C40; Wed, 10 Feb 2021 17:50:31 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AB9BA20B6C40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1613008232; bh=vcDxofWnoZw2pmIkFjZcnPLsVS9ccFRA9624EzZW0Z4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Jfm5/BTa85WR6oMiaWJvCSPxwUcGCAbuGohT+l3IsPTLA0/XHJ9XTPrOZ9ouHIiEn fqMpr9/Du8pfJ11CBk69Rk/PIDFQQKzbLdevzANiI8pZIB2iCscYOSnEIt73KQIVbd 0zuc7MvncowulwiTCJHU9W16aZDwG3j99W7njgeU= Subject: Re: [PATCH v17 04/10] powerpc: Use common of_kexec_alloc_and_setup_fdt() To: Thiago Jung Bauermann Cc: zohar@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, 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 References: <20210209182200.30606-1-nramas@linux.microsoft.com> <20210209182200.30606-5-nramas@linux.microsoft.com> <87sg63nzwc.fsf@manicouagan.localdomain> From: Lakshmi Ramasubramanian Message-ID: Date: Wed, 10 Feb 2021 17:50:31 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87sg63nzwc.fsf@manicouagan.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On 2/10/21 5:42 PM, Thiago Jung Bauermann wrote: > > Lakshmi Ramasubramanian writes: > >> From: Rob Herring >> >> The code for setting up the /chosen node in the device tree >> and updating the memory reservation for the next kernel has been >> moved to of_kexec_alloc_and_setup_fdt() defined in "drivers/of/kexec.c". >> >> Use the common of_kexec_alloc_and_setup_fdt() to setup the device tree >> and update the memory reservation for kexec for powerpc. >> >> Signed-off-by: Rob Herring >> Signed-off-by: Lakshmi Ramasubramanian >> --- >> arch/powerpc/include/asm/kexec.h | 1 + >> arch/powerpc/kexec/elf_64.c | 29 ++++--- >> arch/powerpc/kexec/file_load.c | 132 +----------------------------- >> arch/powerpc/kexec/file_load_64.c | 3 + >> 4 files changed, 25 insertions(+), 140 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h >> index dbf09d2f36d0..bdd0ddb9ac4d 100644 >> --- a/arch/powerpc/include/asm/kexec.h >> +++ b/arch/powerpc/include/asm/kexec.h >> @@ -111,6 +111,7 @@ struct kimage_arch { >> unsigned long elf_headers_mem; >> unsigned long elf_headers_sz; >> void *elf_headers; >> + void *fdt; >> >> #ifdef CONFIG_IMA_KEXEC >> phys_addr_t ima_buffer_addr; >> diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c >> index d0e459bb2f05..bfabd06f99b1 100644 >> --- a/arch/powerpc/kexec/elf_64.c >> +++ b/arch/powerpc/kexec/elf_64.c >> @@ -19,6 +19,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -29,7 +30,6 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, >> unsigned long cmdline_len) >> { >> int ret; >> - unsigned int fdt_size; >> unsigned long kernel_load_addr; >> unsigned long initrd_load_addr = 0, fdt_load_addr; >> void *fdt; >> @@ -102,19 +102,13 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, >> pr_debug("Loaded initrd at 0x%lx\n", initrd_load_addr); >> } >> >> - fdt_size = fdt_totalsize(initial_boot_params) * 2; >> - fdt = kmalloc(fdt_size, GFP_KERNEL); >> + fdt = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr, >> + initrd_len, cmdline); >> if (!fdt) { >> pr_err("Not enough memory for the device tree.\n"); > > This error string can be a bit misleading now, since > of_kexec_alloc_and_setup_fdt() can fail for reasons other than lack of > memory. I suggest changing it to the error string from fdt_open_into() > below: > > pr_err("Error setting up the new device tree.\n"); > > With this change: Agreed - I will make this change. > > Reviewed-by: Thiago Jung Bauermann > > And also: > > Tested-by: Thiago Jung Bauermann > Thanks a lot for your help Thiago. -lakshmi