linux-stable/arch/sh/include/asm
Alexandre Ghiti 2b89c3f9d3 mm: Introduce flush_cache_vmap_early()
[ Upstream commit 7a92fc8b4d ]

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>
2024-02-16 19:14:25 +01:00
..
adc.h sh: remove __KERNEL__ ifdefs from non-UAPI headers 2020-08-14 22:05:14 -04:00
addrspace.h sh: remove __KERNEL__ ifdefs from non-UAPI headers 2020-08-14 22:05:14 -04:00
alignment.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
asm-offsets.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
atomic-grb.h locking/atomic: sh: add preprocessor symbols 2023-06-05 09:57:16 +02:00
atomic-irq.h locking/atomic: sh: add preprocessor symbols 2023-06-05 09:57:16 +02:00
atomic-llsc.h locking/atomic: sh: add preprocessor symbols 2023-06-05 09:57:16 +02:00
atomic.h locking/atomic: make atomic*_{cmp,}xchg optional 2023-06-05 09:57:14 +02:00
barrier.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
bitops-cas.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bitops-grb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bitops-llsc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bitops-op32.h provide arch_test_bit_acquire for architectures that define test_bit 2022-08-27 09:49:54 -07:00
bitops.h include: move find.h from asm_generic to linux 2022-01-15 08:47:31 -08:00
bl_bit.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
bl_bit_32.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bug.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cache.h sh: move the ARCH_DMA_MINALIGN definition to asm/cache.h 2023-06-19 16:19:24 -07:00
cache_insns.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
cache_insns_32.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cacheflush.h mm: Introduce flush_cache_vmap_early() 2024-02-16 19:14:25 +01:00
checksum.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
checksum_32.h sh: checksum: add missing linux/uaccess.h include 2023-01-30 21:04:21 -08:00
clock.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cmpxchg-cas.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cmpxchg-grb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cmpxchg-irq.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cmpxchg-llsc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cmpxchg-xchg.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
cmpxchg.h locking/atomic: sh: Use generic_cmpxchg_local for arch_cmpxchg_local() 2023-11-02 10:13:12 +01:00
device.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
dma-register.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
dma.h PCI: Move isa_dma_bridge_buggy out of asm/dma.h 2022-07-22 17:24:47 -05:00
dmabrg.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dwarf.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
elf.h sh: remove __KERNEL__ ifdefs from non-UAPI headers 2020-08-14 22:05:14 -04:00
entry-macros.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
extable.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
fb.h arch/sh: Implement <asm/fb.h> with generic helpers 2023-04-20 10:05:08 +02:00
fixmap.h sh/highmem: Remove all traces of unused cruft 2020-11-06 23:14:54 +01:00
flat.h binfmt_flat: remove the persistent argument from flat_get_addr_from_rp 2019-06-24 09:16:47 +10:00
fpu.h kill unused dump_fpu() instances 2020-07-27 14:33:10 -04:00
freq.h sh: remove __KERNEL__ ifdefs from non-UAPI headers 2020-08-14 22:05:14 -04:00
ftrace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
futex-cas.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
futex-irq.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
futex-llsc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
futex.h sh: remove __KERNEL__ ifdefs from non-UAPI headers 2020-08-14 22:05:14 -04:00
hardirq.h sh: irqstat: Use the generic irq_cpustat_t 2020-11-23 10:31:06 +01:00
hd64461.h sh: hd64461: Handle virq offset for offchip IRQ base and HD64461 IRQ 2023-07-13 08:37:53 +02:00
heartbeat.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hugetlb.h mm: change huge_ptep_clear_flush() to return the original pte 2022-05-13 16:48:55 -07:00
hw_breakpoint.h perf/hw_breakpoint: Optimize constant number of breakpoint slots 2022-08-30 10:56:22 +02:00
hw_irq.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
i2c-sh7760.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
io.h sh: machvec: Remove custom ioport_{un,}map() 2023-10-25 16:50:30 +02:00
io_generic.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
io_noioport.h sh: add <asm-generic/io.h> including 2023-08-18 10:12:34 -07:00
io_trapped.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
irq.h init: consolidate prototypes in linux/init.h 2023-06-09 17:44:16 -07:00
irqflags.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kbuild local64.h: make <asm/local64.h> mandatory 2020-12-29 15:36:49 -08:00
kdebug.h Revert "sh: add loglvl to printk_address()" 2020-08-14 22:05:07 -04:00
kexec.h sh, kexec: fix the incorrect ifdeffery and dependency of CONFIG_KEXEC 2023-12-12 17:20:18 -08:00
kgdb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kprobes.h kprobes: unify kprobes_exceptions_nofify() prototypes 2023-11-10 19:59:05 +09:00
linkage.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
machvec.h sh: machvec: Remove custom ioport_{un,}map() 2023-10-25 16:50:30 +02:00
mmiowb.h sh/mmiowb: Add unconditional mmiowb() to arch_spin_unlock() 2019-04-08 12:00:21 +01:00
mmu.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mmu_context.h sh: use asm-generic/mmu_context.h for no-op implementations 2020-10-27 16:02:38 +01:00
mmu_context_32.h sh: use asm-generic/mmu_context.h for no-op implementations 2020-10-27 16:02:38 +01:00
mmzone.h mm: replace CONFIG_NEED_MULTIPLE_NODES with CONFIG_NUMA 2021-06-29 10:53:55 -07:00
module.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
page.h sh: move the ARCH_DMA_MINALIGN definition to asm/cache.h 2023-06-19 16:19:24 -07:00
pci.h PCI: Remove pci_get_legacy_ide_irq() and asm-generic/pci.h 2022-07-22 17:23:45 -05:00
perf_event.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pgalloc.h sh: convert pte_free_tlb() to use ptdescs 2023-08-21 13:37:57 -07:00
pgtable-2level.h sh: add support for folded p4d page tables 2020-06-04 19:06:21 -07:00
pgtable-3level.h sh/mm: Fix pmd_t for real 2023-01-10 05:31:42 -06:00
pgtable.h sh: implement the new page table range API 2023-08-24 16:20:23 -07:00
pgtable_32.h Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
platform_early.h sh: add the sh_ prefix to early platform symbols 2019-10-07 13:50:48 +02:00
posix_types.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
processor.h sh/cpu: Switch to arch_cpu_finalize_init() 2023-06-16 10:16:00 +02:00
processor_32.h sh: sanitize the flags on sigreturn 2023-03-09 10:01:59 -08:00
ptrace.h sh: don't use asm-generic/ptrace.h 2019-07-01 17:51:40 +02:00
ptrace_32.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
push-switch.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
reboot.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
romimage-macros.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rtc.h init: consolidate prototypes in linux/init.h 2023-06-09 17:44:16 -07:00
seccomp.h sh: Enable seccomp architecture tracking 2020-11-20 11:16:35 -08:00
sections.h sh: machvec: Use char[] for section boundaries 2022-09-13 10:33:17 -07:00
setup.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sfp-machine.h sh: define __BIG_ENDIAN for math-emu 2021-10-27 16:51:24 -04:00
sh7760fb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sh_bios.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
shmparam.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
siu.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
smc37c93x.h arch: sh: smc37c93x: fix spelling mistake 2020-08-14 22:05:05 -04:00
smp-ops.h sh/cpu: Mark play_dead() __noreturn 2023-03-08 08:44:24 -08:00
smp.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
sparsemem.h Cleanup, SECCOMP_FILTER support, message printing fixes, and other 2020-08-15 18:50:32 -07:00
spi.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
spinlock-cas.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
spinlock-llsc.h sh/mmiowb: Add unconditional mmiowb() to arch_spin_unlock() 2019-04-08 12:00:21 +01:00
spinlock.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
spinlock_types.h locking: Allow to include asm/spinlock_types.h from linux/spinlock_types_raw.h 2021-12-07 15:14:12 +01:00
sram.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stackprotector.h stackprotector: actually use get_random_canary() 2022-11-18 02:18:10 +01:00
stacktrace.h sh: stacktrace: Remove stacktrace_ops.stack() 2020-08-14 22:05:11 -04:00
string.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
string_32.h Cleanup, SECCOMP_FILTER support, message printing fixes, and other 2020-08-15 18:50:32 -07:00
suspend.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
switch_to.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
switch_to_32.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
syscall.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
syscall_32.h arch: remove unused function syscall_set_arguments() 2021-09-14 16:06:20 +02:00
syscalls.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
syscalls_32.h sh: remove __KERNEL__ ifdefs from non-UAPI headers 2020-08-14 22:05:14 -04:00
thread_info.h thread_info: move function declarations to linux/thread_info.h 2023-06-09 17:44:16 -07:00
timex.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tlb.h arch/sh/include/asm/tlb.h: remove duplicate include 2021-04-30 11:20:35 -07:00
tlbflush.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
topology.h arch/sh/include/asm/topology.h: remove unused parent_node() macro 2017-11-17 16:10:04 -08:00
traps.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
traps_32.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
types.h sh: Replace <uapi/asm/types.h> by <asm-generic/int-ll64.h> 2023-04-25 09:16:51 +02:00
uaccess.h sh: remove CONFIG_SET_FS support 2022-02-25 09:36:06 +01:00
uaccess_32.h sh: Implement __get_user_u64() required for 64-bit get_user() 2020-08-14 22:05:04 -04:00
uncached.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
unistd.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
unwinder.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
user.h asm/user.h: killed unused macros 2022-01-30 21:17:00 -05:00
vermagic.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
vga.h sh: include: convert to SPDX identifiers 2018-12-28 12:11:45 -08:00
vmalloc.h mm/vmalloc: Add empty <asm/vmalloc.h> headers and use them from <linux/vmalloc.h> 2019-12-10 10:12:55 +01:00
vmlinux.lds.h sh: remove sh5 support 2020-06-01 14:48:52 -04:00
watchdog.h sh: remove __KERNEL__ ifdefs from non-UAPI headers 2020-08-14 22:05:14 -04:00
word-at-a-time.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00