u-boot/arch/arm/lib/bootm-optee.S
Marek Vasut 20861863eb 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.

Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
2025-11-06 11:26:18 -06:00

31 lines
677 B
ArmAsm

/* 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)