Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: mm: c-r4k: Flush scache to avoid cache aliases

There is a chance for the secondary cache to have memory
aliases. This can happen if the bootloader is in a non-EVA mode
(or even in EVA mode but with different mapping from the kernel)
and the kernel switching to EVA afterwards. It's best to flush
the icache to avoid having the secondary CPUs fetching stale
data from it.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

authored by

Leonid Yegoshin and committed by
Ralf Baechle
4676f935 80ca69f4

+11
+11
arch/mips/mm/c-r4k.c
··· 640 640 break; 641 641 } 642 642 } 643 + #ifdef CONFIG_EVA 644 + /* 645 + * Due to all possible segment mappings, there might cache aliases 646 + * caused by the bootloader being in non-EVA mode, and the CPU switching 647 + * to EVA during early kernel init. It's best to flush the scache 648 + * to avoid having secondary cores fetching stale data and lead to 649 + * kernel crashes. 650 + */ 651 + bc_wback_inv(start, (end - start)); 652 + __sync(); 653 + #endif 643 654 } 644 655 645 656 static inline void local_r4k_flush_icache_range_ipi(void *args)