[PATCH v2 2/2] spl: fit: Add ability to jump to Linux via OpTee-OS on ARMv7a

Jerome Forissier jerome.forissier at linaro.org
Mon Jun 30 16:30:08 CEST 2025


Hi Marek,

On 6/30/25 02:08, Marek Vasut wrote:
> Add support for jumping to Linux kernel through OpTee-OS on ARMv7a to SPL.

Nitpicking: OP-TEE OS

Regards,
-- 
Jerome

> This is already supported on ARMv8a, this patch adds the ARMv7a support.
> Extend the SPL fitImage loader to record OpTee-OS load address and in case
> the load address is non-zero, use the same bootm-optee.S code used by the
> U-Boot fitImage jump code to start OpTee-OS first and jump to Linux next.
> 
> Signed-off-by: Marek Vasut <marek.vasut at mailbox.org>
> ---
> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Cc: Janne Grunau <j at jannau.net>
> Cc: Mattijs Korpershoek <mkorpershoek at kernel.org>
> Cc: Patrick Rudolph <patrick.rudolph at 9elements.com>
> Cc: Sam Edwards <cfsworks at gmail.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: u-boot at lists.denx.de
> ---
> V2: Include armv7.h only on non-ARM64
> ---
>  arch/arm/lib/spl.c   | 10 ++++++++++
>  common/spl/spl_fit.c | 20 ++++++++++++++++++++
>  include/spl.h        |  3 +++
>  3 files changed, 33 insertions(+)
> 
> diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c
> index c43a63f1819..71e882b1f2c 100644
> --- a/arch/arm/lib/spl.c
> +++ b/arch/arm/lib/spl.c
> @@ -16,6 +16,9 @@
>  #include <asm/global_data.h>
>  #include <linux/compiler.h>
>  #include <asm/mach-types.h>
> +#if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
> +#include <asm/armv7.h>
> +#endif
>  
>  #ifndef CONFIG_SPL_DM
>  /* Pointer to as well as the global data structure for SPL */
> @@ -72,6 +75,13 @@ void __noreturn jump_to_image_linux(struct spl_image_info *spl_image)
>  	image_entry_arg_t image_entry =
>  		(image_entry_arg_t)(uintptr_t) spl_image->entry_point;
>  	cleanup_before_linux();
> +#if defined(CONFIG_BOOTM_OPTEE) && defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
> +	if (spl_image->optee_addr)
> +		boot_jump_linux_via_optee((void *)(spl_image->entry_point),
> +					  machid,
> +					  (u32)(spl_image->arg),
> +					  spl_image->optee_addr);
> +#endif
>  	image_entry(0, machid, spl_image->arg);
>  }
>  #endif	/* CONFIG_ARM64 */
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index b3824af475f..7f4b780b6dd 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -545,6 +545,23 @@ static int spl_fit_image_is_fpga(const void *fit, int node)
>  	return !strcmp(type, "fpga");
>  }
>  
> +static void spl_fit_image_record_arm32_optee(const void *fit, int node,
> +					     struct spl_image_info *spl_image,
> +					     struct spl_image_info *image_info)
> +{
> +#if defined(CONFIG_BOOTM_OPTEE) && defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
> +	const char *type = fdt_getprop(fit, node, FIT_TYPE_PROP, NULL);
> +
> +	if (!type)
> +		return;
> +
> +	if (strcmp(type, "tee"))
> +		return;
> +
> +	spl_image->optee_addr = image_info->load_addr;
> +#endif
> +}
> +
>  static int spl_fit_image_get_os(const void *fit, int noffset, uint8_t *os)
>  {
>  	if (!CONFIG_IS_ENABLED(FIT_IMAGE_TINY) || CONFIG_IS_ENABLED(OS_BOOT))
> @@ -898,6 +915,9 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
>  		    image_info.entry_point != FDT_ERROR)
>  			spl_image->entry_point = image_info.entry_point;
>  
> +		spl_fit_image_record_arm32_optee(ctx.fit, node, spl_image,
> +						 &image_info);
> +
>  		/* Record our loadables into the FDT */
>  		if (!CONFIG_IS_ENABLED(FIT_IMAGE_TINY) &&
>  		    xpl_get_fdt_update(info) && spl_image->fdt_addr)
> diff --git a/include/spl.h b/include/spl.h
> index 7c10c7f792e..148299a5494 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -288,6 +288,9 @@ struct spl_image_info {
>  	ulong entry_point;
>  #if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL)
>  	void *fdt_addr;
> +#endif
> +#if defined(CONFIG_BOOTM_OPTEE) && defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
> +	ulong optee_addr;
>  #endif
>  	u32 boot_device;
>  	u32 offset;


More information about the U-Boot mailing list