U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: Simon Glass <sjg@chromium.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Michal Simek <michal.simek@amd.com>,
	Lean Sheng Tan <sheng.tan@9elements.com>,
	Bin Meng <bmeng.cn@gmail.com>, Devarsh Thakkar <devarsht@ti.com>,
	Francis Laniel <francis.laniel@amarulasolutions.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Kever Yang <kever.yang@rock-chips.com>,
	Manoj Sai <abbaraju.manojsai@amarulasolutions.com>,
	Marek Vasut <marex@denx.de>, Nikhil M Jain <n-jain1@ti.com>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
	Suniel Mahesh <sunil@amarulasolutions.com>,
	Tom Rini <trini@konsulko.com>,
	Troy Kisky <troykiskyboundary@gmail.com>
Subject: Re: [PATCH v2 15/21] spl: Plumb in the Universal Payload handoff
Date: Thu, 18 Jul 2024 09:54:23 -0400	[thread overview]
Message-ID: <325e6cc7-8210-8e95-0267-10d84192a406@gmail.com> (raw)
In-Reply-To: <20240713070055.2172883-16-sjg@chromium.org>

On 7/13/24 03:00, Simon Glass wrote:
> Specify the FIT and include information about each loaded image, as
> required by the UPL handoff.
> 
> Write the UPL handoff into the bloblist before jumping to the next phase.
> 
> Control this using a runtime flag to avoid conflicting with other
> handoff mechanisms.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v2:
> - Hang when something goes wrong, to avoid a broken boot
> - Add a runtime flag to enable UPL
> 
>   common/spl/spl.c                  |  8 ++++++++
>   common/spl/spl_fit.c              | 22 ++++++++++++++++++++++
>   include/asm-generic/global_data.h |  4 ++++
>   3 files changed, 34 insertions(+)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 7794ddccade..d6a364de6ee 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -810,6 +810,14 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>   			printf(SPL_TPL_PROMPT
>   			       "SPL hand-off write failed (err=%d)\n", ret);
>   	}
> +	if (CONFIG_IS_ENABLED(UPL_OUT) && (gd->flags & GD_FLG_UPL)) {
> +		ret = spl_write_upl_handoff(&spl_image);
> +		if (ret) {
> +			printf(SPL_TPL_PROMPT
> +			       "UPL hand-off write failed (err=%d)\n", ret);
> +			hang();
> +		}
> +	}
>   	if (CONFIG_IS_ENABLED(BLOBLIST)) {
>   		ret = bloblist_finish();
>   		if (ret)
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index 2a097f4464c..b288f675ae3 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -12,6 +12,7 @@
>   #include <memalign.h>
>   #include <mapmem.h>
>   #include <spl.h>
> +#include <upl.h>
>   #include <sysinfo.h>
>   #include <asm/global_data.h>
>   #include <asm/io.h>
> @@ -645,6 +646,8 @@ static int spl_fit_load_fpga(struct spl_fit_info *ctx,
>   		printf("%s: Cannot load the FPGA: %i\n", __func__, ret);
>   		return ret;
>   	}
> +	upl_add_image(node, fpga_image.load_addr, fpga_image.size,
> +		      fdt_getprop(ctx->fit, node, FIT_DESC_PROP, NULL));

Does load_addr even make sense for FPGAs?

And I noticed that you always call this after load_simple_fit/fit_image_load.
Could we call upl_add_image in those functions instead?

>   	return spl_fit_upload_fpga(ctx, node, &fpga_image);
>   }
> @@ -768,6 +771,9 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
>   	if (ret)
>   		return ret;
>   
> +	upl_add_image(node, spl_image->load_addr, spl_image->size,
> +		      fdt_getprop(ctx.fit, node, FIT_DESC_PROP, NULL));
> +
>   	/*
>   	 * For backward compatibility, we treat the first node that is
>   	 * as a U-Boot image, if no OS-type has been declared.
> @@ -811,6 +817,8 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
>   			       __func__, index, ret);
>   			return ret;
>   		}
> +		upl_add_image(node, image_info.load_addr, image_info.size,
> +			      fdt_getprop(ctx.fit, node, FIT_DESC_PROP, NULL));
>   
>   		if (spl_fit_image_is_fpga(ctx.fit, node))
>   			spl_fit_upload_fpga(&ctx, node, &image_info);
> @@ -847,6 +855,8 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
>   		spl_image->entry_point = spl_image->load_addr;
>   
>   	spl_image->flags |= SPL_FIT_FOUND;
> +	upl_set_fit_info(map_to_sysmem(ctx.fit), ctx.conf_node,
> +			 spl_image->entry_point);

I think this should be virt_to_phys, since we aren't really mapping it.

>   
>   	return 0;
>   }
> @@ -891,6 +901,9 @@ int spl_load_fit_image(struct spl_image_info *spl_image,
>   	if (ret < 0)
>   		return ret;
>   
> +	upl_add_image(ret, fw_data, fw_len,
> +		      fdt_getprop((void *)header, ret, FIT_DESC_PROP, NULL));
> +
>   	spl_image->size = fw_len;
>   	spl_image->load_addr = fw_data;
>   	if (fit_image_get_entry(header, ret, &spl_image->entry_point))
> @@ -911,6 +924,9 @@ int spl_load_fit_image(struct spl_image_info *spl_image,
>   	if (ret >= 0) {
>   		spl_image->fdt_addr = (void *)dt_data;
>   
> +		upl_add_image(ret, dt_data, dt_len,
> +		      fdt_getprop((void *)header, ret, FIT_DESC_PROP, NULL));
> +
>   		if (spl_image->os == IH_OS_U_BOOT) {
>   			/* HACK: U-Boot expects FDT at a specific address */
>   			fdt_hack = spl_image->load_addr + spl_image->size;
> @@ -940,7 +956,13 @@ int spl_load_fit_image(struct spl_image_info *spl_image,
>   				     &img_data, &img_len);
>   		if (ret < 0)
>   			return ret;
> +		upl_add_image(ret, img_data, img_len,
> +		      fdt_getprop((void *)header, ret, FIT_DESC_PROP, NULL));
>   	}
>   
> +	spl_image->flags |= SPL_FIT_FOUND;

This change is unrelated and should be moved into a separate commit.

> +	upl_set_fit_info(map_to_sysmem(header), conf_noffset,
> +			 spl_image->entry_point);
> +
>   	return 0;
>   }
> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> index 98d822530d8..37643a4bbb9 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -716,6 +716,10 @@ enum gd_flags {
>   	 * @GD_FLG_HUSH_MODERN_PARSER: Use hush 2021 parser.
>   	 */
>   	GD_FLG_HUSH_MODERN_PARSER = 0x2000000,
> +	/**
> +	 * @GD_FLG_UPL: Read/write a Universal Payload (UPL) handoff
> +	 */
> +	GD_FLG_UPL = 0x4000000,
>   };
>   
>   #endif /* __ASSEMBLY__ */


  reply	other threads:[~2024-07-18 13:54 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-13  7:00 [PATCH v2 00/21] Universal Payload initial series Simon Glass
2024-07-13  7:00 ` [PATCH v2 01/21] sandbox: Use const in os_jump_to_file() Simon Glass
2024-07-18  8:02   ` Mattijs Korpershoek
2024-07-13  7:00 ` [PATCH v2 02/21] sandbox: Fix a comment in os_find_u_boot() Simon Glass
2024-07-18  8:02   ` Mattijs Korpershoek
2024-07-13  7:00 ` [PATCH v2 03/21] test: Move some SPL-loading test-code into sandbox common Simon Glass
2024-07-18 14:11   ` Sean Anderson
2024-07-13  7:00 ` [PATCH v2 04/21] sandbox: Enable SPL_LOAD_BLOCK Simon Glass
2024-07-18 13:28   ` Sean Anderson
2024-07-18 23:58     ` Sean Anderson
2024-07-13  7:00 ` [PATCH v2 05/21] fdt: Don't overwrite bloblist devicetree Simon Glass
2024-07-13  7:00 ` [PATCH v2 06/21] sandbox: fdt: Avoid overwriting an existing fdt Simon Glass
2024-07-13  7:00 ` [PATCH v2 07/21] sandbox: Return error code from read/write/seek Simon Glass
2024-07-13  7:00 ` [PATCH v2 08/21] sandbox: Add ELF file to VPL u-boot.img Simon Glass
2024-07-13  7:00 ` [PATCH v2 09/21] sandbox: Set up global_data earlier Simon Glass
2024-07-13  7:00 ` [PATCH v2 10/21] upl: Add support for reading a upl handoff Simon Glass
2024-07-18 14:41   ` Heinrich Schuchardt
2024-07-20 12:36     ` Simon Glass
2024-07-13  7:00 ` [PATCH v2 11/21] upl: Add support for writing " Simon Glass
2024-07-13  7:00 ` [PATCH v2 12/21] upl: Add basic tests Simon Glass
2024-07-13  7:00 ` [PATCH v2 13/21] upl: Add a command Simon Glass
2024-07-13  7:00 ` [PATCH v2 14/21] upl: Add support for Universal Payload in SPL Simon Glass
2024-07-13  7:00 ` [PATCH v2 15/21] spl: Plumb in the Universal Payload handoff Simon Glass
2024-07-18 13:54   ` Sean Anderson [this message]
2024-07-20 12:36     ` Simon Glass
2024-07-20 14:44       ` Sean Anderson
2024-07-21 10:08         ` Simon Glass
2024-07-13  7:00 ` [PATCH v2 16/21] upl: Plumb in universal payload to the init process Simon Glass
2024-07-13  7:00 ` [PATCH v2 17/21] sandbox_vpl: Enable Universal Payload Simon Glass
2024-07-13  7:00 ` [PATCH v2 18/21] upl: Add initial documentation Simon Glass
2024-07-13  7:00 ` [PATCH v2 19/21] sandbox: Add a flag to enable UPL Simon Glass
2024-07-13  7:00 ` [PATCH v2 20/21] sandbox: Add an SPL loader for UPL Simon Glass
2024-07-18 14:12   ` Sean Anderson
2024-07-20 12:36     ` Simon Glass
2024-07-13  7:00 ` [PATCH v2 21/21] upl: Add an end-to-end test Simon Glass
2024-07-13  8:12 ` [PATCH v2 00/21] Universal Payload initial series Mark Kettenis
2024-07-13 19:40   ` Heinrich Schuchardt
2024-07-16 19:08     ` Tom Rini
2024-07-18  8:23       ` Heinrich Schuchardt
2024-07-18 14:15         ` Tom Rini
2024-08-07 14:36   ` Simon Glass

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=325e6cc7-8210-8e95-0267-10d84192a406@gmail.com \
    --to=seanga2@gmail.com \
    --cc=abbaraju.manojsai@amarulasolutions.com \
    --cc=bmeng.cn@gmail.com \
    --cc=devarsht@ti.com \
    --cc=francis.laniel@amarulasolutions.com \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=marex@denx.de \
    --cc=michal.simek@amd.com \
    --cc=n-jain1@ti.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=sheng.tan@9elements.com \
    --cc=sjg@chromium.org \
    --cc=sunil@amarulasolutions.com \
    --cc=trini@konsulko.com \
    --cc=troykiskyboundary@gmail.com \
    --cc=u-boot@lists.denx.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