mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-27 04:22:58 +00:00
mm: Introduce flush_cache_vmap_early()
[ Upstream commit7a92fc8b4d] The pcpu setup when using the page allocator sets up a new vmalloc mapping very early in the boot process, so early that it cannot use the flush_cache_vmap() function which may depend on structures not yet initialized (for example in riscv, we currently send an IPI to flush other cpus TLB). But on some architectures, we must call flush_cache_vmap(): for example, in riscv, some uarchs can cache invalid TLB entries so we need to flush the new established mapping to avoid taking an exception. So fix this by introducing a new function flush_cache_vmap_early() which is called right after setting the new page table entry and before accessing this new mapping. This new function implements a local flush tlb on riscv and is no-op for other architectures (same as today). Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Dennis Zhou <dennis@kernel.org> Stable-dep-of:d9807d60c1("riscv: mm: execute local TLB flush after populating vmemmap") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
686820fe14
commit
2b89c3f9d3
@@ -3333,13 +3333,7 @@ int __init pcpu_page_first_chunk(size_t reserved_size, pcpu_fc_cpu_to_node_fn_t
|
||||
if (rc < 0)
|
||||
panic("failed to map percpu area, err=%d\n", rc);
|
||||
|
||||
/*
|
||||
* FIXME: Archs with virtual cache should flush local
|
||||
* cache for the linear mapping here - something
|
||||
* equivalent to flush_cache_vmap() on the local cpu.
|
||||
* flush_cache_vmap() can't be used as most supporting
|
||||
* data structures are not set up yet.
|
||||
*/
|
||||
flush_cache_vmap_early(unit_addr, unit_addr + ai->unit_size);
|
||||
|
||||
/* copy static data */
|
||||
memcpy((void *)unit_addr, __per_cpu_load, ai->static_size);
|
||||
|
||||
Reference in New Issue
Block a user