In the Linux kernel source arch/arm64/kernel/head.S the boot requirements state it is necessary for the bootloader to enter with the D-cache off:
/* * Kernel startup entry point. * --------------------------- * * The requirements are: * MMU = off, D-cache = off, I-cache = on or off, * x0 = physical address to the FDT blob. ... */
Then, in the preserve_boot_args()
function, there is a call to invalidate an area of the D-cache after loading arguments into the boot_args
array
SYM_CODE_START_LOCAL(preserve_boot_args) mov x21, x0 // x21=FDT adr_l x0, boot_args // record the contents of stp x21, x1, [x0] // x0 .. x3 at kernel entry stp x2, x3, [x0, #16] dmb sy // needed before dc ivac with // MMU off mov x1, #0x20 // 4 x 8 bytes b __inval_dcache_area // tail callSYM_CODE_END(preserve_boot_args)
Why does the D-cache line need to be invalidated if the D-cache is off?