From: Anton Blanchard Date: Wed, 7 Apr 2010 15:33:44 +0000 (+0000) Subject: powerpc/numa: Add form 1 NUMA affinity X-Git-Tag: v2.6.34-rc6~5^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b83c330b4d38e869111bda6e9077d4f61ed974a;p=platform%2Fupstream%2Fkernel-adaptation-pc.git powerpc/numa: Add form 1 NUMA affinity Firmware changed the way it represents memory and cpu affinity on POWER7. Unfortunately the old method now caps the topology to work around issues with legacy operating systems. For Linux to get the correct topology we need to use the new form 1 affinity information. We set the form 1 field in the client architecture, and if we see "1" in the ibm,associativity-form property firmware supports form 1 affinity and we should look at the first field in the ibm,associativity-reference-points array. If not we use the second field as we always have. Signed-off-by: Anton Blanchard Signed-off-by: Benjamin Herrenschmidt --- diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 5f306c4..97d4bd9 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -653,6 +653,7 @@ static void __init early_cmdline_parse(void) #else #define OV5_CMO 0x00 #endif +#define OV5_TYPE1_AFFINITY 0x80 /* Type 1 NUMA affinity */ /* Option Vector 6: IBM PAPR hints */ #define OV6_LINUX 0x02 /* Linux is our OS */ @@ -706,7 +707,7 @@ static unsigned char ibm_architecture_vec[] = { OV5_DONATE_DEDICATE_CPU | OV5_MSI, 0, OV5_CMO, - 0, + OV5_TYPE1_AFFINITY, 0, 0, 0, diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 64c0022..eaa7633 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -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;