mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 02:23:16 +00:00
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: 08f051eda3
("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>
This commit is contained in:
parent
4cece76496
commit
58661a30f1
@ -26,7 +26,7 @@
|
|||||||
#include <linux/sched/task_stack.h>
|
#include <linux/sched/task_stack.h>
|
||||||
#include <linux/sched/mm.h>
|
#include <linux/sched/mm.h>
|
||||||
|
|
||||||
#include <asm/cpufeature.h>
|
#include <asm/cacheflush.h>
|
||||||
#include <asm/cpu_ops.h>
|
#include <asm/cpu_ops.h>
|
||||||
#include <asm/irq.h>
|
#include <asm/irq.h>
|
||||||
#include <asm/mmu_context.h>
|
#include <asm/mmu_context.h>
|
||||||
@ -234,9 +234,10 @@ asmlinkage __visible void smp_callin(void)
|
|||||||
riscv_user_isa_enable();
|
riscv_user_isa_enable();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remote TLB flushes are ignored while the CPU is offline, so emit
|
* Remote cache and TLB flushes are ignored while the CPU is offline,
|
||||||
* a local TLB flush right now just in case.
|
* so flush them both right now just in case.
|
||||||
*/
|
*/
|
||||||
|
local_flush_icache_all();
|
||||||
local_flush_tlb_all();
|
local_flush_tlb_all();
|
||||||
complete(&cpu_running);
|
complete(&cpu_running);
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user