* Shrikanth Hegde <[email protected]> [2026-11-18 22:06:38]:

> PowerPC maintains an architecture-specific implementation of the CPU
> cache sysfs interface. Replace it with the generic cacheinfo
> infrastructure.
> 
> On a dedicated Power11 LPAR, the generic implementation preserves the
> existing L1 data, L1 instruction, L2 and L3 sizes, associativity, set
> counts and shared CPU maps. The two SMT4 groups continue to appear as
> separate cache instances.
> 
> [Both draft changelog and code are written by LLM]
> Assisted-by: LLM
> Signed-off-by: Shrikanth Hegde <[email protected]>
> ---
> -
> -static void do_subsidiary_caches_debugcheck(struct cache *cache)
> +int cacheinfo_get_arch_id(unsigned int cpu, unsigned int level,
> +                       unsigned int *id)
>  {
> -     WARN_ONCE(cache->level != 1,
> -               "instantiating cache chain from L%d %s cache for "
> -               "%pOFP instead of an L1\n", cache->level,
> -               cache_type_string(cache), cache->ofnode);
> -     WARN_ONCE(!of_node_is_type(cache->ofnode, "cpu"),
> -               "instantiating cache chain from node %pOFP of type '%s' "
> -               "instead of a cpu node\n", cache->ofnode,
> -               of_node_get_device_type(cache->ofnode));
> -}
> +     const struct cpumask *mask = NULL;
>  
> -/*
> - * If sub-groups of threads in a core containing @cpu_id share the
> - * L@level-cache (information obtained via "ibm,thread-groups"
> - * device-tree property), then we identify the group by the first
> - * thread-sibling in the group. We define this to be the group-id.
> - *
> - * In the absence of any thread-group information for L@level-cache,
> - * this function returns -1.
> - */
> -static int get_group_id(unsigned int cpu_id, int level)
> -{
>       if (has_big_cores && level == 1)
> -             return cpumask_first(per_cpu(thread_group_l1_cache_map,
> -                                          cpu_id));
> +             mask = per_cpu(thread_group_l1_cache_map, cpu);
>       else if (thread_group_shares_l2 && level == 2)
> -             return cpumask_first(per_cpu(thread_group_l2_cache_map,
> -                                          cpu_id));
> +             mask = per_cpu(thread_group_l2_cache_map, cpu);
>       else if (thread_group_shares_l3 && level == 3)
> -             return cpumask_first(per_cpu(thread_group_l3_cache_map,
> -                                          cpu_id));
> -     return -1;
> -}
> -
> -static void do_subsidiary_caches(struct cache *cache, unsigned int cpu_id)
> -{
> -     struct device_node *subcache_node;
> -     int level = cache->level;
> +             mask = per_cpu(thread_group_l3_cache_map, cpu);
>  
> -     do_subsidiary_caches_debugcheck(cache);
> +     if (!mask || cpumask_empty(mask))
> +             return -ENOENT;

So if we are here, then we are saying, the generic way of figuring out the
cache-id should work. Guess, we should come here for P7/P8 systems.
Have we tried with a P8 system to see if things work as expected?

-- 
Thanks and Regards
Srikar Dronamraju

Reply via email to