[PATCH] RISC-V: cacheinfo: add init_cache_level()

Conor Dooley conor at kernel.org
Mon Jan 22 00:09:26 PST 2024


On Mon, Jan 22, 2024 at 09:35:10AM +0800, Yunhui Cui wrote:
> When cacheinfo_sysfs_init() is executed, the general weak function
> init_cache_level() returns -ENOENT, causing failure to add the "cache"
> node to /sys/devices/system/cpu/cpux/. Implement the init_cache_level()
> function on RISC-V to fix it.

If you recall correctly, I asked you to explain how to reproduce this
when you sent the patch.

Thanks,
Conor.

> 
> Signed-off-by: Yunhui Cui <cuiyunhui at bytedance.com>
> ---
>  arch/riscv/kernel/cacheinfo.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/riscv/kernel/cacheinfo.c b/arch/riscv/kernel/cacheinfo.c
> index 09e9b88110d1..be9169a38bac 100644
> --- a/arch/riscv/kernel/cacheinfo.c
> +++ b/arch/riscv/kernel/cacheinfo.c
> @@ -71,6 +71,12 @@ static void ci_leaf_init(struct cacheinfo *this_leaf,
>  	this_leaf->type = type;
>  }
>  
> +int init_cache_level(unsigned int cpu)
> +{
> +	/* The topology has been parsed by acpi or dt, return true. */
> +	return 0;
> +}
> +
>  int populate_cache_leaves(unsigned int cpu)
>  {
>  	struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
> -- 
> 2.20.1
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20240122/7459eb4e/attachment.sig>


More information about the linux-riscv mailing list