* [PATCH v3 1/3] powerpc/numa: Simplify find_primary_domain_index
[not found] <20260902123458.340456-5-srikar@linux.ibm.com>
@ 2026-09-02 12:35 ` Srikar Dronamraju
2026-09-04 10:05 ` Shrikanth Hegde
2026-09-02 12:35 ` [PATCH v3 2/3] powerpc/numa: Allow cpu_to_coregroup_id without PPC_SPLPAR Srikar Dronamraju
2026-09-02 12:35 ` [PATCH v3 3/3] powerpc/numa: Support coregroup on PowerNV Srikar Dronamraju
2 siblings, 1 reply; 8+ messages in thread
From: Srikar Dronamraju @ 2026-09-02 12:35 UTC (permalink / raw)
To: linuxppc-dev, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP)
Cc: skiboot, arbab, mahesh, Srikar Dronamraju, Ritesh Harjani,
Mike Rapoport (Microsoft),
Andrew Morton, linux-kernel
Initialize the return value once and use a single exit path in
find_primary_domain_index().
This is a small cleanup that keeps the existing behavior unchanged while
making the control flow easier to follow.
Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
Changelog from v1:
- Handle comments from Christophe Leroy
arch/powerpc/mm/numa.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f4cf3ae036de..c44a80d8fc11 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -432,7 +432,7 @@ static void __init initialize_form2_numa_distance_lookup_table(void)
static int __init find_primary_domain_index(void)
{
- int index;
+ int index = -1;
struct device_node *root;
/*
@@ -502,12 +502,9 @@ static int __init find_primary_domain_index(void)
distance_ref_points_depth = MAX_DISTANCE_REF_POINTS;
}
- of_node_put(root);
- return index;
-
err:
of_node_put(root);
- return -1;
+ return index;
}
static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
--
2.43.7
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 2/3] powerpc/numa: Allow cpu_to_coregroup_id without PPC_SPLPAR
[not found] <20260902123458.340456-5-srikar@linux.ibm.com>
2026-09-02 12:35 ` [PATCH v3 1/3] powerpc/numa: Simplify find_primary_domain_index Srikar Dronamraju
@ 2026-09-02 12:35 ` Srikar Dronamraju
2026-09-04 9:59 ` Shrikanth Hegde
2026-09-02 12:35 ` [PATCH v3 3/3] powerpc/numa: Support coregroup on PowerNV Srikar Dronamraju
2 siblings, 1 reply; 8+ messages in thread
From: Srikar Dronamraju @ 2026-09-02 12:35 UTC (permalink / raw)
To: linuxppc-dev, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP)
Cc: skiboot, arbab, mahesh, Srikar Dronamraju, Ritesh Harjani,
Shrikanth Hegde, Peter Zijlstra, Valentin Schneider,
K Prateek Nayak, Andrew Morton, Mike Rapoport (Microsoft),
linux-kernel
Make cpu_to_coregroup_id() available outside PPC_SPLPAR so it can be
used by platforms that do not rely on the SPLPAR-specific VPHN path.
Keep the existing fallback behavior by returning the core ID when
coregroup information is unavailable.
Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
Changelog from v2:
- Handle comments from Ritesh (one hunk needed to be moved from patch 2 to
patch 3 to build correctly)
Changelog from v1:
- Handle comments from Christophe Leroy; Remove extern key word in
declaration
arch/powerpc/include/asm/topology.h | 15 +++++++--------
arch/powerpc/mm/numa.c | 22 +++++++++++++++-------
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 44ec416fa489..02c3c9ab3ea9 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -71,6 +71,7 @@ extern void map_cpu_to_node(int cpu, int node);
extern void unmap_cpu_from_node(unsigned long cpu);
#endif /* CONFIG_HOTPLUG_CPU */
+int cpu_to_coregroup_id(int cpu);
#else
static inline int early_cpu_to_node(int cpu) { return 0; }
@@ -107,14 +108,6 @@ static inline void map_cpu_to_node(int cpu, int node) {}
static inline void unmap_cpu_from_node(unsigned long cpu) {}
#endif /* CONFIG_HOTPLUG_CPU */
#endif /* CONFIG_SMP */
-
-#endif /* CONFIG_NUMA */
-
-#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
-void find_and_update_cpu_nid(int cpu);
-extern int cpu_to_coregroup_id(int cpu);
-#else
-static inline void find_and_update_cpu_nid(int cpu) {}
static inline int cpu_to_coregroup_id(int cpu)
{
#ifdef CONFIG_SMP
@@ -124,6 +117,12 @@ static inline int cpu_to_coregroup_id(int cpu)
#endif
}
+#endif /* CONFIG_NUMA */
+
+#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
+void find_and_update_cpu_nid(int cpu);
+#else
+static inline void find_and_update_cpu_nid(int cpu) {}
#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
#include <asm-generic/topology.h>
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index c44a80d8fc11..5f326b005a2a 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1428,6 +1428,21 @@ void find_and_update_cpu_nid(int cpu)
pr_debug("%s:%d cpu %d nid %d\n", __func__, __LINE__, cpu, new_nid);
}
+static int topology_update_init(void)
+{
+ topology_inited = 1;
+ return 0;
+}
+device_initcall(topology_update_init);
+
+#else
+static long vphn_get_associativity(unsigned long cpu,
+ __be32 *associativity)
+{
+ return -1;
+}
+#endif /* CONFIG_PPC_SPLPAR */
+
int cpu_to_coregroup_id(int cpu)
{
__be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
@@ -1453,10 +1468,3 @@ int cpu_to_coregroup_id(int cpu)
return cpu_to_core_id(cpu);
}
-static int topology_update_init(void)
-{
- topology_inited = 1;
- return 0;
-}
-device_initcall(topology_update_init);
-#endif /* CONFIG_PPC_SPLPAR */
--
2.43.7
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 3/3] powerpc/numa: Support coregroup on PowerNV
[not found] <20260902123458.340456-5-srikar@linux.ibm.com>
2026-09-02 12:35 ` [PATCH v3 1/3] powerpc/numa: Simplify find_primary_domain_index Srikar Dronamraju
2026-09-02 12:35 ` [PATCH v3 2/3] powerpc/numa: Allow cpu_to_coregroup_id without PPC_SPLPAR Srikar Dronamraju
@ 2026-09-02 12:35 ` Srikar Dronamraju
2026-09-04 10:04 ` Shrikanth Hegde
2 siblings, 1 reply; 8+ messages in thread
From: Srikar Dronamraju @ 2026-09-02 12:35 UTC (permalink / raw)
To: linuxppc-dev, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP)
Cc: skiboot, arbab, mahesh, Srikar Dronamraju, Ritesh Harjani,
Andrew Morton, Mike Rapoport (Microsoft),
linux-kernel
Coregroup support on powerpc has so far been limited to PowerVM LPARs.
However, PowerNV can also support coregroups when firmware exposes the
required coregroup information through the associativity hierarchy.
Detect coregroup support by checking whether primary_domain_index is the
penultimate domain in the CPU node's ibm,associativity property. On
PowerNV, a non-penultimate primary_domain_index indicates that firmware
provides an additional level for coregroup information.
This keeps the logic compatible with PowerVM systems, where
primary_domain_index is likewise not the penultimate associativity
domain.
Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
Changelog from v2:
- Handle comments from Ritesh (one hunk needed to be moved from patch 2 to
patch 3 to build correctly)
Changelog from v1: https://lkml.kernel.org/r/20260524010017.140408-1-srikar@linux.ibm.com
- Handle comments from Christophe Leroy; make code more flat
arch/powerpc/mm/numa.c | 58 ++++++++++++++++++++++++++++++++++--------
1 file changed, 48 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5f326b005a2a..e97b624203ea 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -889,12 +889,32 @@ static int __init numa_setup_drmem_lmb(struct drmem_lmb *lmb,
return 0;
}
+/*
+ * If hierarchy extends beyond primary_domain_index + 1, then next
+ * level corresponds to coregroup.
+ */
+static int detect_and_enable_coregroup(const __be32 *associativity, int index)
+{
+ if (!associativity || index == -1)
+ goto out;
+
+ index = of_read_number(associativity, 1);
+
+ if (index > primary_domain_index + 1) {
+ coregroup_enabled = 1;
+ return index;
+ }
+out:
+ coregroup_enabled = 0;
+ return -1;
+}
+
static int __init parse_numa_properties(void)
{
struct device_node *memory, *pci;
- int default_nid = 0;
- unsigned long i;
+ int default_nid = 0, index = 0;
const __be32 *associativity;
+ unsigned long i;
if (numa_enabled == 0) {
pr_warn("disabled by user\n");
@@ -927,7 +947,6 @@ static int __init parse_numa_properties(void)
*/
for_each_present_cpu(i) {
__be32 vphn_assoc[VPHN_ASSOC_BUFSIZE];
- struct device_node *cpu;
int nid = NUMA_NO_NODE;
memset(vphn_assoc, 0, VPHN_ASSOC_BUFSIZE * sizeof(__be32));
@@ -935,7 +954,9 @@ static int __init parse_numa_properties(void)
if (__vphn_get_associativity(i, vphn_assoc) == 0) {
nid = associativity_to_nid(vphn_assoc);
initialize_form1_numa_distance(vphn_assoc);
+ index = detect_and_enable_coregroup(vphn_assoc, index);
} else {
+ struct device_node *cpu;
/*
* Don't fall back to default_nid yet -- we will plug
@@ -948,6 +969,7 @@ static int __init parse_numa_properties(void)
associativity = of_get_associativity(cpu);
if (associativity) {
nid = associativity_to_nid(associativity);
+ index = detect_and_enable_coregroup(associativity, index);
initialize_form1_numa_distance(associativity);
}
of_node_put(cpu);
@@ -1445,7 +1467,9 @@ static long vphn_get_associativity(unsigned long cpu,
int cpu_to_coregroup_id(int cpu)
{
- __be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
+ int coregroup_id = cpu_to_core_id(cpu);
+ struct device_node *cpunode = NULL;
+ const __be32 *associativity;
int index;
if (cpu < 0 || cpu > nr_cpu_ids)
@@ -1454,17 +1478,31 @@ int cpu_to_coregroup_id(int cpu)
if (!coregroup_enabled)
goto out;
- if (!firmware_has_feature(FW_FEATURE_VPHN))
- goto out;
+ if (firmware_has_feature(FW_FEATURE_VPHN)) {
+ __be32 tmp[VPHN_ASSOC_BUFSIZE] = {0};
- if (vphn_get_associativity(cpu, associativity))
+ if (vphn_get_associativity(cpu, tmp))
+ goto out;
+
+ associativity = tmp;
+
+ } else {
+ cpunode = of_get_cpu_node(cpu, NULL);
+ if (!cpunode)
+ goto out;
+
+ associativity = of_get_associativity(cpunode);
+ }
+ if (!associativity)
goto out;
index = of_read_number(associativity, 1);
if (index > primary_domain_index + 1)
- return of_read_number(&associativity[index - 1], 1);
+ coregroup_id = of_read_number(&associativity[index - 1], 1);
out:
- return cpu_to_core_id(cpu);
-}
+ if (cpunode)
+ of_node_put(cpunode);
+ return coregroup_id;
+}
--
2.43.7
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/3] powerpc/numa: Allow cpu_to_coregroup_id without PPC_SPLPAR
2026-09-02 12:35 ` [PATCH v3 2/3] powerpc/numa: Allow cpu_to_coregroup_id without PPC_SPLPAR Srikar Dronamraju
@ 2026-09-04 9:59 ` Shrikanth Hegde
2026-09-04 11:10 ` Srikar Dronamraju
0 siblings, 1 reply; 8+ messages in thread
From: Shrikanth Hegde @ 2026-09-04 9:59 UTC (permalink / raw)
To: Srikar Dronamraju, linuxppc-dev, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP)
Cc: skiboot, arbab, mahesh, Ritesh Harjani, Peter Zijlstra,
Valentin Schneider, K Prateek Nayak, Andrew Morton,
Mike Rapoport (Microsoft),
linux-kernel
On 9/2/26 6:05 PM, Srikar Dronamraju wrote:
> Make cpu_to_coregroup_id() available outside PPC_SPLPAR so it can be
> used by platforms that do not rely on the SPLPAR-specific VPHN path.
>
> Keep the existing fallback behavior by returning the core ID when
> coregroup information is unavailable.
>
> Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
> ---
> Changelog from v2:
> - Handle comments from Ritesh (one hunk needed to be moved from patch 2 to
> patch 3 to build correctly)
>
> Changelog from v1:
> - Handle comments from Christophe Leroy; Remove extern key word in
> declaration
>
> arch/powerpc/include/asm/topology.h | 15 +++++++--------
> arch/powerpc/mm/numa.c | 22 +++++++++++++++-------
> 2 files changed, 22 insertions(+), 15 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
> index 44ec416fa489..02c3c9ab3ea9 100644
> --- a/arch/powerpc/include/asm/topology.h
> +++ b/arch/powerpc/include/asm/topology.h
> @@ -71,6 +71,7 @@ extern void map_cpu_to_node(int cpu, int node);
> extern void unmap_cpu_from_node(unsigned long cpu);
> #endif /* CONFIG_HOTPLUG_CPU */
>
> +int cpu_to_coregroup_id(int cpu);
nit:
I prefer extern before declaration so that i can see it is defined
elsewhere.
Other than that, rest looks good to me.
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> #else
>
> static inline int early_cpu_to_node(int cpu) { return 0; }
> @@ -107,14 +108,6 @@ static inline void map_cpu_to_node(int cpu, int node) {}
> static inline void unmap_cpu_from_node(unsigned long cpu) {}
> #endif /* CONFIG_HOTPLUG_CPU */
> #endif /* CONFIG_SMP */
> -
> -#endif /* CONFIG_NUMA */
> -
> -#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
> -void find_and_update_cpu_nid(int cpu);
> -extern int cpu_to_coregroup_id(int cpu);
> -#else
> -static inline void find_and_update_cpu_nid(int cpu) {}
> static inline int cpu_to_coregroup_id(int cpu)
> {
> #ifdef CONFIG_SMP
> @@ -124,6 +117,12 @@ static inline int cpu_to_coregroup_id(int cpu)
> #endif
> }
>
> +#endif /* CONFIG_NUMA */
> +
> +#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
> +void find_and_update_cpu_nid(int cpu);
> +#else
> +static inline void find_and_update_cpu_nid(int cpu) {}
> #endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
>
> #include <asm-generic/topology.h>
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index c44a80d8fc11..5f326b005a2a 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -1428,6 +1428,21 @@ void find_and_update_cpu_nid(int cpu)
> pr_debug("%s:%d cpu %d nid %d\n", __func__, __LINE__, cpu, new_nid);
> }
>
> +static int topology_update_init(void)
> +{
> + topology_inited = 1;
> + return 0;
> +}
> +device_initcall(topology_update_init);
> +
> +#else
> +static long vphn_get_associativity(unsigned long cpu,
> + __be32 *associativity)
> +{
> + return -1;
> +}
> +#endif /* CONFIG_PPC_SPLPAR */
> +
> int cpu_to_coregroup_id(int cpu)
> {
> __be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
> @@ -1453,10 +1468,3 @@ int cpu_to_coregroup_id(int cpu)
> return cpu_to_core_id(cpu);
> }
>
> -static int topology_update_init(void)
> -{
> - topology_inited = 1;
> - return 0;
> -}
> -device_initcall(topology_update_init);
> -#endif /* CONFIG_PPC_SPLPAR */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 3/3] powerpc/numa: Support coregroup on PowerNV
2026-09-02 12:35 ` [PATCH v3 3/3] powerpc/numa: Support coregroup on PowerNV Srikar Dronamraju
@ 2026-09-04 10:04 ` Shrikanth Hegde
2026-09-04 11:34 ` Srikar Dronamraju
0 siblings, 1 reply; 8+ messages in thread
From: Shrikanth Hegde @ 2026-09-04 10:04 UTC (permalink / raw)
To: Srikar Dronamraju, linuxppc-dev, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP)
Cc: skiboot, arbab, mahesh, Ritesh Harjani, Andrew Morton,
Mike Rapoport (Microsoft),
linux-kernel
On 9/2/26 6:05 PM, Srikar Dronamraju wrote:
> Coregroup support on powerpc has so far been limited to PowerVM LPARs.
> However, PowerNV can also support coregroups when firmware exposes the
> required coregroup information through the associativity hierarchy.
>
Existing firmware does expose this info already?
> Detect coregroup support by checking whether primary_domain_index is the
> penultimate domain in the CPU node's ibm,associativity property. On
> PowerNV, a non-penultimate primary_domain_index indicates that firmware
> provides an additional level for coregroup information.
>
> This keeps the logic compatible with PowerVM systems, where
> primary_domain_index is likewise not the penultimate associativity
> domain.
>
Could you please put the ibm,associativity on this powernv? as well
PowerVM's so that one understands it better?
> Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
> ---
> Changelog from v2:
> - Handle comments from Ritesh (one hunk needed to be moved from patch 2 to
> patch 3 to build correctly)
>
> Changelog from v1: https://lkml.kernel.org/r/20260524010017.140408-1-srikar@linux.ibm.com
> - Handle comments from Christophe Leroy; make code more flat
>
> arch/powerpc/mm/numa.c | 58 ++++++++++++++++++++++++++++++++++--------
> 1 file changed, 48 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 5f326b005a2a..e97b624203ea 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -889,12 +889,32 @@ static int __init numa_setup_drmem_lmb(struct drmem_lmb *lmb,
> return 0;
> }
>
> +/*
> + * If hierarchy extends beyond primary_domain_index + 1, then next
> + * level corresponds to coregroup.
> + */
> +static int detect_and_enable_coregroup(const __be32 *associativity, int index)
> +{
> + if (!associativity || index == -1)
> + goto out;
> +
> + index = of_read_number(associativity, 1);
> +
> + if (index > primary_domain_index + 1) {
> + coregroup_enabled = 1;
> + return index;
> + }
> +out:
> + coregroup_enabled = 0;
> + return -1;
> +}
> +
> static int __init parse_numa_properties(void)
> {
> struct device_node *memory, *pci;
> - int default_nid = 0;
> - unsigned long i;
> + int default_nid = 0, index = 0;
> const __be32 *associativity;
> + unsigned long i;
>
> if (numa_enabled == 0) {
> pr_warn("disabled by user\n");
> @@ -927,7 +947,6 @@ static int __init parse_numa_properties(void)
> */
> for_each_present_cpu(i) {
> __be32 vphn_assoc[VPHN_ASSOC_BUFSIZE];
> - struct device_node *cpu;
> int nid = NUMA_NO_NODE;
>
> memset(vphn_assoc, 0, VPHN_ASSOC_BUFSIZE * sizeof(__be32));
> @@ -935,7 +954,9 @@ static int __init parse_numa_properties(void)
> if (__vphn_get_associativity(i, vphn_assoc) == 0) {
> nid = associativity_to_nid(vphn_assoc);
> initialize_form1_numa_distance(vphn_assoc);
> + index = detect_and_enable_coregroup(vphn_assoc, index);
nit: I don't see return value being used.
Other than that, rest looks good to me.
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> } else {
> + struct device_node *cpu;
>
> /*
> * Don't fall back to default_nid yet -- we will plug
> @@ -948,6 +969,7 @@ static int __init parse_numa_properties(void)
> associativity = of_get_associativity(cpu);
> if (associativity) {
> nid = associativity_to_nid(associativity);
> + index = detect_and_enable_coregroup(associativity, index);
> initialize_form1_numa_distance(associativity);
> }
> of_node_put(cpu);
> @@ -1445,7 +1467,9 @@ static long vphn_get_associativity(unsigned long cpu,
>
> int cpu_to_coregroup_id(int cpu)
> {
> - __be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
> + int coregroup_id = cpu_to_core_id(cpu);
> + struct device_node *cpunode = NULL;
> + const __be32 *associativity;
> int index;
>
> if (cpu < 0 || cpu > nr_cpu_ids)
> @@ -1454,17 +1478,31 @@ int cpu_to_coregroup_id(int cpu)
> if (!coregroup_enabled)
> goto out;
>
> - if (!firmware_has_feature(FW_FEATURE_VPHN))
> - goto out;
> + if (firmware_has_feature(FW_FEATURE_VPHN)) {
> + __be32 tmp[VPHN_ASSOC_BUFSIZE] = {0};
>
> - if (vphn_get_associativity(cpu, associativity))
> + if (vphn_get_associativity(cpu, tmp))
> + goto out;
> +
> + associativity = tmp;
> +
> + } else {
> + cpunode = of_get_cpu_node(cpu, NULL);
> + if (!cpunode)
> + goto out;
> +
> + associativity = of_get_associativity(cpunode);
> + }
> + if (!associativity)
> goto out;
>
> index = of_read_number(associativity, 1);
> if (index > primary_domain_index + 1)
> - return of_read_number(&associativity[index - 1], 1);
> + coregroup_id = of_read_number(&associativity[index - 1], 1);
>
> out:
> - return cpu_to_core_id(cpu);
> -}
> + if (cpunode)
> + of_node_put(cpunode);
>
> + return coregroup_id;
> +}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 1/3] powerpc/numa: Simplify find_primary_domain_index
2026-09-02 12:35 ` [PATCH v3 1/3] powerpc/numa: Simplify find_primary_domain_index Srikar Dronamraju
@ 2026-09-04 10:05 ` Shrikanth Hegde
0 siblings, 0 replies; 8+ messages in thread
From: Shrikanth Hegde @ 2026-09-04 10:05 UTC (permalink / raw)
To: Srikar Dronamraju, linuxppc-dev, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP)
Cc: skiboot, arbab, mahesh, Ritesh Harjani, Mike Rapoport (Microsoft),
Andrew Morton, linux-kernel
On 9/2/26 6:05 PM, Srikar Dronamraju wrote:
> Initialize the return value once and use a single exit path in
> find_primary_domain_index().
>
> This is a small cleanup that keeps the existing behavior unchanged while
> making the control flow easier to follow.
>
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
> ---
> Changelog from v1:
> - Handle comments from Christophe Leroy
>
> arch/powerpc/mm/numa.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index f4cf3ae036de..c44a80d8fc11 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -432,7 +432,7 @@ static void __init initialize_form2_numa_distance_lookup_table(void)
>
> static int __init find_primary_domain_index(void)
> {
> - int index;
> + int index = -1;
> struct device_node *root;
>
> /*
> @@ -502,12 +502,9 @@ static int __init find_primary_domain_index(void)
> distance_ref_points_depth = MAX_DISTANCE_REF_POINTS;
> }
>
> - of_node_put(root);
> - return index;
> -
> err:
> of_node_put(root);
> - return -1;
> + return index;
> }
>
> static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/3] powerpc/numa: Allow cpu_to_coregroup_id without PPC_SPLPAR
2026-09-04 9:59 ` Shrikanth Hegde
@ 2026-09-04 11:10 ` Srikar Dronamraju
0 siblings, 0 replies; 8+ messages in thread
From: Srikar Dronamraju @ 2026-09-04 11:10 UTC (permalink / raw)
To: Shrikanth Hegde
Cc: linuxppc-dev, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP),
skiboot, arbab, mahesh, Ritesh Harjani, Peter Zijlstra,
Valentin Schneider, K Prateek Nayak, Andrew Morton,
Mike Rapoport (Microsoft),
linux-kernel
* Shrikanth Hegde <sshegde@linux.ibm.com> [2026-09-04 15:29:03]:
>
>
> On 9/2/26 6:05 PM, Srikar Dronamraju wrote:
> > Make cpu_to_coregroup_id() available outside PPC_SPLPAR so it can be
> > used by platforms that do not rely on the SPLPAR-specific VPHN path.
> >
> >
> > diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
> > index 44ec416fa489..02c3c9ab3ea9 100644
> > --- a/arch/powerpc/include/asm/topology.h
> > +++ b/arch/powerpc/include/asm/topology.h
> > @@ -71,6 +71,7 @@ extern void map_cpu_to_node(int cpu, int node);
> > extern void unmap_cpu_from_node(unsigned long cpu);
> > #endif /* CONFIG_HOTPLUG_CPU */
> > +int cpu_to_coregroup_id(int cpu);
>
> nit:
>
> I prefer extern before declaration so that i can see it is defined
> elsewhere.
Hey Shrikanth,
Thanks for taking a look.
It was done on intention based on comment from Christophe Leroy here
https://lkml.kernel.org/r/6387fb12-76f1-4503-8ac2-3ca777c0186e@kernel.org
>
> Other than that, rest looks good to me.
>
> Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
>
--
Thanks and Regards
Srikar Dronamraju
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 3/3] powerpc/numa: Support coregroup on PowerNV
2026-09-04 10:04 ` Shrikanth Hegde
@ 2026-09-04 11:34 ` Srikar Dronamraju
0 siblings, 0 replies; 8+ messages in thread
From: Srikar Dronamraju @ 2026-09-04 11:34 UTC (permalink / raw)
To: Shrikanth Hegde
Cc: linuxppc-dev, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP),
skiboot, arbab, mahesh, Ritesh Harjani, Andrew Morton,
Mike Rapoport (Microsoft),
linux-kernel
* Shrikanth Hegde <sshegde@linux.ibm.com> [2026-09-04 15:34:50]:
Thanks Shrikanth for taking a look.
>
>
> On 9/2/26 6:05 PM, Srikar Dronamraju wrote:
> > Coregroup support on powerpc has so far been limited to PowerVM LPARs.
> > However, PowerNV can also support coregroups when firmware exposes the
> > required coregroup information through the associativity hierarchy.
> >
>
> Existing firmware does expose this info already?
The corresponding skiboot changes were sent to the skiboot mailing list.
>
> > Detect coregroup support by checking whether primary_domain_index is the
> > penultimate domain in the CPU node's ibm,associativity property. On
> > PowerNV, a non-penultimate primary_domain_index indicates that firmware
> > provides an additional level for coregroup information.
> >
> > This keeps the logic compatible with PowerVM systems, where
> > primary_domain_index is likewise not the penultimate associativity
> > domain.
> >
>
> Could you please put the ibm,associativity on this powernv? as well
> PowerVM's so that one understands it better?
With this patch and the skiboot change, the ibm,associativity will look
similar.
For example on a Power10 Baremetal box with skiboot changes.
$ lsprop /proc/device-tree/cpus/PowerPC,POWER10@*/ibm,associativity |& head -n 20
PowerPC,POWER10@0/ibm,associativity
00000005 00000000 00000000 00000000 00000000 00000000
PowerPC,POWER10@100/ibm,associativity
00000005 00000000 00000001 00000001 00000002 00000000
PowerPC,POWER10@108/ibm,associativity
00000005 00000000 00000001 00000001 00000002 00000002
PowerPC,POWER10@10/ibm,associativity
00000005 00000000 00000000 00000000 00000001 00000004
PowerPC,POWER10@110/ibm,associativity
00000005 00000000 00000001 00000001 00000003 00000004
PowerPC,POWER10@118/ibm,associativity
00000005 00000000 00000001 00000001 00000003 00000006
PowerPC,POWER10@120/ibm,associativity
00000005 00000000 00000001 00000001 00000002 00000008
PowerPC,POWER10@128/ibm,associativity
00000005 00000000 00000001 00000001 00000002 0000000a
PowerPC,POWER10@130/ibm,associativity
00000005 00000000 00000001 00000001 00000003 0000000c
PowerPC,POWER10@138/ibm,associativity
00000005 00000000 00000001 00000001 00000003 0000000e
>
> > Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
> > ---
> > Changelog from v2:
> > - Handle comments from Ritesh (one hunk needed to be moved from patch 2 to
> > patch 3 to build correctly)
> >
> > Changelog from v1: https://lkml.kernel.org/r/20260524010017.140408-1-srikar@linux.ibm.com
> > - Handle comments from Christophe Leroy; make code more flat
> >
> > arch/powerpc/mm/numa.c | 58 ++++++++++++++++++++++++++++++++++--------
> > 1 file changed, 48 insertions(+), 10 deletions(-)
--
Thanks and Regards
Srikar Dronamraju
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-09-04 11:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20260902123458.340456-5-srikar@linux.ibm.com>
2026-09-02 12:35 ` [PATCH v3 1/3] powerpc/numa: Simplify find_primary_domain_index Srikar Dronamraju
2026-09-04 10:05 ` Shrikanth Hegde
2026-09-02 12:35 ` [PATCH v3 2/3] powerpc/numa: Allow cpu_to_coregroup_id without PPC_SPLPAR Srikar Dronamraju
2026-09-04 9:59 ` Shrikanth Hegde
2026-09-04 11:10 ` Srikar Dronamraju
2026-09-02 12:35 ` [PATCH v3 3/3] powerpc/numa: Support coregroup on PowerNV Srikar Dronamraju
2026-09-04 10:04 ` Shrikanth Hegde
2026-09-04 11:34 ` Srikar Dronamraju
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®