[PATCH v2 08/11] ARM: i.MX8M: enable the MMU before the PBL eMMC load

Johannes Schneider johannes.schneider at leica-geosystems.com
Sat Jul 4 05:26:25 PDT 2026


The i.MX8MM/8MP PBL reads the next stage from eMMC with the MMU off, so the
PIO copy and the CPU's writes to DRAM are uncached and slow: on an i.MX8MM
loading the ~1.6 MB next stage took ~713 ms.

Move the imx8m_mmu_early_enable() up to before imx8m{m,p}_load_bl33() so the
copy runs against a warm D-cache. Measured on i.MX8MM: load_bl33 713 ms ->
241 ms. The MMU then stays on for the BL32 verify + BL31/BL32 memcpy that
follow, so this replaces the post-load enable for these two SoCs.

Signed-off-by: Johannes Schneider <johannes.schneider at leica-geosystems.com>
Assisted-by: Claude Opus 4.8 (1M context) <noreply at anthropic.com>
---

Notes:
    v2:
    - New patch. The maintainer-suggested DMA-free speedup: enable the MMU
      before the PBL eMMC load so PIO runs warm-cached, split out so it
      stands on its own (Sascha).

 arch/arm/mach-imx/atf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
index 0f57a204b7..4b6f7ce5e1 100644
--- a/arch/arm/mach-imx/atf.c
+++ b/arch/arm/mach-imx/atf.c
@@ -299,10 +299,10 @@ __noreturn void __imx8mm_load_and_start_image_via_tfa(void *fdt, void *bl33)
 	imx8mm_init_scratch_space();
 	imx8m_save_bootrom_log();
 	imx8m_setup_snvs();
-	imx8mm_load_bl33(bl33);
 
-	/* Cache DRAM for the BL32 verify + BL31/BL32 memcpy that follow. */
+	/* MMU on before the load: PIO runs warm-cached; also serves the verify. */
 	imx8m_mmu_early_enable();
+	imx8mm_load_bl33(bl33);
 
 	if (IS_ENABLED(CONFIG_FIRMWARE_IMX8MM_OPTEE)) {
 		get_builtin_firmware_ext(imx8mm_bl32_bin, bl33, &bl32);
@@ -365,10 +365,10 @@ __noreturn void __imx8mp_load_and_start_image_via_tfa(void *fdt, void *bl33)
 	imx8mp_init_scratch_space();
 	imx8m_save_bootrom_log();
 	imx8m_setup_snvs();
-	imx8mp_load_bl33(bl33);
 
-	/* Cache DRAM for the BL32 verify + BL31/BL32 memcpy that follow. */
+	/* MMU on before the load: PIO runs warm-cached; also serves the verify. */
 	imx8m_mmu_early_enable();
+	imx8mp_load_bl33(bl33);
 
 	if (IS_ENABLED(CONFIG_FIRMWARE_IMX8MP_OPTEE)) {
 		get_builtin_firmware_ext(imx8mp_bl32_bin, bl33, &bl32);
-- 
2.43.0




More information about the barebox mailing list