zephyr/arch
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nicolas Pitre 5e05d4fc4d arch: arm64: drop stale cache lines over RAM before using it
Everything the primary core writes before the MMU is enabled bypasses
the data cache: the saved firmware arguments, the boot stack, .data,
.bss and then the translation tables built by z_arm64_mm_init().  Lines
a previous boot stage left over that RAM are untouched by those writes.
A clean one is read back in place of what was written once
enable_mmu_el1() turns on the MMU and data cache, and a dirty one can be
written back over it at any point before then.  Either way the first
table walk or data access after the MMU enable may see garbage, which
shows up as a random crash right at that point.

Commit 6c6f1a5e99 ("arch: arm64: mmu: revert useless cache handling")
removed the invalidation setup_page_tables() used to do over these
ranges along with the per-mapping one, leaving nothing to cover this.

Invalidate the image RAM by VA in reset.S as soon as the primary core is
known, before the firmware arguments and the boot stack are written.
DC IVAC reaches caches beyond the cluster, which set/way operations do
not, and invalidating rather than cleaning avoids writing the stale
lines back.  The boot vote before that point only writes
arm64_cpu_boot_params in .data, which the loader must already have left
clean, so lines over it can only be clean and are dropped as well.
Secondary cores must not do this: they start while the primary core
runs with its data cache on.

This does not depend on CONFIG_DCACHE: the data cache is enabled along
with the MMU either way.

Reproduced on fvp_corstone1000/a320 with cache state modelling enabled
and code standing in for a previous boot stage that leaves dirty lines
over .bss before jumping to Zephyr: the boot hangs without this change
and completes with it.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-10-09 17:01:06 +02:00
..
arc arch, drivers: fix mismatched IRQ lock pairs 2026-10-06 07:23:42 +02:00
arm arch: {arm, common, sparc, x86, xtensa}: fix typo 2026-10-06 22:39:13 +02:00
arm64 arch: arm64: drop stale cache lines over RAM before using it 2026-10-09 17:01:06 +02:00
common arch: {arm, common, sparc, x86, xtensa}: fix typo 2026-10-06 22:39:13 +02:00
hexagon arch: hexagon: support building without generated SW ISR table 2026-09-26 08:40:33 +02:00
mips arch: mips: support building without generated SW ISR table 2026-09-26 08:40:33 +02:00
openrisc arch: openrisc: support building without generated SW ISR table 2026-09-26 08:40:33 +02:00
posix arch/posix: Export native target architecture as cache variable 2026-09-23 19:20:33 +02:00
riscv arch: riscv: no_multithreading: CPU idle after return from main 2026-10-08 15:05:21 +02:00
rx arch: rx: Add new RXv3e core support for RX74 devices 2026-09-28 19:40:02 -04:00
sparc arch: {arm, common, sparc, x86, xtensa}: fix typo 2026-10-06 22:39:13 +02:00
tricore arch: tricore: lock interrupts across self-abort 2026-09-25 11:33:25 -05:00
x86 arch: {arm, common, sparc, x86, xtensa}: fix typo 2026-10-06 22:39:13 +02:00
xtensa arch: {arm, common, sparc, x86, xtensa}: fix typo 2026-10-06 22:39:13 +02:00
archs.yml arch: add TriCore architecture support 2026-09-18 11:13:16 +01:00
CMakeLists.txt cmake: enable -Wshadow partially for in-tree code 2023-08-22 11:39:58 +02:00
hardening.yaml scripts: kconfig: hardenconfig: switch to YAML hardening database 2026-09-29 10:40:32 +02:00
Kconfig arch: Kconfig: fix typo 2026-10-06 22:39:13 +02:00