riscv: Flush the instruction cache during SMP bringup
authorSamuel Holland <samuel.holland@sifive.com>
Wed, 27 Mar 2024 04:49:42 +0000 (21:49 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Mon, 29 Apr 2024 17:49:24 +0000 (10:49 -0700)
commit58661a30f1bcc748475ffd9be6d2fc9e4e6be679
tree4e5e301e9874bf6482436c023c729bf46a4dcbe2
parent4cece764965020c22cff7665b18a012006359095
riscv: Flush the instruction cache during SMP bringup

Instruction cache flush IPIs are sent only to CPUs in cpu_online_mask,
so they will not target a CPU until it calls set_cpu_online() earlier in
smp_callin(). As a result, if instruction memory is modified between the
CPU coming out of reset and that point, then its instruction cache may
contain stale data. Therefore, the instruction cache must be flushed
after the set_cpu_online() synchronization point.

Fixes: 08f051eda33b ("RISC-V: Flush I$ when making a dirty page executable")
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://lore.kernel.org/r/20240327045035.368512-2-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/smpboot.c