Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel...
[pandora-kernel.git] / arch / powerpc / mm / numa.c
index b037d95..eaa7633 100644 (file)
@@ -242,10 +242,11 @@ EXPORT_SYMBOL_GPL(of_node_to_nid);
  */
 static int __init find_min_common_depth(void)
 {
-       int depth;
+       int depth, index;
        const unsigned int *ref_points;
        struct device_node *rtas_root;
        unsigned int len;
+       struct device_node *options;
 
        rtas_root = of_find_node_by_path("/rtas");
 
@@ -258,11 +259,23 @@ static int __init find_min_common_depth(void)
         * configuration (should be all 0's) and the second is for a normal
         * NUMA configuration.
         */
+       index = 1;
        ref_points = of_get_property(rtas_root,
                        "ibm,associativity-reference-points", &len);
 
+       /*
+        * For type 1 affinity information we want the first field
+        */
+       options = of_find_node_by_path("/options");
+       if (options) {
+               const char *str;
+               str = of_get_property(options, "ibm,associativity-form", NULL);
+               if (str && !strcmp(str, "1"))
+                        index = 0;
+       }
+
        if ((len >= 2 * sizeof(unsigned int)) && ref_points) {
-               depth = ref_points[1];
+               depth = ref_points[index];
        } else {
                dbg("NUMA: ibm,associativity-reference-points not found.\n");
                depth = -1;
@@ -451,7 +464,7 @@ static int __cpuinit numa_setup_cpu(unsigned long lcpu)
        nid = of_node_to_nid_single(cpu);
 
        if (nid < 0 || !node_online(nid))
-               nid = any_online_node(NODE_MASK_ALL);
+               nid = first_online_node;
 out:
        map_cpu_to_node(lcpu, nid);
 
@@ -1114,7 +1127,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
        int nid, found = 0;
 
        if (!numa_enabled || (min_common_depth < 0))
-               return any_online_node(NODE_MASK_ALL);
+               return first_online_node;
 
        memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
        if (memory) {
@@ -1125,7 +1138,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
        }
 
        if (nid < 0 || !node_online(nid))
-               nid = any_online_node(NODE_MASK_ALL);
+               nid = first_online_node;
 
        if (NODE_DATA(nid)->node_spanned_pages)
                return nid;