[PATCH 6/6] ARM: rockchip: atf: enable MMU in PBL

Sascha Hauer s.hauer at pengutronix.de
Fri Mar 20 01:31:22 PDT 2026


Using compressed binaries for TF-A and OP-TEE comes with the penalty of
additional startup time. Enable the MMU before uncompressing to speed
that up significantly.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/mach-rockchip/atf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c
index 4e1b9f6a21..aa2733bdac 100644
--- a/arch/arm/mach-rockchip/atf.c
+++ b/arch/arm/mach-rockchip/atf.c
@@ -7,6 +7,7 @@
 #include <tee/optee.h>
 #include <asm/atf_common.h>
 #include <asm/barebox-arm.h>
+#include <asm/mmu.h>
 #include <asm-generic/memory_layout.h>
 #include <asm-generic/sections.h>
 #include <mach/rockchip/dmc.h>
@@ -144,7 +145,6 @@ static struct fwobj bl32; /* OP-TEE in barebox image */
 			get_builtin_firmware_compressed(tee_bin, &bl32);	\
 	} while (0)
 
-
 static int rockchip_create_optee_fdt(void *buf, int bufsize)
 {
 	unsigned long base[ROCKCHIP_MAX_DRAM_RESOURCES];
@@ -171,6 +171,8 @@ static void rockchip_atf_load_bl31(void *fdt)
 {
 	unsigned long bl31_ep;
 
+	mmu_early_enable(membase[0], membase[0] + memsize[0]);
+
 	bl31_ep = load_elf64_image_phdr(&bl31);
 
 	if (IS_ENABLED(CONFIG_ARCH_ROCKCHIP_OPTEE))
@@ -181,6 +183,8 @@ static void rockchip_atf_load_bl31(void *fdt)
 			"r" ((ulong)barebox_load_address - 16) :
 			"cc");
 
+	mmu_disable();
+
 	bl31_entry(bl31_ep, optee_load_address,
 		   barebox_load_address, (uintptr_t)fdt);
 }

-- 
2.47.3




More information about the barebox mailing list