* Srikar Dronamraju <sri...@linux.vnet.ibm.com> [2020-07-14 10:06:13]:
> > On Power 9 (with device-tree enablement to show coregroups). > ----------------------------------------------------------- With help of Gautham, I tried to kexec into a newer kernel with a modified dtb. However when passing with the dtb option, kexec would get stuck. Hence alternatively, I hardcoded some assumptions to test the same. These hunks apply on top of all the patches. diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 8ec7ff05ae47..762aa573c313 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -56,6 +56,12 @@ static int n_mem_addr_cells, n_mem_size_cells; static int form1_affinity; #define MAX_DISTANCE_REF_POINTS 4 +/* + * HAck2: On Power9, there are 12 SMT8 cores per chip. + * Hard code this for now. + */ +#define CORES_PER_CHIP 12 +#define CORES_PER_COREGROUP (CORES_PER_CHIP / 2) static int distance_ref_points_depth; static const __be32 *distance_ref_points; static int distance_lookup_table[MAX_NUMNODES][MAX_DISTANCE_REF_POINTS]; @@ -326,6 +332,13 @@ static int __init find_min_common_depth(void) if (form1_affinity) { depth = of_read_number(distance_ref_points, 1); + /* + * Hack: Hack: Hack: + * For now only on Phyp machines. + */ + if (!firmware_has_feature(FW_FEATURE_OPAL)) + depth--; } else { if (distance_ref_points_depth < 2) { printk(KERN_WARNING "NUMA: " @@ -1247,8 +1260,8 @@ int cpu_to_coregroup_id(int cpu) goto out; index = of_read_number(associativity, 1); - if ((index > min_common_depth + 1) && coregroup_enabled) - return of_read_number(&associativity[index - 1], 1); + if ((index > min_common_depth + 1) && coregroup_enabled && has_big_cores) + return of_read_number(&associativity[index], 1) / CORES_PER_COREGROUP; out: return cpu_to_core_id(cpu); -- Thanks and Regards Srikar Dronamraju