mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] fixup! ARM: mmu32: Use pages for early MMU setup
Date: Mon, 22 May 2023 10:18:05 +0200	[thread overview]
Message-ID: <20230522081805.GJ29365@pengutronix.de> (raw)
In-Reply-To: <20230522052054.1037494-1-a.fatoum@pengutronix.de>

On Mon, May 22, 2023 at 07:20:54AM +0200, Ahmad Fatoum wrote:
> ARM: mmu32: fix alignment when early remapping .text section
> 
> arch_remap_range has a BUG_ON unaligned memory region start. On AM335x
> (Tested with Beaglebone Black), _stext for the second stage barebox.bin
> is not page-aligned, so this broke the boot. Use PAGE_ALIGN_DOWN to fix
> this.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/cpu/mmu_32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/cpu/mmu_32.c b/arch/arm/cpu/mmu_32.c
> index dc4b0e414d57..852c5626dedd 100644
> --- a/arch/arm/cpu/mmu_32.c
> +++ b/arch/arm/cpu/mmu_32.c
> @@ -583,7 +583,7 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize)
>  	/* maps main memory as cachable */
>  	arch_remap_range((void *)membase, memsize - OPTEE_SIZE, MAP_CACHED);
>  	arch_remap_range((void *)membase + memsize - OPTEE_SIZE, OPTEE_SIZE, MAP_UNCACHED);
> -	arch_remap_range(_stext, PAGE_ALIGN(_etext - _stext), MAP_CACHED);
> +	arch_remap_range((void *)PAGE_ALIGN_DOWN((uintptr_t)_stext), PAGE_ALIGN(_etext - _stext), MAP_CACHED);
>  
>  	__mmu_cache_on();
>  }
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2023-05-22  8:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22  5:20 Ahmad Fatoum
2023-05-22  8:18 ` Sascha Hauer [this message]

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=20230522081805.GJ29365@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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