mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org,
	Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: Re: [PATCH] common: bootm: support locating kernel in FIT image in zero page
Date: Fri, 21 Jul 2023 09:03:32 +0200	[thread overview]
Message-ID: <20230721070332.GE26209@pengutronix.de> (raw)
In-Reply-To: <20230718100248.875155-1-a.fatoum@pengutronix.de>

On Tue, 18 Jul 2023 12:02:48 +0200, Ahmad Fatoum wrote:
> Since commit 7e2f6a1ffd64 ("uimage: disable zero page when loading to
> SDRAM at address 0x0"), we allow locating images loaded from files at
> address zero if that's within the SDRAM. This only applied to images
> loaded with file_to_sdram() and images that were already in RAM were
> still not allowed to overlap the zero page.
> 
> Fix this by doing in bootm_load_os() as was done in file_to_sdram(),
> namely, disabling zero page trapping for the duration of the memcpy.
> We need no further zero page handling afterwards, because kernel is
> booted after paging is disabled.
> 
> Cc: Michael Tretter <m.tretter@pengutronix.de>
> Reported-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>

> ---
>  common/bootm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/common/bootm.c b/common/bootm.c
> index 791d6b8fbbf1..4845c40958ae 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -13,6 +13,7 @@
>  #include <linux/stat.h>
>  #include <magicvar.h>
>  #include <uncompress.h>
> +#include <zero_page.h>
>  
>  static LIST_HEAD(handler_list);
>  
> @@ -119,7 +120,7 @@ int bootm_load_os(struct image_data *data, unsigned long load_address)
>  				(unsigned long long)load_address + kernel_size - 1);
>  			return -ENOMEM;
>  		}
> -		memcpy((void *)load_address, kernel, kernel_size);
> +		zero_page_memcpy((void *)load_address, kernel, kernel_size);
>  		return 0;
>  	}
>  
> -- 
> 2.39.2
> 
> 



  parent reply	other threads:[~2023-07-21  7:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 10:02 Ahmad Fatoum
2023-07-18 11:22 ` Steffen Trumtrar
2023-07-21  7:03 ` Michael Tretter [this message]
2023-07-26 10:17 ` Sascha Hauer

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=20230721070332.GE26209@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.trumtrar@pengutronix.de \
    /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