All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@amd.com>
To: Raymond Mao <raymond.mao@linaro.org>,
	u-boot@lists.denx.de, ilias.apalodimas@linaro.org,
	sjg@chromium.org, jwerner@chromium.org
Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>,
	Bin Meng <bmeng.cn@gmail.com>, Nikhil M Jain <n-jain1@ti.com>,
	Baruch Siach <baruch@tkos.co.il>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Stefan Roese <sr@denx.de>, Sean Anderson <seanga2@gmail.com>
Subject: Re: [PATCH 3/5] bloblist: Load the bloblist from the previous loader
Date: Wed, 20 Dec 2023 11:57:09 +0100	[thread overview]
Message-ID: <f2221d44-cbb7-4355-b9a1-ecea47af62c5@amd.com> (raw)
In-Reply-To: <20231219211114.393193-4-raymond.mao@linaro.org>



On 12/19/23 22:11, Raymond Mao wrote:
> During bloblist initialization, when CONFIG_OF_BOARD is defined,
> invoke the platform custom function to load the bloblist via boot
> arguments from the previous loader.
> If the bloblist exists, copy it into the fixed bloblist memory region.
> 
> Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
> ---
>   common/bloblist.c  | 47 ++++++++++++++++++++++++++++------------------
>   include/bloblist.h | 16 ++++++++++++++++
>   2 files changed, 45 insertions(+), 18 deletions(-)
> 
> diff --git a/common/bloblist.c b/common/bloblist.c
> index 232ca4c6ce..c89f7a1554 100644
> --- a/common/bloblist.c
> +++ b/common/bloblist.c
> @@ -486,31 +486,38 @@ int bloblist_init(void)
>   	bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
>   	int ret = -ENOENT;
>   	ulong addr, size;
> -	bool expected;
> -
> -	/**
> -	 * We don't expect to find an existing bloblist in the first phase of
> -	 * U-Boot that runs. Also we have no way to receive the address of an
> -	 * allocated bloblist from a previous stage, so it must be at a fixed
> +	/*
> +	 * If U-Boot is not in the first phase, an existing bloblist must be
> +	 * at a fixed address.
> +	 */
> +	bool from_addr = fixed && !u_boot_first_phase();
> +	/*
> +	 * If U-Boot is in the first phase that a board specific routine should
> +	 * install the bloblist passed from previous loader to this fixed
>   	 * address.
>   	 */
> -	expected = fixed && !u_boot_first_phase();
> +	bool from_board = fixed && IS_ENABLED(CONFIG_OF_BOARD) &&
> +			  u_boot_first_phase();
> +
>   	if (spl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
> -		expected = false;
> +		from_addr = false;
>   	if (fixed)
>   		addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
>   				      CONFIG_BLOBLIST_ADDR);
>   	size = CONFIG_BLOBLIST_SIZE;
> -	if (expected) {
> +
> +	if (from_board)
> +		ret = board_bloblist_from_boot_arg(addr, size);
> +	else if (from_addr)
>   		ret = bloblist_check(addr, size);
> -		if (ret) {
> -			log_warning("Expected bloblist at %lx not found (err=%d)\n",
> -				    addr, ret);
> -		} else {
> -			/* Get the real size, if it is not what we expected */
> -			size = gd->bloblist->total_size;
> -		}
> -	}
> +
> +	if (ret)
> +		log_warning("Bloblist at %lx not found (err=%d)\n",
> +			    addr, ret);
> +	else
> +		/* Get the real size */
> +		size = gd->bloblist->total_size;
> +
>   	if (ret) {
>   		if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
>   			void *ptr = memalign(BLOBLIST_ALIGN, size);
> @@ -519,7 +526,8 @@ int bloblist_init(void)
>   				return log_msg_ret("alloc", -ENOMEM);
>   			addr = map_to_sysmem(ptr);
>   		} else if (!fixed) {
> -			return log_msg_ret("!fixed", ret);
> +			return log_msg_ret("BLOBLIST_FIXED is not enabled",
> +					   ret);
>   		}
>   		log_debug("Creating new bloblist size %lx at %lx\n", size,
>   			  addr);
> @@ -532,6 +540,9 @@ int bloblist_init(void)
>   		return log_msg_ret("ini", ret);
>   	gd->flags |= GD_FLG_BLOBLIST_READY;
>   
> +	bloblist_show_stats();
> +	bloblist_show_list();
> +
>   	return 0;
>   }
>   
> diff --git a/include/bloblist.h b/include/bloblist.h
> index b5d0f147f6..f5c623133d 100644
> --- a/include/bloblist.h
> +++ b/include/bloblist.h
> @@ -445,6 +445,22 @@ void bloblist_reloc(void *to, uint to_size, void *from, uint from_size);
>    */
>   int bloblist_init(void);
>   
> +#if (IS_ENABLED(CONFIG_ARCH_QEMU) && IS_ENABLED(CONFIG_ARM))

How do you think that others start to use it?
Adding that platforms here? I don't think it is scalable.

Thanks,
Michal

  reply	other threads:[~2023-12-20 10:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 21:11 [PATCH 0/5] Handoff bloblist from previous boot stage Raymond Mao
2023-12-19 21:11 ` [PATCH 1/5] bloblist: add API to check the register conventions Raymond Mao
2023-12-20 12:54   ` Ilias Apalodimas
2023-12-20 15:33     ` Raymond Mao
2023-12-19 21:11 ` [PATCH 2/5] qemu-arm: Get bloblist from boot arguments Raymond Mao
2023-12-20 11:03   ` Michal Simek
2023-12-20 15:36     ` Raymond Mao
2023-12-19 21:11 ` [PATCH 3/5] bloblist: Load the bloblist from the previous loader Raymond Mao
2023-12-20 10:57   ` Michal Simek [this message]
2023-12-20 14:53     ` Raymond Mao
2023-12-20 16:40       ` Michal Simek
2023-12-20 20:12         ` Raymond Mao
2023-12-19 21:11 ` [PATCH 4/5] fdt: update the document and Kconfig description Raymond Mao
2023-12-19 21:11 ` [PATCH 5/5] qemu-arm: get FDT from bloblist Raymond Mao
2023-12-20 10:55   ` Michal Simek
2023-12-20 13:08   ` Ilias Apalodimas

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=f2221d44-cbb7-4355-b9a1-ecea47af62c5@amd.com \
    --to=michal.simek@amd.com \
    --cc=baruch@tkos.co.il \
    --cc=bmeng.cn@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jwerner@chromium.org \
    --cc=n-jain1@ti.com \
    --cc=neil.armstrong@linaro.org \
    --cc=raymond.mao@linaro.org \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=tuomas.tynkkynen@iki.fi \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.