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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D8AFBC47258 for ; Wed, 31 Jan 2024 15:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7N86ZwlceVVfAMHSoOrgG8HxIp5pLvi47NCKGb93lbA=; b=T/+EHPXfWiUmCY GSne2Z0ATJwDRC+YzuNC4a3OqPLCiocW7VBIoJh9KZa4KmHy3JmCuYCutB1WfdxFhNqusl/bW3uRU ZcetEIWtBjQdapC2RZxqi3ukJ1PICnvSJY3j8mbg2+8Ut0BXvh7BR6nCEt2CRj4wjYO+2TCPOT7Po ezZmOsZjgBjH5loKLcp16A25QuJYhIILIsS297wPG7SC0gY9QFki/lTjEnmEvCYlS1xw3IxzGSdyL ZYyYXFEty8GY4Czgkr88WxmtiIAwFPlz/t0BRWNjHTFc/5bgKBXCrfDeCE75q5i5mAOXZbAR+Focc AgK1QEUqXKoh8X8n/SMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVCUm-00000004Cwd-1oKl; Wed, 31 Jan 2024 15:27:24 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVCUb-00000004Cs7-0VKu for linux-arm-kernel@lists.infradead.org; Wed, 31 Jan 2024 15:27:14 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1242561835; Wed, 31 Jan 2024 15:27:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 953FBC43141; Wed, 31 Jan 2024 15:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706714831; bh=19Hap+jLLwl5/KUouZC5xJUm2952vDYNgv2x4gYBsJ8=; h=Date:From:To:List-Id:Cc:Subject:References:In-Reply-To:From; b=IMUECFk4IsuVJekwgnSVNtYRLCBMpnC1fVqiDc/WVEP2cs/45v0TH1d0Njhd3Wrvs DHqmKcS89rbwbgoSwgxUJZbyx6Bp0Hro0yXENdlO0/SOEiofJbJjX26Odp6VBk7CgE HuRrk4A60wHkDQQWqENmPVL3nTvjZEbq5SY6vn/EMk02MYtNwF43DeToI3BNlhZro2 3R91SRBIPwho2wLYHCSUdLpinOl1lD2iM+I+SsIP9nzPUvro64J4Vewd5dDtQmMspK QJIZOQEaqUVqgufuZMEhuewAy0T8ZQBrta8JZ8RRekOzYiymyk76sVifG6A7Lw99fv BE4DrcuAXZIOg== Date: Wed, 31 Jan 2024 09:27:09 -0600 From: Rob Herring To: Oreoluwa Babatunde Cc: catalin.marinas@arm.com, will@kernel.org, frowand.list@gmail.com, vgupta@kernel.org, arnd@arndb.de, olof@lixom.net, soc@kernel.org, guoren@kernel.org, monstr@monstr.eu, palmer@dabbelt.com, aou@eecs.berkeley.edu, dinguyen@kernel.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, jonas@southpole.se, stefan.kristiansson@saunalahti.fi, shorne@gmail.com, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, glaubitz@physik.fu-berlin.de, richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net, chris@zankel.net, jcmvbkbc@gmail.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, kernel@quicinc.com Subject: Re: [PATCH 07/46] Loongarch: reserved_mem: Implement the new processing order for reserved memory Message-ID: <20240131152709.GA1272666-robh@kernel.org> References: <20240126235425.12233-1-quic_obabatun@quicinc.com> <20240126235425.12233-8-quic_obabatun@quicinc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240126235425.12233-8-quic_obabatun@quicinc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240131_072713_259204_D5E6A7C2 X-CRM114-Status: GOOD ( 22.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jan 26, 2024 at 03:53:46PM -0800, Oreoluwa Babatunde wrote: > Call early_fdt_scan_reserved_mem() in place of > early_init_fdt_scan_reserved_mem() to carry out the first stage of the > reserved memory processing only. > > The early_fdt_scan_reserved_mem() function is used to scan through the > DT and mark all the reserved memory regions as reserved or nomap as > needed, as well as allocate the memory required by the > dynamically-placed > reserved memory regions. > > The second stage of the reserved memory processing is done by > fdt_init_reserved_mem(). This function is used to store the information > of the statically-placed reserved memory nodes in the reserved_mem > array as well as call the region specific initialization function on all > the stored reserved memory regions. > > The call to fdt_init_reserved_mem() is placed right after > early_fdt_scan_reserved_mem() since memblock allocated memory should > already be writable at this point. > > Signed-off-by: Oreoluwa Babatunde > --- > arch/loongarch/kernel/setup.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c > index edf2bba80130..72b164d3ace0 100644 > --- a/arch/loongarch/kernel/setup.c > +++ b/arch/loongarch/kernel/setup.c > @@ -30,6 +30,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -390,8 +391,9 @@ static void __init arch_mem_init(char **cmdline_p) > > check_kernel_sections_mem(); > > - early_init_fdt_scan_reserved_mem(); > + early_fdt_scan_reserved_mem(); Looking at the loongarch code, there's an existing problem with the order of init. This is done after unflattening and copying the DT. That means the kernel could freely allocate memory for the DT in a reserved region. Rob _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel