[DEBUG 13/21] powerpc/mm: Identify coherent device memory nodes during platform init

From: Anshuman Khandual
Date: Sun Jan 29 2017 - 22:40:08 EST


Coherent device memory nodes will have "ibm,hotplug-aperture" as one of the
compatible properties in their respective device nodes in the device tree.
Detect them early during NUMA platform initialization and mark them as such
in the node_to_phys_device_map[] array which in turn is used to support the
arch_check_cdm_node() function for the core VM.

Signed-off-by: Anshuman Khandual <khandual@xxxxxxxxxxxxxxxxxx>
---
arch/powerpc/mm/numa.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 9c73fbe..6def078 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -41,10 +41,12 @@
#include <asm/setup.h>
#include <asm/vdso.h>

+static int node_to_phys_device_map[MAX_NUMNODES];
+
#ifdef CONFIG_COHERENT_DEVICE
int arch_check_node_cdm(int nid)
{
- return 0;
+ return node_to_phys_device_map[nid];
}
#endif

@@ -790,6 +792,9 @@ static int __init parse_numa_properties(void)
if (nid < 0)
nid = default_nid;

+ if (of_device_is_compatible(memory, "ibm,hotplug-aperture"))
+ node_to_phys_device_map[nid] = 1;
+
fake_numa_create_new_node(((start + size) >> PAGE_SHIFT), &nid);
node_set_online(nid);

--
2.9.3