From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: pbl: uncompress: add comment explaining order of operations
Date: Tue, 13 Apr 2021 09:48:03 +0200 [thread overview]
Message-ID: <20210413074803.GK19819@pengutronix.de> (raw)
In-Reply-To: <20210403070346.3643335-1-ahmad@a3f.at>
On Sat, Apr 03, 2021 at 09:03:46AM +0200, Ahmad Fatoum wrote:
> When the PBL runs from flash, it relocates to RAM prior to extracting
> barebox proper. It does the sneaky thing of _not_ relocating the piggy
> data though, so read from flash and uncompression may latter happen
> at the same time.
>
> For this to work, it's critical that the variables pointing at the piggy
> data are evaluated before relocation. ARM does so and carefully uses
> them to derive the address of the PBL size later on instead of
> evaluating image_data_end again.
>
> When I ported the same code for RISC-V use, this got lost. Add a comment
> explaining the criticality of maintaining this order of operations.
>
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
> arch/arm/cpu/uncompress.c | 1 +
> 1 file changed, 1 insertion(+)
Applied, thanks
Sascha
>
> diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
> index db0fe98e0d83..2250b8ccd375 100644
> --- a/arch/arm/cpu/uncompress.c
> +++ b/arch/arm/cpu/uncompress.c
> @@ -52,6 +52,7 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
> void *pg_start, *pg_end;
> unsigned long pc = get_pc();
>
> + /* piggy data is not relocated, so determine the bounds now */
> pg_start = input_data + global_variable_offset();
> pg_end = input_data_end + global_variable_offset();
>
> --
> 2.30.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
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 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2021-04-13 7:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-03 7:03 Ahmad Fatoum
2021-04-13 7:48 ` 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=20210413074803.GK19819@pengutronix.de \
--to=sha@pengutronix.de \
--cc=ahmad@a3f.at \
--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