devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: Oreoluwa Babatunde <quic_obabatun@quicinc.com>
Cc: chenhuacai@kernel.org, jonas@southpole.se,
	stefan.kristiansson@saunalahti.fi, ysato@users.sourceforge.jp,
	dalias@libc.org, glaubitz@physik.fu-berlin.de,
	robh+dt@kernel.org, frowand.list@gmail.com,
	linux-openrisc@vger.kernel.org, loongarch@lists.linux.dev,
	linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, kernel@quicinc.com
Subject: Re: [PATCH 2/3] openrisc: Call setup_memory() earlier in the init sequence
Date: Fri, 8 Mar 2024 22:27:48 +0000	[thread overview]
Message-ID: <ZeuQ5EFFCw3O8qkS@antec> (raw)
In-Reply-To: <1707524971-146908-3-git-send-email-quic_obabatun@quicinc.com>

On Fri, Feb 09, 2024 at 04:29:30PM -0800, Oreoluwa Babatunde wrote:
> The unflatten_and_copy_device_tree() function contains a call to
> memblock_alloc(). This means that memblock is allocating memory before
> any of the reserved memory regions are set aside in the setup_memory()
> function which calls early_init_fdt_scan_reserved_mem(). Therefore,
> there is a possibility for memblock to allocate from any of the
> reserved memory regions.
> 
> Hence, move the call to setup_memory() to be earlier in the init
> sequence so that the reserved memory regions are set aside before any
> allocations are done using memblock.
> 
> Signed-off-by: Oreoluwa Babatunde <quic_obabatun@quicinc.com>
> ---
>  arch/openrisc/kernel/setup.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
> index 9cf7fb6..be56eaa 100644
> --- a/arch/openrisc/kernel/setup.c
> +++ b/arch/openrisc/kernel/setup.c
> @@ -255,6 +255,9 @@ void calibrate_delay(void)
>  
>  void __init setup_arch(char **cmdline_p)
>  {
> +	/* setup memblock allocator */
> +	setup_memory();
> +
>  	unflatten_and_copy_device_tree();
>  
>  	setup_cpuinfo();
> @@ -278,9 +281,6 @@ void __init setup_arch(char **cmdline_p)
>  	}
>  #endif
>  
> -	/* setup memblock allocator */
> -	setup_memory();
> -
>  	/* paging_init() sets up the MMU and marks all pages as reserved */
>  	paging_init();

This looks good.  I will merge it via the openrisc queue as you requested.

-Stafford

  reply	other threads:[~2024-03-08 22:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-10  0:29 [PATCH 0/3] Restructure init sequence to set aside reserved memory earlier Oreoluwa Babatunde
2024-02-10  0:29 ` [PATCH 1/3] loongarch: Call arch_mem_init() before platform_init() in the init sequence Oreoluwa Babatunde
2024-02-14 13:03   ` Huacai Chen
2024-02-14 21:31     ` Oreoluwa Babatunde
2024-02-15  9:37       ` Huacai Chen
2024-02-10  0:29 ` [PATCH 2/3] openrisc: Call setup_memory() earlier " Oreoluwa Babatunde
2024-03-08 22:27   ` Stafford Horne [this message]
2024-02-10  0:29 ` [PATCH 3/3] sh: Call paging_init() " Oreoluwa Babatunde
2024-03-11 16:02   ` Rob Herring
2024-03-05 18:59 ` [PATCH 0/3] Restructure init sequence to set aside reserved memory earlier Oreoluwa Babatunde
2024-03-08 22:20   ` Stafford Horne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZeuQ5EFFCw3O8qkS@antec \
    --to=shorne@gmail.com \
    --cc=chenhuacai@kernel.org \
    --cc=dalias@libc.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=jonas@southpole.se \
    --cc=kernel@quicinc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-openrisc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=quic_obabatun@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=stefan.kristiansson@saunalahti.fi \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).