ARM: bootm: Add support for starting Linux through OpTee-OS on ARMv7a
PATCH v2 1/2 ARM: bootm: Add support for starting Linux through OpTee-OS on ARMv7a
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a. This is only supported if U-Boot runs in PL1 secure. This change adds two components, one is fitImage OpTee-OS loadable handler, which makes a note of OpTee-OS being loaded and stores the load address for later jump to it. The second part is the actual jump to Linux through OpTee-OS. The jump through OpTee-OS requires set up of multiple CPU registers, r1 and r2 are passed through, r0 and r3 have to be set to 0, lr is set to Linux kernel entry point. This setup is done by new assembler function boot_jump_linux_via_optee().
The boot_jump_linux_via_optee() also includes STM32MP13xx late TZC configuration write, this cannot be moved easily, hence the ifdef.
---
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Janne Grunau <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Patrick Rudolph <[email protected]>
Cc: Sam Edwards <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
---
V2: - Add ifdeffery around armv7_init_nonsec(), boot_jump_linux_via_optee(),
secure_ram_addr() due to external dependencies which may not be reachable
- Add ifdeffery around arch_tee_image_process() to avoid breaking OMAP2 IH_TYPE_TEE loading
--- arch/arm/include/asm/armv7.h | 2 ++ arch/arm/lib/Makefile | 3 ++ arch/arm/lib/bootm-optee.S | 30 +++++++++++++++++++ arch/arm/lib/bootm.c | 56 ++++++++++++++++++++++++++++++------ 4 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 arch/arm/lib/bootm-optee.S
arch/arm/include/asm/armv7.h +2 -0
@@ -142,6 +142,8 @@ bool armv7_boot_nonsec(void);unsigned int _nonsec_init (void );void _do_nonsec_entry (void *target_pc,unsigned long r0,unsigned long r1,unsigned long r2); +void boot_jump_linux_via_optee (void *target_pc,unsigned long r1, +unsigned long r2,unsigned long tee_entry);void _smp_pen (void );extern char __secure_start[];
arch/arm/lib/Makefile +3 -0
@@ -41,6 +41,9 @@ obj-$(CONFIG_CMD_BOOTZ) += zimage.o endif obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o endif +ifndef CONFIG_ARM64 +obj-$(CONFIG_BOOTM_OPTEE) += bootm-optee.o +endif ifdef CONFIG_ARM64 obj-$(CONFIG_$(PHASE_)USE_ARCH_MEMSET) += memset-arm64.o obj-$(CONFIG_$(PHASE_)USE_ARCH_MEMCPY) += memcpy-arm64.o
arch/arm/lib/bootm-optee.S new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2025 Marek Vasut + */ +#include <config.h> +#include <linux/linkage.h> + +ENTRY(boot_jump_linux_via_optee) + mov r4, r3 + mov lr, r0 + mov r3, #0 + mov r0, #0 + + /* + * Special TZC handling on this platform, the last + * 'str' has to be immediately before 'bx' and can + * not be interleaved with any return from function + * call, if it is then the system hangs. + */ +#if defined(CONFIG_STM32MP13X) && !defined(CONFIG_TFABOOT) + ldr r6, =STM32_TZC_BASE + 0x114 + (0x20 * 2) + mov r7, #0x0 + str r7, [r6] + ldr r6, =STM32_TZC_BASE + 0x110 + (0x20 * 1) + mov r7, #0x1 + str r7, [r6] +#endif + + bx r4 +ENDPROC(boot_jump_linux_via_optee)
arch/arm/lib/bootm.c +47 -9
94 lines not on this page · raw message
Signature · 1 line
2.47.2
PATCH v2 2/2 spl: fit: Add ability to jump to Linux via OpTee-OS on ARMv7a
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a to SPL. 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.
---
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Janne Grunau <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Patrick Rudolph <[email protected]>
Cc: Sam Edwards <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
---
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(+)
arch/arm/lib/spl.c +10 -0
@@ -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 */
common/spl/spl_fit.c +20 -0
@@ -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)
include/spl.h +3 -0
@@ -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;
Signature · 1 line
2.47.2
Re: [PATCH v2 2/2] spl: fit: Add ability to jump to Linux via OpTee-OS on ARMv7a
Hi Marek,
Quoted 1 line · Marek Vasut
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a to SPL.
Nitpicking: OP-TEE OS
Regards,
Signature · 1 line
Jerome
Quoted 104 lines
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.Scode used by the U-Boot fitImage jump code to start OpTee-OS first and jump to Linux next.Signed-off-by Marek Vasut <[email protected]>---
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Janne Grunau <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Patrick Rudolph <[email protected]>
Cc: Sam Edwards <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
---
V2: Includearmv7.honly on non-ARM64--- arch/arm/lib/spl.c | 10 ++++++++++ common/spl/spl_fit.c | 20 ++++++++++++++++++++ include/spl.h | 3 +++ 3 files changed, 33 insertions(+)arch/arm/lib/spl.c +10
-0@@ -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 */ common/spl/spl_fit.c +20
-0@@ -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)include/spl.h +3
-0@@ -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;
Re: [PATCH v2 2/2] spl: fit: Add ability to jump to Linux via OpTee-OS on ARMv7a
On 6/30/25 4:30 PM, Jerome Forissier wrote:
Hi,
Quoted 4 lines · Marek Vasut
Quoted 1 line
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a to SPL.
Nitpicking: OP-TEE OS
Is this the official spelling ? I was always under the impression it was OpTee-OS . but maybe I am wrong .
Re: [PATCH v2 2/2] spl: fit: Add ability to jump to Linux via OpTee-OS on ARMv7a
Am 30. Juni 2025 18:22:10 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 9 lines · Jerome Forissier
Hi,
Quoted 4 lines · Marek Vasut
Quoted 1 line
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a to SPL.
Nitpicking: OP-TEE OS
Is this the official spelling ? I was always under the impression it was OpTee-OS . but maybe I am wrong.
OP-TEE (capital EE) or OP-TEE Trusted OS if you want to refer specifically to the secure side implementation. See: https://optee.readthedocs.io/en/latest/general/about.html and https://github.com/OP-TEE/optee_os
Re: [PATCH v2 2/2] spl: fit: Add ability to jump to Linux via OpTee-OS on ARMv7a
Quoted 5 lines · Heinrich Schuchardt
Am 30. Juni 2025 18:22:10 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 4 lines · Jerome Forissier
Hi,
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines · Marek Vasut
Quoted 1 line
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a to SPL.
Nitpicking: OP-TEE OS
Is this the official spelling ? I was always under the impression it was OpTee-OS . but maybe I am wrong.
OP-TEE (capital EE) or OP-TEE Trusted OS if you want to refer specifically to the secure side implementation. See: https://optee.readthedocs.io/en/latest/general/about.html and https://github.com/OP-TEE/optee_os
Yes, and the spelling 'optee' is correct when referring to a driver or subsystem in a commit subject.
Thanks,
Signature · 1 line
Jerome
Am 30. Juni 2025 02:08:05 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 10 lines
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a. This is only supported if U-Boot runs in PL1 secure. This change adds two components, one is fitImage OpTee-OS loadable handler, which makes a note of OpTee-OS being loaded and stores the load address for later jump to it. The second part is the actual jump to Linux through OpTee-OS. The jump through OpTee-OS requires set up of multiple CPU registers, r1 and r2 are passed through, r0 and r3 have to be set to 0, lr is set to Linux kernel entry point. This setup is done by new assembler function
boot_jump_linux_via_optee().
Quoted 2 lines
The
boot_jump_linux_via_optee()also includes STM32MP13xx late TZC configuration write, this cannot be moved easily, hence the ifdef.
Hello Marek,
Could you, please, add a documentation change to the series. This would allow reviewers to test your proposal.
Furthermore, please, provide tests on QEMU.
Best regards
Heinrich
Quoted 191 lines
Signed-off-by Marek Vasut <[email protected]>---
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Janne Grunau <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Patrick Rudolph <[email protected]>
Cc: Sam Edwards <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
---
V2: - Add ifdeffery aroundarmv7_init_nonsec(),boot_jump_linux_via_optee(),
secure_ram_addr()due to external dependencies which may not be reachable
- Add ifdeffery aroundarch_tee_image_process()to avoid breaking OMAP2IH_TYPE_TEEloading
---arch/arm/include/asm/armv7.h | 2 ++ arch/arm/lib/Makefile | 3 ++ arch/arm/lib/bootm-optee.S | 30 +++++++++++++++++++ arch/arm/lib/bootm.c | 56 ++++++++++++++++++++++++++++++------ 4 files changed, 82 insertions(+), 9 deletions(-)create mode 100644
arch/arm/lib/bootm-optee.Sarch/arm/include/asm/armv7.h +2
-0@@ -142,6 +142,8 @@ bool armv7_boot_nonsec(void);unsigned int _nonsec_init (void );void _do_nonsec_entry (void *target_pc,unsigned long r0,unsigned long r1,unsigned long r2); +void boot_jump_linux_via_optee (void *target_pc,unsigned long r1, +unsigned long r2,unsigned long tee_entry);void _smp_pen (void );extern char __secure_start[];arch/arm/lib/Makefile +0
-0@@ -41,6 +41,9 @@ obj-$(CONFIG_CMD_BOOTZ) += zimage.oendif
obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
endifarch/arm/lib/Makefile +3
-0+ifndef CONFIG_ARM64 +obj-$(CONFIG_BOOTM_OPTEE) += bootm-optee.o +endififdef
CONFIG_ARM64obj-$(CONFIG_$(PHASE_)USE_ARCH_MEMSET) += memset-arm64.o obj-$(CONFIG_$(PHASE_)USE_ARCH_MEMCPY) += memcpy-arm64.oarch/arm/lib/bootm-optee.S new file +30
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2025 Marek Vasut + */ +#include <config.h> +#include <linux/linkage.h> + +ENTRY(boot_jump_linux_via_optee) + mov r4, r3 + mov lr, r0 + mov r3, #0 + mov r0, #0 + + /* + * Special TZC handling on this platform, the last + * 'str' has to be immediately before 'bx' and can + * not be interleaved with any return from function + * call, if it is then the system hangs. + */ +#if defined(CONFIG_STM32MP13X) && !defined(CONFIG_TFABOOT) + ldr r6, =STM32_TZC_BASE + 0x114 + (0x20 * 2) + mov r7, #0x0 + str r7, [r6] + ldr r6, =STM32_TZC_BASE + 0x110 + (0x20 * 1) + mov r7, #0x1 + str r7, [r6] +#endif + + bx r4 +ENDPROC(boot_jump_linux_via_optee)arch/arm/lib/bootm.c +47
-9@@ -258,6 +258,11 @@ bool armv7_boot_nonsec(void) return nonsec; } +#else +bool armv7_boot_nonsec (void ) +{ +return false; +}#endif #ifdef CONFIG_ARM64 @@ -283,9 +288,9 @@ static void switch_to_el1(void)#endif /* Subcommand: GO */ +#ifdef CONFIG_ARM64 static void boot_jump_linux (struct bootm_headers *images,int flag) { -#ifdef CONFIG_ARM64 void (*kernel_entry)(void *fdt_addr,void *res0,void *res1,void *res2);int fake = (flag &BOOTM_STATE_OS_FAKE_GO );@@ -323,7 +328,13 @@ static void boot_jump_linux(struct bootm_headers *images, int flag) ES_TO_AARCH64);#endif } +}#else +static __maybe_unused bool boot_jump_via_optee; +static __maybe_unused unsigned long boot_jump_via_optee_addr; + +static void boot_jump_linux (struct bootm_headers *images,int flag) +{unsigned long machid = gd->bd->bi_arch_number;char *s;void (*kernel_entry)(int zero,int arch,uint params);@@ -335,6 +346,13 @@ static void boot_jump_linux(struct bootm_headers *images, int flag)ulong addr = (ulong )kernel_entry |1 ; kernel_entry = (void *)addr;#endif + +if (IS_ENABLED (CONFIG_ARMV7_NONSEC ) &&armv7_boot_nonsec () && + boot_jump_via_optee) { +printf ("Cannot start OpTee-OS from NS\n" ); +return ; + } + s =env_get ("machid" );if (s) {if (strict_strtoul (s,16 , &machid) <0 ) {@@ -354,19 +372,39 @@ static void boot_jump_linux(struct bootm_headers *images, int flag) else r2 = gd->bd->bi_boot_params; -if (!fake) { +if (fake) +return ; +#ifdef CONFIG_ARMV7_NONSEC -if (armv7_boot_nonsec ()) { -armv7_init_nonsec (); -secure_ram_addr (_do_nonsec_entry)(kernel_entry, -0 , machid, r2); - } else +if (armv7_boot_nonsec ()) +armv7_init_nonsec ();#endif -kernel_entry (0 , machid, r2); - } + +#ifdef CONFIG_BOOTM_OPTEE +if (boot_jump_via_optee) +boot_jump_linux_via_optee (kernel_entry, machid, r2, boot_jump_via_optee_addr); +#endif + +#ifdef CONFIG_ARMV7_NONSEC +if (armv7_boot_nonsec ()) { +secure_ram_addr (_do_nonsec_entry)(kernel_entry,0 , machid, r2); + } else#endif + { +kernel_entry (0 , machid, r2); + } } +#ifndef CONFIG_TI_SECURE_DEVICE +static void arch_tee_image_process (ulong image,size_t size) +{ + boot_jump_via_optee = true; + boot_jump_via_optee_addr = image; +} +U_BOOT_FIT_LOADABLE_HANDLER (IH_TYPE_TEE , arch_tee_image_process); +#endif +#endif +/* Main Entry point for arm bootm implementation * * Modeled after the powerpc implementation
Quoted 11 lines · Heinrich Schuchardt
Am 30. Juni 2025 02:08:05 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 10 lines
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a. This is only supported if U-Boot runs in PL1 secure. This change adds two components, one is fitImage OpTee-OS loadable handler, which makes a note of OpTee-OS being loaded and stores the load address for later jump to it. The second part is the actual jump to Linux through OpTee-OS. The jump through OpTee-OS requires set up of multiple CPU registers, r1 and r2 are passed through, r0 and r3 have to be set to 0, lr is set to Linux kernel entry point. This setup is done by new assembler function
boot_jump_linux_via_optee().
Quoted 8 lines
Quoted 2 lines
The
boot_jump_linux_via_optee()also includes STM32MP13xx late TZC configuration write, this cannot be moved easily, hence the ifdef.Hello Marek,
Could you, please, add a documentation change to the series. This would allow reviewers to test your proposal.
Furthermore, please, provide tests on QEMU.
Documentation is good, also wiring up this use case for testing in CI via QEMU is a rather large ask. We're still on needing a general boot OS test or two in CI (and Ilias noted either on a call or IRC, I forget now, that there's been some progress on making up a small enough generic OS image to work from).
Signature · 1 line
Tom
Quoted 19 lines · Tom Rini
Quoted 18 lines · Heinrich Schuchardt
Am 30. Juni 2025 02:08:05 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 10 lines
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a. This is only supported if U-Boot runs in PL1 secure. This change adds two components, one is fitImage OpTee-OS loadable handler, which makes a note of OpTee-OS being loaded and stores the load address for later jump to it. The second part is the actual jump to Linux through OpTee-OS. The jump through OpTee-OS requires set up of multiple CPU registers, r1 and r2 are passed through, r0 and r3 have to be set to 0, lr is set to Linux kernel entry point. This setup is done by new assembler function
boot_jump_linux_via_optee().Quoted 2 lines
The
boot_jump_linux_via_optee()also includes STM32MP13xx late TZC configuration write, this cannot be moved easily, hence the ifdef.Hello Marek,
Could you, please, add a documentation change to the series. This would allow reviewers to test your proposal.
Quoted 7 lines
Quoted 1 line
Furthermore, please, provide tests on QEMU.
Documentation is good, also wiring up this use case for testing in CI via QEMU is a rather large ask. We're still on needing a general boot OS test or two in CI (and Ilias noted either on a call or IRC, I forget now, that there's been some progress on making up a small enough generic OS image to work from).
I would really like these two patches to land, it is the remaining piece I need to make STM32MP13xx usable with pure U-Boot. How can we proceed here ?
Quoted 22 lines · Marek Vasut
Quoted 21 lines · Tom Rini
Quoted 19 lines · Heinrich Schuchardt
Am 30. Juni 2025 02:08:05 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 10 lines
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a. This is only supported if U-Boot runs in PL1 secure. This change adds two components, one is fitImage OpTee-OS loadable handler, which makes a note of OpTee-OS being loaded and stores the load address for later jump to it. The second part is the actual jump to Linux through OpTee-OS. The jump through OpTee-OS requires set up of multiple CPU registers, r1 and r2 are passed through, r0 and r3 have to be set to 0, lr is set to Linux kernel entry point. This setup is done by new assembler function
boot_jump_linux_via_optee().Quoted 2 lines
The
boot_jump_linux_via_optee()also includes STM32MP13xx late TZC configuration write, this cannot be moved easily, hence the ifdef.Hello Marek,
Could you, please, add a documentation change to the series. This would allow reviewers to test your proposal.
Furthermore, please, provide tests on QEMU.
Quoted 7 lines
Quoted 5 lines
Documentation is good, also wiring up this use case for testing in CI via QEMU is a rather large ask. We're still on needing a general boot OS test or two in CI (and Ilias noted either on a call or IRC, I forget now, that there's been some progress on making up a small enough generic OS image to work from).
I would really like these two patches to land, it is the remaining piece I need to make STM32MP13xx usable with pure U-Boot. How can we proceed here ?
There was some minor rewording requested, and adding documentation is also good. We can't reasonably add CI testing here at this time, yes?
Signature · 1 line
Tom
Quoted 28 lines · Tom Rini
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Tom Rini
Quoted 11 lines · Heinrich Schuchardt
Am 30. Juni 2025 02:08:05 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 10 lines
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a. This is only supported if U-Boot runs in PL1 secure. This change adds two components, one is fitImage OpTee-OS loadable handler, which makes a note of OpTee-OS being loaded and stores the load address for later jump to it. The second part is the actual jump to Linux through OpTee-OS. The jump through OpTee-OS requires set up of multiple CPU registers, r1 and r2 are passed through, r0 and r3 have to be set to 0, lr is set to Linux kernel entry point. This setup is done by new assembler function
boot_jump_linux_via_optee().Quoted 8 lines
Quoted 2 lines
The
boot_jump_linux_via_optee()also includes STM32MP13xx late TZC configuration write, this cannot be moved easily, hence the ifdef.Hello Marek,
Could you, please, add a documentation change to the series. This would allow reviewers to test your proposal.
Furthermore, please, provide tests on QEMU.
Documentation is good, also wiring up this use case for testing in CI via QEMU is a rather large ask. We're still on needing a general boot OS test or two in CI (and Ilias noted either on a call or IRC, I forget now, that there's been some progress on making up a small enough generic OS image to work from).
Quoted 5 lines
Quoted 2 lines
I would really like these two patches to land, it is the remaining piece I need to make STM32MP13xx usable with pure U-Boot. How can we proceed here ?
There was some minor rewording requested, and adding documentation is also good. We can't reasonably add CI testing here at this time, yes?
I added documentation in V3 now.
As for CI testing, I recall the infrastructure is not there yet.
Quoted 11 lines · Heinrich Schuchardt
Am 30. Juni 2025 02:08:05 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 10 lines
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a. This is only supported if U-Boot runs in PL1 secure. This change adds two components, one is fitImage OpTee-OS loadable handler, which makes a note of OpTee-OS being loaded and stores the load address for later jump to it. The second part is the actual jump to Linux through OpTee-OS. The jump through OpTee-OS requires set up of multiple CPU registers, r1 and r2 are passed through, r0 and r3 have to be set to 0, lr is set to Linux kernel entry point. This setup is done by new assembler function
boot_jump_linux_via_optee().
Quoted 6 lines
Quoted 2 lines
The
boot_jump_linux_via_optee()also includes STM32MP13xx late TZC configuration write, this cannot be moved easily, hence the ifdef.Hello Marek,
Could you, please, add a documentation change to the series. This would allow reviewers to test your proposal.
The fitImage TEE bundling is already documented in the fit spec:
https://fitspec.osfw.foundation/
This here is an application:
"
/dts-v1/;
/ {
...
images {
...
tee-1 {
description = "OP-TEE";
data = /incbin/ ("/optee_os/out/arm-plat-stm32mp1/core/tee-raw.bin") ;
type = "tee";
arch = "arm";
compression = "none";
os = "tee";
load = <0xde000000>;
entry = <0xde000000>;
...
};
};
configurations {
default = "conf-1";
conf-1 {
...
loadables = "tee-1";
...
};
};
};"
"
$ mkimage -E -f fit-image.its fitImage "
I can add that part to STM32 board docs ?
Quoted 1 line
Furthermore, please, provide tests on QEMU.
The test would require booting Linux, how do you propose we test that in CI ?
Quoted 55 lines · Marek Vasut
Quoted 11 lines · Heinrich Schuchardt
Am 30. Juni 2025 02:08:05 MESZ schrieb Marek Vasut <[email protected]>:
Quoted 10 lines
Add support for jumping to Linux kernel through OpTee-OS on ARMv7a. This is only supported if U-Boot runs in PL1 secure. This change adds two components, one is fitImage OpTee-OS loadable handler, which makes a note of OpTee-OS being loaded and stores the load address for later jump to it. The second part is the actual jump to Linux through OpTee-OS. The jump through OpTee-OS requires set up of multiple CPU registers, r1 and r2 are passed through, r0 and r3 have to be set to 0, lr is set to Linux kernel entry point. This setup is done by new assembler function
boot_jump_linux_via_optee().Quoted 6 lines
Quoted 2 lines
The
boot_jump_linux_via_optee()also includes STM32MP13xx late TZC configuration write, this cannot be moved easily, hence the ifdef.Hello Marek,
Could you, please, add a documentation change to the series. This would allow reviewers to test your proposal.
The fitImage TEE bundling is already documented in the fit spec:
https://fitspec.osfw.foundation/
This here is an application:
"
/dts-v1/;/ { ... images { ... tee-1 { description = "OP-TEE"; data = /incbin/ ("/optee_os/out/arm-plat-stm32mp1/core/tee-raw.bin") ; type = "tee"; arch = "arm"; compression = "none"; os = "tee"; load = <0xde000000>; entry = <0xde000000>; ... }; }; configurations { default = "conf-1"; conf-1 { ... loadables = "tee-1"; ... }; }; };"
Quoted 8 lines
"
$ mkimage -E -f fit-image.its fitImage "I can add that part to STM32 board docs ?
Quoted 1 line
Furthermore, please, provide tests on QEMU.
The test would require booting Linux, how do you propose we test that in CI
For this part, it's something we've talked about off-and-on, and part of the answer is caching in the container some set of very small but still useful for boot testing stock images. That said, it's still a lot of effort and a good question as to what is really being tested in each case there (and in turn how worthwhile it is).
Signature · 1 line
Tom