Skip to content

Commit 1845d38

Browse files
spersvoldpalmer-dabbelt
authored andcommitted
riscv: cacheinfo: Add back init_cache_level() function
commit 5944ce0 (arch_topology: Build cacheinfo from primary CPU) removed the init_cache_level() function from arch/riscv/kernel/cacheinfo.c and relies on the init_cpu_topology() function in drivers/base/arch_topology.c to call fetch_cache_info() which in turn calls init_of_cache_level() to populate the cache hierarchy information. However, init_cpu_topology() is only called from smpboot.c:smp_prepare_cpus() and thus only available when CONFIG_SMP is defined. To support non-SMP enabled kernels to still detect cache hierarchy, we add back the init_cache_level() function. The init_level_allocate_ci() function handles this gracefully on SMP-enabled kernels anyway where fetch_cache_info() is called from init_cpu_topology() earlier in the boot phase. Signed-off-by: Steffen Persvold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent cea9d27 commit 1845d38

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/riscv/kernel/cacheinfo.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ static void ci_leaf_init(struct cacheinfo *this_leaf,
7171
this_leaf->type = type;
7272
}
7373

74+
int init_cache_level(unsigned int cpu)
75+
{
76+
return init_of_cache_level(cpu);
77+
}
78+
7479
int populate_cache_leaves(unsigned int cpu)
7580
{
7681
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);

0 commit comments

Comments
 (0)