[RFC PATCH 1/3] powerpc/numa: Get device node whenn retreiving associativity arrays
Nathan Fontenot
nfont at linux.vnet.ibm.com
Tue Aug 1 05:48:15 AEST 2017
When we move to using the kernel lmb structs instead of accessing
the device tree directly for LMB information we will no longer have
a pointer to the device node for memory to pass to of_get_assoc_arrays().
This patch updates of_get_assoc_arrays() to no longer take a device node
pointer and does the lookup of the memory device node itself.
Signed-off-by: Nathan Fontenot <nfont at linux.vnet.ibm.com>
---
arch/powerpc/mm/numa.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 371792e..9c21953 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -466,19 +466,27 @@ struct assoc_arrays {
* indicating the size of each associativity array, followed by a list
* of N associativity arrays.
*/
-static int of_get_assoc_arrays(struct device_node *memory,
- struct assoc_arrays *aa)
+static int of_get_assoc_arrays(struct assoc_arrays *aa)
{
+ struct device_node *memory;
const __be32 *prop;
u32 len;
+ memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
+ if (!memory)
+ return -1;
+
prop = of_get_property(memory, "ibm,associativity-lookup-arrays", &len);
- if (!prop || len < 2 * sizeof(unsigned int))
+ if (!prop || len < 2 * sizeof(unsigned int)) {
+ of_node_put(memory);
return -1;
+ }
aa->n_arrays = of_read_number(prop++, 1);
aa->array_sz = of_read_number(prop++, 1);
+ of_node_put(memory);
+
/* Now that we know the number of arrays and size of each array,
* revalidate the size of the property read in.
*/
@@ -661,7 +669,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
if (!lmb_size)
return;
- rc = of_get_assoc_arrays(memory, &aa);
+ rc = of_get_assoc_arrays(&aa);
if (rc)
return;
@@ -996,7 +1004,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
if (!lmb_size)
return -1;
- rc = of_get_assoc_arrays(memory, &aa);
+ rc = of_get_assoc_arrays(&aa);
if (rc)
return -1;
More information about the Linuxppc-dev
mailing list