]> Git Repo - linux.git/commitdiff
riscv: cacheinfo: Add back init_cache_level() function
authorSteffen Persvold <[email protected]>
Sun, 7 Jul 2024 00:35:15 +0000 (02:35 +0200)
committerPalmer Dabbelt <[email protected]>
Mon, 16 Sep 2024 03:15:50 +0000 (20:15 -0700)
commit 5944ce092b97 (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]>
arch/riscv/kernel/cacheinfo.c

index d6c108c50cba92e0eadb1843f71215e3f701fa19..b320b1d9aa01eff8cb41d4971f7f6dc461cce341 100644 (file)
@@ -71,6 +71,11 @@ static void ci_leaf_init(struct cacheinfo *this_leaf,
        this_leaf->type = type;
 }
 
+int init_cache_level(unsigned int cpu)
+{
+       return init_of_cache_level(cpu);
+}
+
 int populate_cache_leaves(unsigned int cpu)
 {
        struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
This page took 0.055215 seconds and 4 git commands to generate.