On 6/15/21 8:43 AM, David Gibson wrote:
On Mon, Jun 14, 2021 at 10:09:59PM +0530, Aneesh Kumar K.V wrote:
The associativity details of the newly added resourced are collected from
the hypervisor via "ibm,configure-connector" rtas call. Update the numa
distance details of the newly added numa node after the above call. In
later patch we will remove updating NUMA distance when we are looking
for node id from associativity array.

Signed-off-by: Aneesh Kumar K.V <aneesh.ku...@linux.ibm.com>
---
  arch/powerpc/mm/numa.c                        | 41 +++++++++++++++++++
  arch/powerpc/platforms/pseries/hotplug-cpu.c  |  2 +
  .../platforms/pseries/hotplug-memory.c        |  2 +
  arch/powerpc/platforms/pseries/pseries.h      |  1 +
  4 files changed, 46 insertions(+)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 192067991f8a..fec47981c1ef 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -287,6 +287,47 @@ int of_node_to_nid(struct device_node *device)
  }
  EXPORT_SYMBOL(of_node_to_nid);
+static void __initialize_form1_numa_distance(const __be32 *associativity)
+{
+       int i, nid;
+
+       if (of_read_number(associativity, 1) >= primary_domain_index) {
+               nid = of_read_number(&associativity[primary_domain_index], 1);
+
+               for (i = 0; i < max_domain_index; i++) {
+                       const __be32 *entry;
+
+                       entry = 
&associativity[be32_to_cpu(distance_ref_points[i])];
+                       distance_lookup_table[nid][i] = of_read_number(entry, 
1);
+               }
+       }
+}

This logic is almost identicaly to initialize_distance_lookup_table()
- it would be good if they could be consolidated, so it's clear that
coldplugged and hotplugged nodes are parsing the NUMA information in
the same way.

initialize_distance_lookup_table() gets removed in the next patch.

-aneesh

Reply via email to