1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * acpi_numa.c - ACPI NUMA support 4 * 5 * Copyright (C) 2002 Takayoshi Kochi <t-kochi@bq.jp.nec.com> 6 */ 7 8 #define pr_fmt(fmt) "ACPI: " fmt 9 10 #include <linux/module.h> 11 #include <linux/init.h> 12 #include <linux/kernel.h> 13 #include <linux/types.h> 14 #include <linux/errno.h> 15 #include <linux/acpi.h> 16 #include <linux/memblock.h> 17 #include <linux/numa.h> 18 #include <linux/nodemask.h> 19 #include <linux/topology.h> 20 #include <linux/numa_memblks.h> 21 22 static nodemask_t nodes_found_map = NODE_MASK_NONE; 23 24 /* maps to convert between proximity domain and logical node ID */ 25 static int pxm_to_node_map[MAX_PXM_DOMAINS] 26 = { [0 ... MAX_PXM_DOMAINS - 1] = NUMA_NO_NODE }; 27 static int node_to_pxm_map[MAX_NUMNODES] 28 = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; 29 30 unsigned char acpi_srat_revision __initdata; 31 static int acpi_numa __initdata; 32 33 static int last_real_pxm; 34 35 void __init disable_srat(void) 36 { 37 acpi_numa = -1; 38 } 39 40 int pxm_to_node(int pxm) 41 { 42 if (pxm < 0 || pxm >= MAX_PXM_DOMAINS || numa_off) 43 return NUMA_NO_NODE; 44 return pxm_to_node_map[pxm]; 45 } 46 EXPORT_SYMBOL(pxm_to_node); 47 48 int node_to_pxm(int node) 49 { 50 if (node < 0) 51 return PXM_INVAL; 52 return node_to_pxm_map[node]; 53 } 54 55 static void __acpi_map_pxm_to_node(int pxm, int node) 56 { 57 if (pxm_to_node_map[pxm] == NUMA_NO_NODE || node < pxm_to_node_map[pxm]) 58 pxm_to_node_map[pxm] = node; 59 if (node_to_pxm_map[node] == PXM_INVAL || pxm < node_to_pxm_map[node]) 60 node_to_pxm_map[node] = pxm; 61 } 62 63 int acpi_map_pxm_to_node(int pxm) 64 { 65 int node; 66 67 if (pxm < 0 || pxm >= MAX_PXM_DOMAINS || numa_off) 68 return NUMA_NO_NODE; 69 70 node = pxm_to_node_map[pxm]; 71 72 if (node == NUMA_NO_NODE) { 73 node = first_unset_node(nodes_found_map); 74 if (node >= MAX_NUMNODES) 75 return NUMA_NO_NODE; 76 __acpi_map_pxm_to_node(pxm, node); 77 node_set(node, nodes_found_map); 78 } 79 80 return node; 81 } 82 EXPORT_SYMBOL(acpi_map_pxm_to_node); 83 84 #ifdef CONFIG_NUMA_EMU 85 /* 86 * Take max_nid - 1 fake-numa nodes into account in both 87 * pxm_to_node_map()/node_to_pxm_map[] tables. 88 */ 89 int __init fix_pxm_node_maps(int max_nid) 90 { 91 static int pxm_to_node_map_copy[MAX_PXM_DOMAINS] __initdata 92 = { [0 ... MAX_PXM_DOMAINS - 1] = NUMA_NO_NODE }; 93 static int node_to_pxm_map_copy[MAX_NUMNODES] __initdata 94 = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; 95 int i, j, index = -1, count = 0; 96 nodemask_t nodes_to_enable; 97 98 if (numa_off || srat_disabled()) 99 return -1; 100 101 /* find fake nodes PXM mapping */ 102 for (i = 0; i < MAX_NUMNODES; i++) { 103 if (node_to_pxm_map[i] != PXM_INVAL) { 104 for (j = 0; j <= max_nid; j++) { 105 if ((emu_nid_to_phys[j] == i) && 106 WARN(node_to_pxm_map_copy[j] != PXM_INVAL, 107 "Node %d is already binded to PXM %d\n", 108 j, node_to_pxm_map_copy[j])) 109 return -1; 110 if (emu_nid_to_phys[j] == i) { 111 node_to_pxm_map_copy[j] = 112 node_to_pxm_map[i]; 113 if (j > index) 114 index = j; 115 count++; 116 } 117 } 118 } 119 } 120 if (WARN(index != max_nid, "%d max nid when expected %d\n", 121 index, max_nid)) 122 return -1; 123 124 nodes_clear(nodes_to_enable); 125 126 /* map phys nodes not used for fake nodes */ 127 for (i = 0; i < MAX_NUMNODES; i++) { 128 if (node_to_pxm_map[i] != PXM_INVAL) { 129 for (j = 0; j <= max_nid; j++) 130 if (emu_nid_to_phys[j] == i) 131 break; 132 /* fake nodes PXM mapping has been done */ 133 if (j <= max_nid) 134 continue; 135 /* find first hole */ 136 for (j = 0; 137 j < MAX_NUMNODES && 138 node_to_pxm_map_copy[j] != PXM_INVAL; 139 j++) 140 ; 141 if (WARN(j == MAX_NUMNODES, 142 "Number of nodes exceeds MAX_NUMNODES\n")) 143 return -1; 144 node_to_pxm_map_copy[j] = node_to_pxm_map[i]; 145 node_set(j, nodes_to_enable); 146 count++; 147 } 148 } 149 150 /* creating reverse mapping in pxm_to_node_map[] */ 151 for (i = 0; i < MAX_NUMNODES; i++) 152 if (node_to_pxm_map_copy[i] != PXM_INVAL && 153 pxm_to_node_map_copy[node_to_pxm_map_copy[i]] == NUMA_NO_NODE) 154 pxm_to_node_map_copy[node_to_pxm_map_copy[i]] = i; 155 156 /* overwrite with new mapping */ 157 for (i = 0; i < MAX_NUMNODES; i++) { 158 node_to_pxm_map[i] = node_to_pxm_map_copy[i]; 159 pxm_to_node_map[i] = pxm_to_node_map_copy[i]; 160 } 161 162 /* enable other nodes found in PXM for hotplug */ 163 nodes_or(numa_nodes_parsed, nodes_to_enable, numa_nodes_parsed); 164 165 pr_debug("found %d total number of nodes\n", count); 166 return 0; 167 } 168 #endif 169 170 static void __init 171 acpi_table_print_srat_entry(struct acpi_subtable_header *header) 172 { 173 switch (header->type) { 174 case ACPI_SRAT_TYPE_CPU_AFFINITY: 175 { 176 struct acpi_srat_cpu_affinity *p = 177 (struct acpi_srat_cpu_affinity *)header; 178 pr_debug("SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n", 179 p->apic_id, p->local_sapic_eid, 180 p->proximity_domain_lo, 181 (p->flags & ACPI_SRAT_CPU_ENABLED) ? 182 "enabled" : "disabled"); 183 } 184 break; 185 186 case ACPI_SRAT_TYPE_MEMORY_AFFINITY: 187 { 188 struct acpi_srat_mem_affinity *p = 189 (struct acpi_srat_mem_affinity *)header; 190 pr_debug("SRAT Memory (0x%llx length 0x%llx) in proximity domain %d %s%s%s\n", 191 (unsigned long long)p->base_address, 192 (unsigned long long)p->length, 193 p->proximity_domain, 194 (p->flags & ACPI_SRAT_MEM_ENABLED) ? 195 "enabled" : "disabled", 196 (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) ? 197 " hot-pluggable" : "", 198 (p->flags & ACPI_SRAT_MEM_NON_VOLATILE) ? 199 " non-volatile" : ""); 200 } 201 break; 202 203 case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: 204 { 205 struct acpi_srat_x2apic_cpu_affinity *p = 206 (struct acpi_srat_x2apic_cpu_affinity *)header; 207 pr_debug("SRAT Processor (x2apicid[0x%08x]) in proximity domain %d %s\n", 208 p->apic_id, 209 p->proximity_domain, 210 (p->flags & ACPI_SRAT_CPU_ENABLED) ? 211 "enabled" : "disabled"); 212 } 213 break; 214 215 case ACPI_SRAT_TYPE_GICC_AFFINITY: 216 { 217 struct acpi_srat_gicc_affinity *p = 218 (struct acpi_srat_gicc_affinity *)header; 219 pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n", 220 p->acpi_processor_uid, 221 p->proximity_domain, 222 (p->flags & ACPI_SRAT_GICC_ENABLED) ? 223 "enabled" : "disabled"); 224 } 225 break; 226 227 case ACPI_SRAT_TYPE_GENERIC_AFFINITY: 228 { 229 struct acpi_srat_generic_affinity *p = 230 (struct acpi_srat_generic_affinity *)header; 231 232 if (p->device_handle_type == 0) { 233 /* 234 * For pci devices this may be the only place they 235 * are assigned a proximity domain 236 */ 237 pr_debug("SRAT Generic Initiator(Seg:%u BDF:%u) in proximity domain %d %s\n", 238 *(u16 *)(&p->device_handle[0]), 239 *(u16 *)(&p->device_handle[2]), 240 p->proximity_domain, 241 (p->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED) ? 242 "enabled" : "disabled"); 243 } else { 244 /* 245 * In this case we can rely on the device having a 246 * proximity domain reference 247 */ 248 pr_debug("SRAT Generic Initiator(HID=%.8s UID=%.4s) in proximity domain %d %s\n", 249 (char *)(&p->device_handle[0]), 250 (char *)(&p->device_handle[8]), 251 p->proximity_domain, 252 (p->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED) ? 253 "enabled" : "disabled"); 254 } 255 } 256 break; 257 258 case ACPI_SRAT_TYPE_RINTC_AFFINITY: 259 { 260 struct acpi_srat_rintc_affinity *p = 261 (struct acpi_srat_rintc_affinity *)header; 262 pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n", 263 p->acpi_processor_uid, 264 p->proximity_domain, 265 (p->flags & ACPI_SRAT_RINTC_ENABLED) ? 266 "enabled" : "disabled"); 267 } 268 break; 269 270 default: 271 pr_warn("Found unsupported SRAT entry (type = 0x%x)\n", 272 header->type); 273 break; 274 } 275 } 276 277 /* 278 * A lot of BIOS fill in 10 (= no distance) everywhere. This messes 279 * up the NUMA heuristics which wants the local node to have a smaller 280 * distance than the others. 281 * Do some quick checks here and only use the SLIT if it passes. 282 */ 283 static int __init slit_valid(struct acpi_table_slit *slit) 284 { 285 int i, j; 286 int d = slit->locality_count; 287 for (i = 0; i < d; i++) { 288 for (j = 0; j < d; j++) { 289 u8 val = slit->entry[d*i + j]; 290 if (i == j) { 291 if (val != LOCAL_DISTANCE) 292 return 0; 293 } else if (val <= LOCAL_DISTANCE) 294 return 0; 295 } 296 } 297 return 1; 298 } 299 300 void __init bad_srat(void) 301 { 302 pr_err("SRAT: SRAT not used.\n"); 303 disable_srat(); 304 } 305 306 int __init srat_disabled(void) 307 { 308 return acpi_numa < 0; 309 } 310 311 __weak int __init numa_fill_memblks(u64 start, u64 end) 312 { 313 return NUMA_NO_MEMBLK; 314 } 315 316 /* 317 * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for 318 * I/O localities since SRAT does not list them. I/O localities are 319 * not supported at this point. 320 */ 321 static int __init acpi_parse_slit(struct acpi_table_header *table) 322 { 323 struct acpi_table_slit *slit = (struct acpi_table_slit *)table; 324 int i, j; 325 326 if (!slit_valid(slit)) { 327 pr_info("SLIT table looks invalid. Not used.\n"); 328 return -EINVAL; 329 } 330 331 for (i = 0; i < slit->locality_count; i++) { 332 const int from_node = pxm_to_node(i); 333 334 if (from_node == NUMA_NO_NODE) 335 continue; 336 337 for (j = 0; j < slit->locality_count; j++) { 338 const int to_node = pxm_to_node(j); 339 340 if (to_node == NUMA_NO_NODE) 341 continue; 342 343 numa_set_distance(from_node, to_node, 344 slit->entry[slit->locality_count * i + j]); 345 } 346 } 347 348 return 0; 349 } 350 351 static int parsed_numa_memblks __initdata; 352 353 static int __init 354 acpi_parse_memory_affinity(union acpi_subtable_headers *header, 355 const unsigned long table_end) 356 { 357 struct acpi_srat_mem_affinity *ma; 358 u64 start, end; 359 u32 hotpluggable; 360 int node, pxm; 361 362 ma = (struct acpi_srat_mem_affinity *)header; 363 364 acpi_table_print_srat_entry(&header->common); 365 366 if (srat_disabled()) 367 return 0; 368 if (ma->header.length < sizeof(struct acpi_srat_mem_affinity)) { 369 pr_err("SRAT: Unexpected header length: %d\n", 370 ma->header.length); 371 goto out_err_bad_srat; 372 } 373 if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) 374 return 0; 375 hotpluggable = IS_ENABLED(CONFIG_MEMORY_HOTPLUG) && 376 (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE); 377 378 start = ma->base_address; 379 end = start + ma->length; 380 pxm = ma->proximity_domain; 381 if (acpi_srat_revision <= 1) 382 pxm &= 0xff; 383 384 node = acpi_map_pxm_to_node(pxm); 385 if (node == NUMA_NO_NODE) { 386 pr_err("SRAT: Too many proximity domains.\n"); 387 goto out_err_bad_srat; 388 } 389 390 if (numa_add_memblk(node, start, end) < 0) { 391 pr_err("SRAT: Failed to add memblk to node %u [mem %#010Lx-%#010Lx]\n", 392 node, (unsigned long long) start, 393 (unsigned long long) end - 1); 394 goto out_err_bad_srat; 395 } 396 397 node_set(node, numa_nodes_parsed); 398 399 pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n", 400 node, pxm, 401 (unsigned long long) start, (unsigned long long) end - 1, 402 hotpluggable ? " hotplug" : "", 403 ma->flags & ACPI_SRAT_MEM_NON_VOLATILE ? " non-volatile" : ""); 404 405 /* Mark hotplug range in memblock. */ 406 if (hotpluggable && memblock_mark_hotplug(start, ma->length)) 407 pr_warn("SRAT: Failed to mark hotplug range [mem %#010Lx-%#010Lx] in memblock\n", 408 (unsigned long long)start, (unsigned long long)end - 1); 409 410 max_possible_pfn = max(max_possible_pfn, PFN_UP(end - 1)); 411 412 parsed_numa_memblks++; 413 414 return 0; 415 416 out_err_bad_srat: 417 /* Just disable SRAT, but do not fail and ignore errors. */ 418 bad_srat(); 419 420 return 0; 421 } 422 423 static int __init acpi_parse_cfmws(union acpi_subtable_headers *header, 424 void *arg, const unsigned long table_end) 425 { 426 struct acpi_cedt_cfmws *cfmws; 427 int *fake_pxm = arg; 428 u64 start, end; 429 int node; 430 431 cfmws = (struct acpi_cedt_cfmws *)header; 432 start = cfmws->base_hpa; 433 end = cfmws->base_hpa + cfmws->window_size; 434 435 /* 436 * The SRAT may have already described NUMA details for all, 437 * or a portion of, this CFMWS HPA range. Extend the memblks 438 * found for any portion of the window to cover the entire 439 * window. 440 */ 441 if (!numa_fill_memblks(start, end)) 442 return 0; 443 444 /* No SRAT description. Create a new node. */ 445 node = acpi_map_pxm_to_node(*fake_pxm); 446 447 if (node == NUMA_NO_NODE) { 448 pr_err("ACPI NUMA: Too many proximity domains while processing CFMWS.\n"); 449 return -EINVAL; 450 } 451 452 if (numa_add_memblk(node, start, end) < 0) { 453 /* CXL driver must handle the NUMA_NO_NODE case */ 454 pr_warn("ACPI NUMA: Failed to add memblk for CFMWS node %d [mem %#llx-%#llx]\n", 455 node, start, end); 456 } 457 node_set(node, numa_nodes_parsed); 458 459 /* Set the next available fake_pxm value */ 460 (*fake_pxm)++; 461 return 0; 462 } 463 464 void __init __weak 465 acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) 466 { 467 pr_warn("Found unsupported x2apic [0x%08x] SRAT entry\n", pa->apic_id); 468 } 469 470 static int __init 471 acpi_parse_x2apic_affinity(union acpi_subtable_headers *header, 472 const unsigned long end) 473 { 474 struct acpi_srat_x2apic_cpu_affinity *processor_affinity; 475 476 processor_affinity = (struct acpi_srat_x2apic_cpu_affinity *)header; 477 478 acpi_table_print_srat_entry(&header->common); 479 480 /* let architecture-dependent part to do it */ 481 acpi_numa_x2apic_affinity_init(processor_affinity); 482 483 return 0; 484 } 485 486 static int __init 487 acpi_parse_processor_affinity(union acpi_subtable_headers *header, 488 const unsigned long end) 489 { 490 struct acpi_srat_cpu_affinity *processor_affinity; 491 492 processor_affinity = (struct acpi_srat_cpu_affinity *)header; 493 494 acpi_table_print_srat_entry(&header->common); 495 496 /* let architecture-dependent part to do it */ 497 acpi_numa_processor_affinity_init(processor_affinity); 498 499 return 0; 500 } 501 502 static int __init 503 acpi_parse_gicc_affinity(union acpi_subtable_headers *header, 504 const unsigned long end) 505 { 506 struct acpi_srat_gicc_affinity *processor_affinity; 507 508 processor_affinity = (struct acpi_srat_gicc_affinity *)header; 509 510 acpi_table_print_srat_entry(&header->common); 511 512 /* let architecture-dependent part to do it */ 513 acpi_numa_gicc_affinity_init(processor_affinity); 514 515 return 0; 516 } 517 518 #if defined(CONFIG_X86) || defined(CONFIG_ARM64) 519 static int __init 520 acpi_parse_gi_affinity(union acpi_subtable_headers *header, 521 const unsigned long end) 522 { 523 struct acpi_srat_generic_affinity *gi_affinity; 524 int node; 525 526 gi_affinity = (struct acpi_srat_generic_affinity *)header; 527 if (!gi_affinity) 528 return -EINVAL; 529 acpi_table_print_srat_entry(&header->common); 530 531 if (!(gi_affinity->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED)) 532 return -EINVAL; 533 534 node = acpi_map_pxm_to_node(gi_affinity->proximity_domain); 535 if (node == NUMA_NO_NODE) { 536 pr_err("SRAT: Too many proximity domains.\n"); 537 return -EINVAL; 538 } 539 node_set(node, numa_nodes_parsed); 540 node_set_state(node, N_GENERIC_INITIATOR); 541 542 return 0; 543 } 544 #else 545 static int __init 546 acpi_parse_gi_affinity(union acpi_subtable_headers *header, 547 const unsigned long end) 548 { 549 return 0; 550 } 551 #endif /* defined(CONFIG_X86) || defined (CONFIG_ARM64) */ 552 553 static int __init 554 acpi_parse_rintc_affinity(union acpi_subtable_headers *header, 555 const unsigned long end) 556 { 557 struct acpi_srat_rintc_affinity *rintc_affinity; 558 559 rintc_affinity = (struct acpi_srat_rintc_affinity *)header; 560 acpi_table_print_srat_entry(&header->common); 561 562 /* let architecture-dependent part to do it */ 563 acpi_numa_rintc_affinity_init(rintc_affinity); 564 565 return 0; 566 } 567 568 static int __init acpi_parse_srat(struct acpi_table_header *table) 569 { 570 struct acpi_table_srat *srat = (struct acpi_table_srat *)table; 571 572 acpi_srat_revision = srat->header.revision; 573 574 /* Real work done in acpi_table_parse_srat below. */ 575 576 return 0; 577 } 578 579 static int __init 580 acpi_table_parse_srat(enum acpi_srat_type id, 581 acpi_tbl_entry_handler handler, unsigned int max_entries) 582 { 583 return acpi_table_parse_entries(ACPI_SIG_SRAT, 584 sizeof(struct acpi_table_srat), id, 585 handler, max_entries); 586 } 587 588 int __init acpi_numa_init(void) 589 { 590 int i, fake_pxm, cnt = 0; 591 592 if (acpi_disabled) 593 return -EINVAL; 594 595 /* 596 * Should not limit number with cpu num that is from NR_CPUS or nr_cpus= 597 * SRAT cpu entries could have different order with that in MADT. 598 * So go over all cpu entries in SRAT to get apicid to node mapping. 599 */ 600 601 /* SRAT: System Resource Affinity Table */ 602 if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { 603 struct acpi_subtable_proc srat_proc[5]; 604 605 memset(srat_proc, 0, sizeof(srat_proc)); 606 srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY; 607 srat_proc[0].handler = acpi_parse_processor_affinity; 608 srat_proc[1].id = ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY; 609 srat_proc[1].handler = acpi_parse_x2apic_affinity; 610 srat_proc[2].id = ACPI_SRAT_TYPE_GICC_AFFINITY; 611 srat_proc[2].handler = acpi_parse_gicc_affinity; 612 srat_proc[3].id = ACPI_SRAT_TYPE_GENERIC_AFFINITY; 613 srat_proc[3].handler = acpi_parse_gi_affinity; 614 srat_proc[4].id = ACPI_SRAT_TYPE_RINTC_AFFINITY; 615 srat_proc[4].handler = acpi_parse_rintc_affinity; 616 617 acpi_table_parse_entries_array(ACPI_SIG_SRAT, 618 sizeof(struct acpi_table_srat), 619 srat_proc, ARRAY_SIZE(srat_proc), 0); 620 621 cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, 622 acpi_parse_memory_affinity, 0); 623 } 624 625 /* SLIT: System Locality Information Table */ 626 acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit); 627 628 /* 629 * CXL Fixed Memory Window Structures (CFMWS) must be parsed 630 * after the SRAT. Create NUMA Nodes for CXL memory ranges that 631 * are defined in the CFMWS and not already defined in the SRAT. 632 * Initialize a fake_pxm as the first available PXM to emulate. 633 */ 634 635 /* fake_pxm is the next unused PXM value after SRAT parsing */ 636 for (i = 0, fake_pxm = -1; i < MAX_NUMNODES; i++) { 637 if (node_to_pxm_map[i] > fake_pxm) 638 fake_pxm = node_to_pxm_map[i]; 639 } 640 last_real_pxm = fake_pxm; 641 fake_pxm++; 642 acpi_table_parse_cedt(ACPI_CEDT_TYPE_CFMWS, acpi_parse_cfmws, 643 &fake_pxm); 644 645 if (cnt < 0) 646 return cnt; 647 else if (!parsed_numa_memblks) 648 return -ENOENT; 649 return 0; 650 } 651 652 bool acpi_node_backed_by_real_pxm(int nid) 653 { 654 int pxm = node_to_pxm(nid); 655 656 return pxm <= last_real_pxm; 657 } 658 EXPORT_SYMBOL_GPL(acpi_node_backed_by_real_pxm); 659 660 static int acpi_get_pxm(acpi_handle h) 661 { 662 unsigned long long pxm; 663 acpi_status status; 664 acpi_handle handle; 665 acpi_handle phandle = h; 666 667 do { 668 handle = phandle; 669 status = acpi_evaluate_integer(handle, "_PXM", NULL, &pxm); 670 if (ACPI_SUCCESS(status)) 671 return pxm; 672 status = acpi_get_parent(handle, &phandle); 673 } while (ACPI_SUCCESS(status)); 674 return -1; 675 } 676 677 int acpi_get_node(acpi_handle handle) 678 { 679 int pxm; 680 681 pxm = acpi_get_pxm(handle); 682 683 return pxm_to_node(pxm); 684 } 685 EXPORT_SYMBOL(acpi_get_node); 686