diff mbox series

riscv: cacheinfo: Add back init_cache_level() function

Message ID 20240707003515.5058-1-spersvold@gmail.com (mailing list archive)
State Accepted
Commit 1845d381f28063a3b68e9e148d5a7f01d6be8721
Headers show
Series riscv: cacheinfo: Add back init_cache_level() function | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-1-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh
conchuod/patch-1-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh
conchuod/patch-1-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh
conchuod/patch-1-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-1-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-1-test-6 success .github/scripts/patches/tests/checkpatch.sh
conchuod/patch-1-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh
conchuod/patch-1-test-8 success .github/scripts/patches/tests/header_inline.sh
conchuod/patch-1-test-9 success .github/scripts/patches/tests/kdoc.sh
conchuod/patch-1-test-10 success .github/scripts/patches/tests/module_param.sh
conchuod/patch-1-test-11 success .github/scripts/patches/tests/verify_fixes.sh
conchuod/patch-1-test-12 success .github/scripts/patches/tests/verify_signedoff.sh

Commit Message

Steffen Persvold July 7, 2024, 12:35 a.m. UTC
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 <spersvold@gmail.com>
---
 arch/riscv/kernel/cacheinfo.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

patchwork-bot+linux-riscv@kernel.org Sept. 17, 2024, 1 p.m. UTC | #1
Hello:

This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Sun,  7 Jul 2024 02:35:15 +0200 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - riscv: cacheinfo: Add back init_cache_level() function
    https://git.kernel.org/riscv/c/1845d381f280

You are awesome, thank you!
diff mbox series

Patch

diff --git a/arch/riscv/kernel/cacheinfo.c b/arch/riscv/kernel/cacheinfo.c
index 09e9b881..42c22f83 100644
--- a/arch/riscv/kernel/cacheinfo.c
+++ b/arch/riscv/kernel/cacheinfo.c
@@ -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);