Skip to contentSkip to conversation

board: vexpress_ca9x4: Enable D-cache and MMU

PATCH In review Mark Kettenis 3 participants 4 messages Jul 12, 2025 – Jul 17, 2025 Arm/versatile express platform

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: vexpress_ca9x4: Enable D-cache and MMU

Enable the D-cache, which will also enable the MMU. The latter make sure we don't do unaligned access on Strongly-ordered memory, which has UNPREDICTABLE behaviour according the architecture definition. This fixes using U-Boot with recent versions of QEMU's vexpress-ca9 emulation.

---
 board/armltd/vexpress/vexpress_common.c | 8 ++++++++
 1 file changed, 8 insertions(+)
board/armltd/vexpress/vexpress_common.c +8 -0
index 6c374e25e32..3833af59b09 100644
@@ -165,3 +165,11 @@ void smp_set_core_boot_addr(unsigned long addr, int corenr)
 	writel(addr, CONFIG_SYSFLAGS_ADDR);
 }
 #endif
+
+#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
+void enable_caches(void)
+{
+	/* Enable D-cache. I-cache is already enabled in start.S */
+	dcache_enable();
+}
+#endif
Signature · 1 line
2.49.0
#1 lore raw
Quoted 8 lines · Mark Kettenis

Enable the D-cache, which will also enable the MMU. The latter make sure we don't do unaligned access on Strongly-ordered memory, which has UNPREDICTABLE behaviour according the architecture definition. This fixes using U-Boot with recent versions of QEMU's vexpress-ca9 emulation.

[...]

Applied to u-boot/master, thanks!

[1/1] board: vexpress_ca9x4: Enable D-cache and MMU

      commit: 3b4604a40b9fd61b87e9d059fc56f04d36f1a380
Signature · 1 line
Tom
#2 lore raw

Thanks Mark and Tom!

Just so I understand it correctly, this patch means that after the next u-boot release we can continue to use the vexpress-ca9 emulation as long as we also make sure QEMU is current? If so, do you happen to know which minimum version would apply?

Greetz,
*Josef Holzmayr* (he/him)
Developer Enablement Expert
Mender <https://mender.io/> | GitHub
<https://github.com/theyoctojester> | Mender
Hub <https://hub.mender.io>
<https://www.linkedin.com/company/northern.tech>
<https://twitter.com/northerntechhq> <https://northern.tech> Northern.tech
<https://northern.tech> | Securing the world's connected devices

Quoted 20 lines · Tom Rini
Quoted 8 lines · Mark Kettenis

Enable the D-cache, which will also enable the MMU. The latter make sure we don't do unaligned access on Strongly-ordered memory, which has UNPREDICTABLE behaviour according the architecture definition. This fixes using U-Boot with recent versions of QEMU's vexpress-ca9 emulation.

[...]

Applied to u-boot/master, thanks!

[1/1] board: vexpress_ca9x4: Enable D-cache and MMU

      commit: 3b4604a40b9fd61b87e9d059fc56f04d36f1a380

--
Tom

#3 lore raw
Quoted 6 lines · Josef Holzmayr

Thanks Mark and Tom!

Just so I understand it correctly, this patch means that after the next u-boot release we can continue to use the vexpress-ca9 emulation as long as we also make sure QEMU is current? If so, do you happen to know which minimum version would apply?

The change is backwards compatible, it just fixes relying on undefined behavior that's not allowed now in QEMU.

Signature · 1 line
Tom