]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
riscv: mm: Make mark_new_valid_map() stuff depend on 64BIT && MMU
authorVivian Wang <wangruikang@iscas.ac.cn>
Mon, 13 Jul 2026 17:29:52 +0000 (11:29 -0600)
committerPaul Walmsley <pjw@kernel.org>
Mon, 13 Jul 2026 17:29:52 +0000 (11:29 -0600)
None of the code relating to mark_new_valid_map() does anything useful
without CONFIG_64BIT=y && CONFIG_MMU=y, because the
new_valid_map_cpus_check code is only used if CONFIG_64BIT, and the
exception codes checked there can only happen with CONFIG_MMU=y.

Therefore, make these conditional on CONFIG_64BIT=y && CONFIG_MMU=y to
simplify programming, since we do not have to handle CONFIG_MMU=n when
changing this code in the future. This also removes some unused code on
the entry path for CONFIG_MMU=n.

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Link: https://patch.msgid.link/20260713-mark-after-vmemmap-populate-v6-1-b945ceba29d4@iscas.ac.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/include/asm/cacheflush.h
arch/riscv/kernel/entry.S
arch/riscv/mm/init.c

index 8cfe59483a8f28c29b35e54fa2584e6bfb58760f..58e787fad029fd646e544a93b664202363fa87c5 100644 (file)
@@ -40,7 +40,7 @@ do {                                                  \
                flush_icache_mm(vma->vm_mm, 0);         \
 } while (0)
 
-#ifdef CONFIG_64BIT
+#if defined(CONFIG_64BIT) && defined(CONFIG_MMU)
 /* This is accessed in assembly code. cpumask_var_t would be too complex. */
 extern DECLARE_BITMAP(new_valid_map_cpus, NR_CPUS);
 extern char _end[];
index 08df724e13b9dbcfb5f429fe07515039fc2e5900..d799c4e56f8049a0c695d913f8bf021a64440bad 100644 (file)
@@ -137,7 +137,7 @@ SYM_CODE_START(handle_exception)
 .Lrestore_kernel_tpsp:
        csrr tp, CSR_SCRATCH
 
-#ifdef CONFIG_64BIT
+#if defined(CONFIG_64BIT) && defined(CONFIG_MMU)
        /*
         * The RISC-V kernel does not flush TLBs on all CPUS after each new
         * vmalloc mapping or kfence_unprotect(), which may result in
index 5b1b3c88b4d130f893e110ef76676a845bf76f5f..3e450890be07e42831ffa24254466352bb0a08b6 100644 (file)
@@ -37,7 +37,9 @@
 
 #include "../kernel/head.h"
 
+#if defined(CONFIG_64BIT) && defined(CONFIG_MMU)
 DECLARE_BITMAP(new_valid_map_cpus, NR_CPUS);
+#endif
 
 struct kernel_mapping kernel_map __ro_after_init;
 EXPORT_SYMBOL(kernel_map);