Skip to content

Commit b6ea968

Browse files
dramforeverPaul Walmsley
authored andcommitted
riscv: mm: Make mark_new_valid_map() stuff depend on 64BIT && MMU
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>
1 parent a13c140 commit b6ea968

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

arch/riscv/include/asm/cacheflush.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ do { \
4040
flush_icache_mm(vma->vm_mm, 0); \
4141
} while (0)
4242

43-
#ifdef CONFIG_64BIT
43+
#if defined(CONFIG_64BIT) && defined(CONFIG_MMU)
4444
/* This is accessed in assembly code. cpumask_var_t would be too complex. */
4545
extern DECLARE_BITMAP(new_valid_map_cpus, NR_CPUS);
4646
extern char _end[];

arch/riscv/kernel/entry.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ SYM_CODE_START(handle_exception)
137137
.Lrestore_kernel_tpsp:
138138
csrr tp, CSR_SCRATCH
139139

140-
#ifdef CONFIG_64BIT
140+
#if defined(CONFIG_64BIT) && defined(CONFIG_MMU)
141141
/*
142142
* The RISC-V kernel does not flush TLBs on all CPUS after each new
143143
* vmalloc mapping or kfence_unprotect(), which may result in

arch/riscv/mm/init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737

3838
#include "../kernel/head.h"
3939

40+
#if defined(CONFIG_64BIT) && defined(CONFIG_MMU)
4041
DECLARE_BITMAP(new_valid_map_cpus, NR_CPUS);
42+
#endif
4143

4244
struct kernel_mapping kernel_map __ro_after_init;
4345
EXPORT_SYMBOL(kernel_map);

0 commit comments

Comments
 (0)