riscv: mm: Use the bitmap API for new_valid_map_cpus

The bitmap was defined with incorrect size. Fix it by using the proper
bitmap API in C code. The corresponding assembly code is still okay and
remains unchanged.

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Link: https://patch.msgid.link/20260303-handle-kfence-protect-spurious-fault-v2-4-f80d8354d79d@iscas.ac.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
This commit is contained in:
Vivian Wang 2026-03-03 13:29:48 +08:00 committed by Paul Walmsley
parent a50940adfb
commit 26c171fc48
2 changed files with 4 additions and 6 deletions

View File

@ -41,19 +41,17 @@ do { \
} while (0)
#ifdef CONFIG_64BIT
extern u64 new_valid_map_cpus[NR_CPUS / sizeof(u64) + 1];
/* 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[];
static inline void mark_new_valid_map(void)
{
int i;
/*
* We don't care if concurrently a cpu resets this value since
* the only place this can happen is in handle_exception() where
* an sfence.vma is emitted.
*/
for (i = 0; i < ARRAY_SIZE(new_valid_map_cpus); ++i)
new_valid_map_cpus[i] = -1ULL;
bitmap_fill(new_valid_map_cpus, NR_CPUS);
}
#define flush_cache_vmap flush_cache_vmap
static inline void flush_cache_vmap(unsigned long start, unsigned long end)

View File

@ -37,7 +37,7 @@
#include "../kernel/head.h"
u64 new_valid_map_cpus[NR_CPUS / sizeof(u64) + 1];
DECLARE_BITMAP(new_valid_map_cpus, NR_CPUS);
struct kernel_mapping kernel_map __ro_after_init;
EXPORT_SYMBOL(kernel_map);