Commit bc8449cc57898bc9cf1ffc4619d026f77bf327c1

Authored by Anton Blanchard
Committed by Benjamin Herrenschmidt
1 parent 56608209d3

powerpc/numa: Use ibm,architecture-vec-5 to detect form 1 affinity

I've been told that the architected way to determine we are in form 1
affinity mode is by reading the ibm,architecture-vec-5 property which
mirrors the layout of the fifth vector of the ibm,client-architecture
structure.

Eventually we may want to parse the ibm,architecture-vec-5 and create
FW_FEATURE_* bits.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Showing 1 changed file with 12 additions and 8 deletions Side-by-side Diff

arch/powerpc/mm/numa.c
... ... @@ -271,7 +271,8 @@
271 271 const unsigned int *ref_points;
272 272 struct device_node *rtas_root;
273 273 unsigned int len;
274   - struct device_node *options;
  274 + struct device_node *chosen;
  275 + const char *vec5;
275 276  
276 277 rtas_root = of_find_node_by_path("/rtas");
277 278  
278 279  
... ... @@ -289,14 +290,17 @@
289 290 "ibm,associativity-reference-points", &len);
290 291  
291 292 /*
292   - * For type 1 affinity information we want the first field
  293 + * For form 1 affinity information we want the first field
293 294 */
294   - options = of_find_node_by_path("/options");
295   - if (options) {
296   - const char *str;
297   - str = of_get_property(options, "ibm,associativity-form", NULL);
298   - if (str && !strcmp(str, "1"))
299   - index = 0;
  295 +#define VEC5_AFFINITY_BYTE 5
  296 +#define VEC5_AFFINITY 0x80
  297 + chosen = of_find_node_by_path("/chosen");
  298 + if (chosen) {
  299 + vec5 = of_get_property(chosen, "ibm,architecture-vec-5", NULL);
  300 + if (vec5 && (vec5[VEC5_AFFINITY_BYTE] & VEC5_AFFINITY)) {
  301 + dbg("Using form 1 affinity\n");
  302 + index = 0;
  303 + }
300 304 }
301 305  
302 306 if ((len >= 2 * sizeof(unsigned int)) && ref_points) {