mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Johannes Schneider <johannes.schneider@leica-geosystems.com>
To: barebox@lists.infradead.org
Cc: Johannes Schneider <johannes.schneider@leica-geosystems.com>,
	"Claude Opus 4 . 8" <noreply@anthropic.com>
Subject: [PATCH v2 08/11] ARM: i.MX8M: enable the MMU before the PBL eMMC load
Date: Sat,  4 Jul 2026 12:26:25 +0000	[thread overview]
Message-ID: <20260704122628.3326142-9-johannes.schneider@leica-geosystems.com> (raw)
In-Reply-To: <20260704122628.3326142-1-johannes.schneider@leica-geosystems.com>

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@leica-geosystems.com>
Assisted-by: Claude Opus 4.8 (1M context) <noreply@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




  parent reply	other threads:[~2026-07-04 12:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 12:26 [PATCH v2 00/11] i.MX8M: speed up the PBL boot path (MMU, SHA-256, eMMC) Johannes Schneider
2026-07-04 12:26 ` [PATCH v2 01/11] ARM: i.MX8M: enable MMU in PBL around fw-external BL32 verify Johannes Schneider
2026-07-04 12:26 ` [PATCH v2 02/11] crypto: sha256: PBL SHA-256 fast path via pbl/sha256.c Johannes Schneider
2026-07-04 12:26 ` [PATCH v2 03/11] mci: sdhci: bail out on ADMA/transfer errors instead of hanging Johannes Schneider
2026-07-04 12:26 ` [PATCH v2 04/11] mci: sdhci: honor BROKEN_ADMA_ZEROLEN_DESC / NO_ENDATTR_IN_NOPDESC quirks Johannes Schneider
2026-07-04 12:26 ` [PATCH v2 05/11] mci: imx-esdhc: mark the uSDHC ADMA2 descriptor quirks Johannes Schneider
2026-07-04 12:26 ` [PATCH v2 06/11] mci: imx-esdhc: support HS400 and HS400ES on i.MX8M Johannes Schneider
2026-07-04 12:26 ` [PATCH v2 07/11] mci: imx-esdhc: make the transfer mode selectable (PIO/SDMA/ADMA2) Johannes Schneider
2026-07-04 12:26 ` Johannes Schneider [this message]
2026-07-04 12:26 ` [PATCH v2 09/11] dma: provide the streaming DMA API in the PBL (opt-in via PBL_HAS_DMA) Johannes Schneider
2026-07-04 12:26 ` [PATCH v2 10/11] mci: sdhci: honour dma_map/dma_sync in the PBL Johannes Schneider
2026-07-04 12:26 ` [PATCH v2 11/11] mci: imx-esdhc: DMA in the i.MX8M PBL eMMC loader Johannes Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260704122628.3326142-9-johannes.schneider@leica-geosystems.com \
    --to=johannes.schneider@leica-geosystems.com \
    --cc=barebox@lists.infradead.org \
    --cc=noreply@anthropic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox