Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp582761rdb; Thu, 19 Oct 2023 12:47:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpeQT/e0OSqSKg19VGQedeozLYTilsQgmj/rVJt4p3cL04y9XPVt4Rza+8uH21seKiwBYw X-Received: by 2002:a05:6a00:9399:b0:6be:4789:97ba with SMTP id ka25-20020a056a00939900b006be478997bamr3084976pfb.3.1697744830979; Thu, 19 Oct 2023 12:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697744830; cv=none; d=google.com; s=arc-20160816; b=FZJuKDcn3xSCnI9U+qdIOYvGOQ867O9ESYsz5QGoACGKIcep3p8iaddWpSGkhqyc7a LPJawZav4o9cWEDFkxdoquM1MPsbpPujVA9RkYh55AVdjER04U8z2QAAS73dMD5gJq/M UsG7qyivn9UXfqBLBxQPxktSO1z2cPQVS7y09hy8mOknrCYxlKZcSAoTi8KIAevG1dpf z6+mjPV0+sJhdPnxOdonspJHUWObj2+VFxVzwhjoVZwRFJ7SAtjpaG7sSfq7mBMI3VuJ EywBhB9Z2GCMg/bnkgT1Vss8obt/Qs45Bse4IYgCt7JX9Mned4G4aKhIxHW/YprKrwDq RoNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yY8pehbY36m+eP7ngCw+oWz7Q2UDaHP6o/JLfmdrrqw=; fh=q7ubNN3nGbQ1rSOoNR72AdqeVS2TNwGtlRTH9ty+6uQ=; b=sTf1qbgrNQMySxp5nQu+FCXSTyzVLhdoi6W5JPqMq4GR1O8M1kQP6mz3XkpTscaGId BfWmudY5NotpPxsBM5bX3Sy6hEbvB6qbnD6T/YT9kMDA0P74c/0ztG7j3XZo8Vn7XMZ/ XtKPWrWeUOTmNgq98I4RfS3T1KiwO6+ztOp5A4aOtNaZ3HE0dKaL8+aJQSrt6WNSxkg0 4FutY2IHZ/HCrAaUy+bc3H3B28Mt5lLsvQlRNATzXPZTbT8T97NlaNFFnxAVjoeTytka QMRtwv0/7LGveb8LzAQVSYcluHj9kGga6LJDXbiU7wr1KunQQx6XmeI3hLodlRHyh7a1 Yn8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nDFWVqRH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id t40-20020a056a0013a800b0068e405d9217si341708pfg.302.2023.10.19.12.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 12:47:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nDFWVqRH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id D6FEA833E1FA; Thu, 19 Oct 2023 12:47:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346254AbjJSTrD (ORCPT + 99 others); Thu, 19 Oct 2023 15:47:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345159AbjJSTrC (ORCPT ); Thu, 19 Oct 2023 15:47:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0968114; Thu, 19 Oct 2023 12:47:00 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C58FC433CA; Thu, 19 Oct 2023 19:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697744820; bh=kJyJ53sEdpPJK6eagpUQpoxGIQ2v4UNjTrtx9ncWMjI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nDFWVqRHy/C2zMBklJ2uAXHxqdaqyNK8XEpcMD3XPazOM4a+k7fcBDHTcyt7zP87m BRoGBXdMVFnsreuu6oAkhuB84Hn7yaCb6NtgFo0JYvA3ethDF4zLq0EODdip5BHnJE uNajNGFKDO4kgMYHhw53oYyl0Y8B9iYX9dY4q9AYVwM0z/6HkDJFlFodgiHOLguqIM a6jWNYdB5MF1p3tiZZDjPIJs5Zj0f+gmi17m+01RO3fzNFX16MtotBWDwfdaIdUI5t NHh9LOeIDN2aqzeZcgTB2Pb3Wzp5dC9gE8fUCg38u0sOYm+9uWfgvpKULSivuohuFX KhFVy1K+yKSeQ== Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-507adc3381cso14464e87.3; Thu, 19 Oct 2023 12:47:00 -0700 (PDT) X-Gm-Message-State: AOJu0YwoZWO2y+cBuFpssxAWespnrakCz4ZBLqydAWh3Cu/VhFbPTc3z VAA+tcySJUJGYt97go9z05tA7p6kBMEUz+bHpQ== X-Received: by 2002:ac2:5328:0:b0:500:b74b:e53 with SMTP id f8-20020ac25328000000b00500b74b0e53mr2215352lfh.46.1697744818512; Thu, 19 Oct 2023 12:46:58 -0700 (PDT) MIME-Version: 1.0 References: <20231019184825.9712-1-quic_obabatun@quicinc.com> <20231019184825.9712-2-quic_obabatun@quicinc.com> In-Reply-To: <20231019184825.9712-2-quic_obabatun@quicinc.com> From: Rob Herring Date: Thu, 19 Oct 2023 14:46:46 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 1/3] of: reserved_mem: Change the order that reserved_mem regions are stored To: Oreoluwa Babatunde Cc: catalin.marinas@arm.com, will@kernel.org, frowand.list@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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 19 Oct 2023 12:47:09 -0700 (PDT) On Thu, Oct 19, 2023 at 1:49=E2=80=AFPM Oreoluwa Babatunde wrote: > > The dynamic allocation of the reserved_mem array needs to be done after > paging_init() is called because memory allocated using memblock_alloc() > is not writeable before that. > > Nodes that already have their starting address specified in the DT > (i.e. nodes that are defined using the "reg" property) can wait until > after paging_init() to be stored in the array. > But nodes that are dynamically placed need to be reserved and saved in > the array before paging_init() so that page table entries are not > created for these regions. > > Hence, change the code to: > 1. Before paging_init(), allocate and store information for the > dynamically placed reserved memory regions. > 2. After paging_init(), store the rest of the reserved memory regions > which are defined with the "reg" property. > > Signed-off-by: Oreoluwa Babatunde > --- > arch/arm64/kernel/setup.c | 4 +++ > drivers/of/fdt.c | 56 ++++++++++++++++++++++++++------- > drivers/of/of_private.h | 1 - > drivers/of/of_reserved_mem.c | 54 ++++++++++++++----------------- > include/linux/of_fdt.h | 1 + > include/linux/of_reserved_mem.h | 9 ++++++ > 6 files changed, 83 insertions(+), 42 deletions(-) > > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c > index 417a8a86b2db..6002d3ad0b19 100644 > --- a/arch/arm64/kernel/setup.c > +++ b/arch/arm64/kernel/setup.c > @@ -27,6 +27,8 @@ > #include > #include > #include > +#include > + > #include > #include > #include > @@ -346,6 +348,8 @@ void __init __no_sanitize_address setup_arch(char **c= mdline_p) > > paging_init(); > > + fdt_init_reserved_mem(); > + You removed this call from the common code and add it to arm64 arch code, doesn't that break every other arch? The very next thing done here is unflattening the DT. So another call from the arch code to the DT code isn't needed either. Rob