Skip to content

fix: latent cache coherency issues in relocation and cache flush - #392

Open
josecm wants to merge 2 commits into
mainfrom
fix/relocation-cache-coherency
Open

fix: latent cache coherency issues in relocation and cache flush#392
josecm wants to merge 2 commits into
mainfrom
fix/relocation-cache-coherency

Conversation

@josecm

@josecm josecm commented Aug 7, 2026

Copy link
Copy Markdown
Member

cache_flush_range() on armv8 ended with a dmb, which does not guarantee completion of the cache maintenance operations, while its callers rely on it: the relocation flow before other cores fetch the relocated image, the guest image flush, and the psci off state flush before a core powers down. Replace it with a dsb.

The riscv switch_space() never executed fence.i, so instruction fetch is not synchronized with the data-side copy of the relocated image, the same problem #391 fixes for aarch64. Execute it just before the satp write, while still fetching from the original pages. This requires enabling zifencei in the march string.

Both qemu-aarch64-virt and qemu-riscv64-virt builds pass.

Comment thread src/arch/armv8/cache.c Outdated
@josecm
josecm force-pushed the fix/relocation-cache-coherency branch from 482ae50 to b2454bf Compare August 7, 2026 09:48
josecm added 2 commits August 7, 2026 10:50
Signed-off-by: Jose Martins <josemartins90@gmail.com>
Signed-off-by: Jose Martins <josemartins90@gmail.com>
@josecm
josecm force-pushed the fix/relocation-cache-coherency branch from b2454bf to 1dc70f4 Compare August 7, 2026 09:50
@DavidMCerdeira
DavidMCerdeira self-requested a review August 28, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants