From 949eb228f3f807feb338d29e9c94d97c22fa98b6 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Wed, 20 Oct 2021 15:12:06 +0300 Subject: arm: spl: prepare for jumping to OPTEE Make sure to (if applicable) flush the D-cache, invalidate I-cache, and disable MMU and caches before jumping to OPTEE. This fixes the SDP->SPL->OPTEE boot flow on iMX6Q and most likely on some other ARM SoCs. Signed-off-by: Ricardo Salveti Co-developed-by: Oleksandr Suvorov Signed-off-by: Oleksandr Suvorov --- arch/arm/lib/spl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'arch') diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c index 8e2bdf3..4f9b84b 100644 --- a/arch/arm/lib/spl.c +++ b/arch/arm/lib/spl.c @@ -77,3 +77,14 @@ void __noreturn jump_to_image_linux(struct spl_image_info *spl_image) } #endif /* CONFIG_ARM64 */ #endif + +#if CONFIG_IS_ENABLED(OPTEE_IMAGE) +void __noreturn jump_to_image_optee(struct spl_image_info *spl_image) +{ + /* flush and turn off caches before jumping to OPTEE */ + cleanup_before_linux(); + + spl_optee_entry(NULL, NULL, spl_image->fdt_addr, + (void *)spl_image->entry_point); +} +#endif -- cgit v1.1