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=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 E78BFC433DB for ; Thu, 11 Feb 2021 01:52:10 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A55DD64DBD for ; Thu, 11 Feb 2021 01:52:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A55DD64DBD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LKCZfbeCCo2pXeKG7uOHbW48v94KL8evxob4cpuKaG0=; b=LrClr4uXYMqb843eINFZKQCnq zt+n6rzfYyzfUaN2FSpaCRrHHqLWZJnwGyp+eDZkde0zfTw7IiCN4p4FwjFwdGdQRwbUNyE66Cv/1 zCigR1lfAtQf6vu/zzlBY/mM/FrfqxqtugyaK+ftDo5Rp7kmk1kMSsRq9YlkR1Gshtm+1Hv7vVk7/ 3HGRgRjJGIrCz431mP+XQvP4xx978EEw+ZekIyNPvP030nHONLuRQCoQtda1PBo3tiMtEgSRFNeMC FbSVTsng8PhMCkB0SdwWdNbyzfyXbA/UarKAQ9+M48yGqQYux9jD22T9r/mmZ153QyLHNv219N6vh haCMHOGSw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lA17t-0004zD-6Y; Thu, 11 Feb 2021 01:50:37 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lA17q-0004yo-Du for linux-arm-kernel@lists.infradead.org; Thu, 11 Feb 2021 01:50:35 +0000 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 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-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210210_205034_744606_D44B74B4 X-CRM114-Status: GOOD ( 22.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, benh@kernel.crashing.org, tao.li@vivo.com, zohar@linux.ibm.com, paulus@samba.org, vincenzo.frascino@arm.com, frowand.list@gmail.com, sashal@kernel.org, robh@kernel.org, mpe@ellerman.id.au, masahiroy@kernel.org, jmorris@namei.org, takahiro.akashi@linaro.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, serge@hallyn.com, devicetree@vger.kernel.org, pasha.tatashin@soleen.com, will@kernel.org, prsriva@linux.microsoft.com, hsinyi@chromium.org, allison@lohutok.net, christophe.leroy@c-s.fr, mbrugger@suse.com, balajib@linux.microsoft.com, dmitry.kasatkin@gmail.com, linux-kernel@vger.kernel.org, james.morse@arm.com, gregkh@linuxfoundation.org, joe@perches.com, linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel