* On big-core systems, each core has two groups of CPUs each of which
  * has its own L1-cache. The thread-siblings which share l1-cache with
  * @cpu can be obtained via cpu_smallcore_mask().
+ *
+ * On some big-core systems, the L2 cache is shared only between some
+ * groups of siblings. This is already parsed and encoded in
+ * cpu_l2_cache_mask().
+ *
+ * TODO: cache_lookup_or_instantiate() needs to be made aware of the
+ *       "ibm,thread-groups" property so that cache->shared_cpu_map
+ *       reflects the correct siblings on platforms that have this
+ *       device-tree property. This helper function is only a stop-gap
+ *       solution so that we report the correct siblings to the
+ *       userspace via sysfs.
  */
-static const struct cpumask *get_big_core_shared_cpu_map(int cpu, struct cache *cache)
+static const struct cpumask *get_shared_cpu_map(struct cache_index_dir *index, struct cache *cache)
 {
-       if (cache->level == 1)
-               return cpu_smallcore_mask(cpu);
+       if (has_big_cores) {
+               int cpu = index_dir_to_cpu(index);
+               if (cache->level == 1)
+                       return cpu_smallcore_mask(cpu);
+               if (cache->level == 2 && thread_group_shares_l2)
+                       return cpu_l2_cache_mask(cpu);
+       }
 
        return &cache->shared_cpu_map;
 }
        struct cache_index_dir *index;
        struct cache *cache;
        const struct cpumask *mask;
-       int cpu;
 
        index = kobj_to_cache_index_dir(k);
        cache = index->cache;
 
-       if (has_big_cores) {
-               cpu = index_dir_to_cpu(index);
-               mask = get_big_core_shared_cpu_map(cpu, cache);
-       } else {
-               mask  = &cache->shared_cpu_map;
-       }
+       mask = get_shared_cpu_map(index, cache);
 
        return cpumap_print_to_pagebuf(list, buf, mask);
 }