diff options
| author | Yasunori Goto <y-goto@jp.fujitsu.com> | 2006-06-23 05:03:19 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:42:48 -0400 |
| commit | 762834e8bf46bf41ce9034d062a7c1f8563175f3 (patch) | |
| tree | fb134ef41772ba61050a08cc4ed92c50cd057658 | |
| parent | d6277db4ab271862ed599da08d78961c70f00002 (diff) | |
[PATCH] Unify pxm_to_node() and node_to_pxm()
Consolidate the various arch-specific implementations of pxm_to_node() and
node_to_pxm() into a single generic version.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Andi Kleen <ak@muc.de>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: "Brown, Len" <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | arch/i386/Kconfig | 6 | ||||
| -rw-r--r-- | arch/i386/kernel/srat.c | 19 | ||||
| -rw-r--r-- | arch/ia64/hp/common/sba_iommu.c | 2 | ||||
| -rw-r--r-- | arch/ia64/kernel/acpi.c | 24 | ||||
| -rw-r--r-- | arch/ia64/pci/pci.c | 2 | ||||
| -rw-r--r-- | arch/ia64/sn/kernel/setup.c | 4 | ||||
| -rw-r--r-- | arch/x86_64/mm/srat.c | 33 | ||||
| -rw-r--r-- | drivers/acpi/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/acpi/numa.c | 48 | ||||
| -rw-r--r-- | include/acpi/acpi_numa.h | 23 | ||||
| -rw-r--r-- | include/asm-x86_64/numa.h | 1 | ||||
| -rw-r--r-- | include/linux/acpi.h | 9 |
12 files changed, 102 insertions, 71 deletions
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 8dfa3054f10f..15d23da2455f 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
| @@ -173,6 +173,12 @@ config ACPI_SRAT | |||
| 173 | bool | 173 | bool |
| 174 | default y | 174 | default y |
| 175 | depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) | 175 | depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) |
| 176 | select ACPI_NUMA | ||
| 177 | |||
| 178 | config HAVE_ARCH_PARSE_SRAT | ||
| 179 | bool | ||
| 180 | default y | ||
| 181 | depends on ACPI_SRAT | ||
| 176 | 182 | ||
| 177 | config X86_SUMMIT_NUMA | 183 | config X86_SUMMIT_NUMA |
| 178 | bool | 184 | bool |
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c index 52b3ed5d2cb5..989c85255dbe 100644 --- a/arch/i386/kernel/srat.c +++ b/arch/i386/kernel/srat.c | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | #define NODE_ARRAY_OFFSET(x) ((x) % 8) /* 8 bits/char */ | 39 | #define NODE_ARRAY_OFFSET(x) ((x) % 8) /* 8 bits/char */ |
| 40 | #define BMAP_SET(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] |= 1 << NODE_ARRAY_OFFSET(bit)) | 40 | #define BMAP_SET(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] |= 1 << NODE_ARRAY_OFFSET(bit)) |
| 41 | #define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit))) | 41 | #define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit))) |
| 42 | #define MAX_PXM_DOMAINS 256 /* 1 byte and no promises about values */ | ||
| 43 | /* bitmap length; _PXM is at most 255 */ | 42 | /* bitmap length; _PXM is at most 255 */ |
| 44 | #define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8) | 43 | #define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8) |
| 45 | static u8 pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */ | 44 | static u8 pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */ |
| @@ -213,19 +212,11 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c | |||
| 213 | node_end_pfn[nid] = memory_chunk->end_pfn; | 212 | node_end_pfn[nid] = memory_chunk->end_pfn; |
| 214 | } | 213 | } |
| 215 | 214 | ||
| 216 | static u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */ | ||
| 217 | |||
| 218 | int pxm_to_node(int pxm) | ||
| 219 | { | ||
| 220 | return pxm_to_nid_map[pxm]; | ||
| 221 | } | ||
| 222 | |||
| 223 | /* Parse the ACPI Static Resource Affinity Table */ | 215 | /* Parse the ACPI Static Resource Affinity Table */ |
| 224 | static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | 216 | static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) |
| 225 | { | 217 | { |
| 226 | u8 *start, *end, *p; | 218 | u8 *start, *end, *p; |
| 227 | int i, j, nid; | 219 | int i, j, nid; |
| 228 | u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */ | ||
| 229 | 220 | ||
| 230 | start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ | 221 | start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ |
| 231 | p = start; | 222 | p = start; |
| @@ -235,10 +226,6 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | |||
| 235 | memset(node_memory_chunk, 0, sizeof(node_memory_chunk)); | 226 | memset(node_memory_chunk, 0, sizeof(node_memory_chunk)); |
| 236 | memset(zholes_size, 0, sizeof(zholes_size)); | 227 | memset(zholes_size, 0, sizeof(zholes_size)); |
| 237 | 228 | ||
| 238 | /* -1 in these maps means not available */ | ||
| 239 | memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map)); | ||
| 240 | memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map)); | ||
| 241 | |||
| 242 | num_memory_chunks = 0; | 229 | num_memory_chunks = 0; |
| 243 | while (p < end) { | 230 | while (p < end) { |
| 244 | switch (*p) { | 231 | switch (*p) { |
| @@ -278,9 +265,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | |||
| 278 | nodes_clear(node_online_map); | 265 | nodes_clear(node_online_map); |
| 279 | for (i = 0; i < MAX_PXM_DOMAINS; i++) { | 266 | for (i = 0; i < MAX_PXM_DOMAINS; i++) { |
| 280 | if (BMAP_TEST(pxm_bitmap, i)) { | 267 | if (BMAP_TEST(pxm_bitmap, i)) { |
| 281 | nid = num_online_nodes(); | 268 | int nid = acpi_map_pxm_to_node(i); |
| 282 | pxm_to_nid_map[i] = nid; | ||
| 283 | nid_to_pxm_map[nid] = i; | ||
| 284 | node_set_online(nid); | 269 | node_set_online(nid); |
| 285 | } | 270 | } |
| 286 | } | 271 | } |
| @@ -288,7 +273,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | |||
| 288 | 273 | ||
| 289 | /* set cnode id in memory chunk structure */ | 274 | /* set cnode id in memory chunk structure */ |
| 290 | for (i = 0; i < num_memory_chunks; i++) | 275 | for (i = 0; i < num_memory_chunks; i++) |
| 291 | node_memory_chunk[i].nid = pxm_to_nid_map[node_memory_chunk[i].pxm]; | 276 | node_memory_chunk[i].nid = pxm_to_node(node_memory_chunk[i].pxm); |
| 292 | 277 | ||
| 293 | printk("pxm bitmap: "); | 278 | printk("pxm bitmap: "); |
| 294 | for (i = 0; i < sizeof(pxm_bitmap); i++) { | 279 | for (i = 0; i < sizeof(pxm_bitmap); i++) { |
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index bdccd0b1eb60..3ce443e6c016 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
| @@ -1958,7 +1958,7 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) | |||
| 1958 | if (pxm < 0) | 1958 | if (pxm < 0) |
| 1959 | return; | 1959 | return; |
| 1960 | 1960 | ||
| 1961 | node = pxm_to_nid_map[pxm]; | 1961 | node = pxm_to_node(pxm); |
| 1962 | 1962 | ||
| 1963 | if (node >= MAX_NUMNODES || !node_online(node)) | 1963 | if (node >= MAX_NUMNODES || !node_online(node)) |
| 1964 | return; | 1964 | return; |
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 58c93a30348c..d1c52cf67882 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
| @@ -415,9 +415,6 @@ static int __initdata srat_num_cpus; /* number of cpus */ | |||
| 415 | static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; | 415 | static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; |
| 416 | #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) | 416 | #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) |
| 417 | #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) | 417 | #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) |
| 418 | /* maps to convert between proximity domain and logical node ID */ | ||
| 419 | int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS]; | ||
| 420 | int __initdata nid_to_pxm_map[MAX_NUMNODES]; | ||
| 421 | static struct acpi_table_slit __initdata *slit_table; | 418 | static struct acpi_table_slit __initdata *slit_table; |
| 422 | 419 | ||
| 423 | static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa) | 420 | static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa) |
| @@ -533,22 +530,17 @@ void __init acpi_numa_arch_fixup(void) | |||
| 533 | * MCD - This can probably be dropped now. No need for pxm ID to node ID | 530 | * MCD - This can probably be dropped now. No need for pxm ID to node ID |
| 534 | * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES. | 531 | * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES. |
| 535 | */ | 532 | */ |
| 536 | /* calculate total number of nodes in system from PXM bitmap */ | ||
| 537 | memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map)); | ||
| 538 | memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map)); | ||
| 539 | nodes_clear(node_online_map); | 533 | nodes_clear(node_online_map); |
| 540 | for (i = 0; i < MAX_PXM_DOMAINS; i++) { | 534 | for (i = 0; i < MAX_PXM_DOMAINS; i++) { |
| 541 | if (pxm_bit_test(i)) { | 535 | if (pxm_bit_test(i)) { |
| 542 | int nid = num_online_nodes(); | 536 | int nid = acpi_map_pxm_to_node(i); |
| 543 | pxm_to_nid_map[i] = nid; | ||
| 544 | nid_to_pxm_map[nid] = i; | ||
| 545 | node_set_online(nid); | 537 | node_set_online(nid); |
| 546 | } | 538 | } |
| 547 | } | 539 | } |
| 548 | 540 | ||
| 549 | /* set logical node id in memory chunk structure */ | 541 | /* set logical node id in memory chunk structure */ |
| 550 | for (i = 0; i < num_node_memblks; i++) | 542 | for (i = 0; i < num_node_memblks; i++) |
| 551 | node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid]; | 543 | node_memblk[i].nid = pxm_to_node(node_memblk[i].nid); |
| 552 | 544 | ||
| 553 | /* assign memory bank numbers for each chunk on each node */ | 545 | /* assign memory bank numbers for each chunk on each node */ |
| 554 | for_each_online_node(i) { | 546 | for_each_online_node(i) { |
| @@ -562,7 +554,7 @@ void __init acpi_numa_arch_fixup(void) | |||
| 562 | 554 | ||
| 563 | /* set logical node id in cpu structure */ | 555 | /* set logical node id in cpu structure */ |
| 564 | for (i = 0; i < srat_num_cpus; i++) | 556 | for (i = 0; i < srat_num_cpus; i++) |
| 565 | node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid]; | 557 | node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid); |
| 566 | 558 | ||
| 567 | printk(KERN_INFO "Number of logical nodes in system = %d\n", | 559 | printk(KERN_INFO "Number of logical nodes in system = %d\n", |
| 568 | num_online_nodes()); | 560 | num_online_nodes()); |
| @@ -575,11 +567,11 @@ void __init acpi_numa_arch_fixup(void) | |||
| 575 | for (i = 0; i < slit_table->localities; i++) { | 567 | for (i = 0; i < slit_table->localities; i++) { |
| 576 | if (!pxm_bit_test(i)) | 568 | if (!pxm_bit_test(i)) |
| 577 | continue; | 569 | continue; |
| 578 | node_from = pxm_to_nid_map[i]; | 570 | node_from = pxm_to_node(i); |
| 579 | for (j = 0; j < slit_table->localities; j++) { | 571 | for (j = 0; j < slit_table->localities; j++) { |
| 580 | if (!pxm_bit_test(j)) | 572 | if (!pxm_bit_test(j)) |
| 581 | continue; | 573 | continue; |
| 582 | node_to = pxm_to_nid_map[j]; | 574 | node_to = pxm_to_node(j); |
| 583 | node_distance(node_from, node_to) = | 575 | node_distance(node_from, node_to) = |
| 584 | slit_table->entry[i * slit_table->localities + j]; | 576 | slit_table->entry[i * slit_table->localities + j]; |
| 585 | } | 577 | } |
| @@ -785,9 +777,9 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid) | |||
| 785 | 777 | ||
| 786 | /* | 778 | /* |
| 787 | * Assuming that the container driver would have set the proximity | 779 | * Assuming that the container driver would have set the proximity |
| 788 | * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag | 780 | * domain and would have initialized pxm_to_node(pxm_id) && pxm_flag |
| 789 | */ | 781 | */ |
| 790 | node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id]; | 782 | node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_node(pxm_id); |
| 791 | 783 | ||
| 792 | node_cpuid[cpu].phys_id = physid; | 784 | node_cpuid[cpu].phys_id = physid; |
| 793 | #endif | 785 | #endif |
| @@ -966,7 +958,7 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret) | |||
| 966 | if (pxm < 0) | 958 | if (pxm < 0) |
| 967 | return AE_OK; | 959 | return AE_OK; |
| 968 | 960 | ||
| 969 | node = pxm_to_nid_map[pxm]; | 961 | node = pxm_to_node(pxm); |
| 970 | 962 | ||
| 971 | if (node >= MAX_NUMNODES || !node_online(node) || | 963 | if (node >= MAX_NUMNODES || !node_online(node) || |
| 972 | cpus_empty(node_to_cpumask(node))) | 964 | cpus_empty(node_to_cpumask(node))) |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index ab829a22f8a4..cf7751b99d1c 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
| @@ -352,7 +352,7 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus) | |||
| 352 | pxm = acpi_get_pxm(controller->acpi_handle); | 352 | pxm = acpi_get_pxm(controller->acpi_handle); |
| 353 | #ifdef CONFIG_NUMA | 353 | #ifdef CONFIG_NUMA |
| 354 | if (pxm >= 0) | 354 | if (pxm >= 0) |
| 355 | controller->node = pxm_to_nid_map[pxm]; | 355 | controller->node = pxm_to_node(pxm); |
| 356 | #endif | 356 | #endif |
| 357 | 357 | ||
| 358 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, | 358 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, |
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c index 30988dfbddff..93577abae36d 100644 --- a/arch/ia64/sn/kernel/setup.c +++ b/arch/ia64/sn/kernel/setup.c | |||
| @@ -139,7 +139,7 @@ static int __init pxm_to_nasid(int pxm) | |||
| 139 | int i; | 139 | int i; |
| 140 | int nid; | 140 | int nid; |
| 141 | 141 | ||
| 142 | nid = pxm_to_nid_map[pxm]; | 142 | nid = pxm_to_node(pxm); |
| 143 | for (i = 0; i < num_node_memblks; i++) { | 143 | for (i = 0; i < num_node_memblks; i++) { |
| 144 | if (node_memblk[i].nid == nid) { | 144 | if (node_memblk[i].nid == nid) { |
| 145 | return NASID_GET(node_memblk[i].start_paddr); | 145 | return NASID_GET(node_memblk[i].start_paddr); |
| @@ -704,7 +704,7 @@ void __init build_cnode_tables(void) | |||
| 704 | * cnode == node for all C & M bricks. | 704 | * cnode == node for all C & M bricks. |
| 705 | */ | 705 | */ |
| 706 | for_each_online_node(node) { | 706 | for_each_online_node(node) { |
| 707 | nasid = pxm_to_nasid(nid_to_pxm_map[node]); | 707 | nasid = pxm_to_nasid(node_to_pxm(node)); |
| 708 | sn_cnodeid_to_nasid[node] = nasid; | 708 | sn_cnodeid_to_nasid[node] = nasid; |
| 709 | physical_node_map[nasid] = node; | 709 | physical_node_map[nasid] = node; |
| 710 | } | 710 | } |
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c index 474df22c6ed2..502fce65e96a 100644 --- a/arch/x86_64/mm/srat.c +++ b/arch/x86_64/mm/srat.c | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | static struct acpi_table_slit *acpi_slit; | 30 | static struct acpi_table_slit *acpi_slit; |
| 31 | 31 | ||
| 32 | static nodemask_t nodes_parsed __initdata; | 32 | static nodemask_t nodes_parsed __initdata; |
| 33 | static nodemask_t nodes_found __initdata; | ||
| 34 | static struct bootnode nodes[MAX_NUMNODES] __initdata; | 33 | static struct bootnode nodes[MAX_NUMNODES] __initdata; |
| 35 | static struct bootnode nodes_add[MAX_NUMNODES] __initdata; | 34 | static struct bootnode nodes_add[MAX_NUMNODES] __initdata; |
| 36 | static int found_add_area __initdata; | 35 | static int found_add_area __initdata; |
| @@ -38,33 +37,14 @@ int hotadd_percent __initdata = 0; | |||
| 38 | #ifndef RESERVE_HOTADD | 37 | #ifndef RESERVE_HOTADD |
| 39 | #define hotadd_percent 0 /* Ignore all settings */ | 38 | #define hotadd_percent 0 /* Ignore all settings */ |
| 40 | #endif | 39 | #endif |
| 41 | static u8 pxm2node[256] = { [0 ... 255] = 0xff }; | ||
| 42 | 40 | ||
| 43 | /* Too small nodes confuse the VM badly. Usually they result | 41 | /* Too small nodes confuse the VM badly. Usually they result |
| 44 | from BIOS bugs. */ | 42 | from BIOS bugs. */ |
| 45 | #define NODE_MIN_SIZE (4*1024*1024) | 43 | #define NODE_MIN_SIZE (4*1024*1024) |
| 46 | 44 | ||
| 47 | static int node_to_pxm(int n); | ||
| 48 | |||
| 49 | int pxm_to_node(int pxm) | ||
| 50 | { | ||
| 51 | if ((unsigned)pxm >= 256) | ||
| 52 | return -1; | ||
| 53 | /* Extend 0xff to (int)-1 */ | ||
| 54 | return (signed char)pxm2node[pxm]; | ||
| 55 | } | ||
| 56 | |||
| 57 | static __init int setup_node(int pxm) | 45 | static __init int setup_node(int pxm) |
| 58 | { | 46 | { |
| 59 | unsigned node = pxm2node[pxm]; | 47 | return acpi_map_pxm_to_node(pxm); |
| 60 | if (node == 0xff) { | ||
| 61 | if (nodes_weight(nodes_found) >= MAX_NUMNODES) | ||
| 62 | return -1; | ||
| 63 | node = first_unset_node(nodes_found); | ||
| 64 | node_set(node, nodes_found); | ||
| 65 | pxm2node[pxm] = node; | ||
| 66 | } | ||
| 67 | return pxm2node[pxm]; | ||
| 68 | } | 48 | } |
| 69 | 49 | ||
| 70 | static __init int conflicting_nodes(unsigned long start, unsigned long end) | 50 | static __init int conflicting_nodes(unsigned long start, unsigned long end) |
| @@ -440,17 +420,6 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
| 440 | return 0; | 420 | return 0; |
| 441 | } | 421 | } |
| 442 | 422 | ||
| 443 | static int node_to_pxm(int n) | ||
| 444 | { | ||
| 445 | int i; | ||
| 446 | if (pxm2node[n] == n) | ||
| 447 | return n; | ||
| 448 | for (i = 0; i < 256; i++) | ||
| 449 | if (pxm2node[i] == n) | ||
| 450 | return i; | ||
| 451 | return 0; | ||
| 452 | } | ||
| 453 | |||
| 454 | void __init srat_reserve_add_area(int nodeid) | 423 | void __init srat_reserve_add_area(int nodeid) |
| 455 | { | 424 | { |
| 456 | if (found_add_area && nodes_add[nodeid].end) { | 425 | if (found_add_area && nodes_add[nodeid].end) { |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index c24652d31bf9..230c53852231 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -162,7 +162,7 @@ config ACPI_THERMAL | |||
| 162 | config ACPI_NUMA | 162 | config ACPI_NUMA |
| 163 | bool "NUMA support" | 163 | bool "NUMA support" |
| 164 | depends on NUMA | 164 | depends on NUMA |
| 165 | depends on (IA64 || X86_64) | 165 | depends on (X86 || IA64) |
| 166 | default y if IA64_GENERIC || IA64_SGI_SN2 | 166 | default y if IA64_GENERIC || IA64_SGI_SN2 |
| 167 | 167 | ||
| 168 | config ACPI_ASUS | 168 | config ACPI_ASUS |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 64b98e82feb7..e2c1a16078c9 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
| @@ -36,12 +36,60 @@ | |||
| 36 | #define _COMPONENT ACPI_NUMA | 36 | #define _COMPONENT ACPI_NUMA |
| 37 | ACPI_MODULE_NAME("numa") | 37 | ACPI_MODULE_NAME("numa") |
| 38 | 38 | ||
| 39 | static nodemask_t nodes_found_map = NODE_MASK_NONE; | ||
| 40 | #define PXM_INVAL -1 | ||
| 41 | #define NID_INVAL -1 | ||
| 42 | |||
| 43 | /* maps to convert between proximity domain and logical node ID */ | ||
| 44 | int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS] | ||
| 45 | = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL }; | ||
| 46 | int __cpuinitdata node_to_pxm_map[MAX_NUMNODES] | ||
| 47 | = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; | ||
| 48 | |||
| 39 | extern int __init acpi_table_parse_madt_family(enum acpi_table_id id, | 49 | extern int __init acpi_table_parse_madt_family(enum acpi_table_id id, |
| 40 | unsigned long madt_size, | 50 | unsigned long madt_size, |
| 41 | int entry_id, | 51 | int entry_id, |
| 42 | acpi_madt_entry_handler handler, | 52 | acpi_madt_entry_handler handler, |
| 43 | unsigned int max_entries); | 53 | unsigned int max_entries); |
| 44 | 54 | ||
| 55 | int __cpuinit pxm_to_node(int pxm) | ||
| 56 | { | ||
| 57 | if (pxm < 0) | ||
| 58 | return NID_INVAL; | ||
| 59 | return pxm_to_node_map[pxm]; | ||
| 60 | } | ||
| 61 | |||
| 62 | int __cpuinit node_to_pxm(int node) | ||
| 63 | { | ||
| 64 | if (node < 0) | ||
| 65 | return PXM_INVAL; | ||
| 66 | return node_to_pxm_map[node]; | ||
| 67 | } | ||
| 68 | |||
| 69 | int __cpuinit acpi_map_pxm_to_node(int pxm) | ||
| 70 | { | ||
| 71 | int node = pxm_to_node_map[pxm]; | ||
| 72 | |||
| 73 | if (node < 0){ | ||
| 74 | if (nodes_weight(nodes_found_map) >= MAX_NUMNODES) | ||
| 75 | return NID_INVAL; | ||
| 76 | node = first_unset_node(nodes_found_map); | ||
| 77 | pxm_to_node_map[pxm] = node; | ||
| 78 | node_to_pxm_map[node] = pxm; | ||
| 79 | node_set(node, nodes_found_map); | ||
| 80 | } | ||
| 81 | |||
| 82 | return node; | ||
| 83 | } | ||
| 84 | |||
| 85 | void __cpuinit acpi_unmap_pxm_to_node(int node) | ||
| 86 | { | ||
| 87 | int pxm = node_to_pxm_map[node]; | ||
| 88 | pxm_to_node_map[pxm] = NID_INVAL; | ||
| 89 | node_to_pxm_map[node] = PXM_INVAL; | ||
| 90 | node_clear(node, nodes_found_map); | ||
| 91 | } | ||
| 92 | |||
| 45 | void __init acpi_table_print_srat_entry(acpi_table_entry_header * header) | 93 | void __init acpi_table_print_srat_entry(acpi_table_entry_header * header) |
| 46 | { | 94 | { |
| 47 | 95 | ||
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h new file mode 100644 index 000000000000..1049f2a0a6db --- /dev/null +++ b/include/acpi/acpi_numa.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #ifndef __ACPI_NUMA_H | ||
| 2 | #define __ACPI_NUMA_H | ||
| 3 | |||
| 4 | #ifdef CONFIG_ACPI_NUMA | ||
| 5 | #include <linux/kernel.h> | ||
| 6 | |||
| 7 | /* Proximity bitmap length */ | ||
| 8 | #if MAX_NUMNODES > 256 | ||
| 9 | #define MAX_PXM_DOMAINS MAX_NUMNODES | ||
| 10 | #else | ||
| 11 | #define MAX_PXM_DOMAINS (256) /* Old pxm spec is defined 8 bit */ | ||
| 12 | #endif | ||
| 13 | |||
| 14 | extern int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS]; | ||
| 15 | extern int __cpuinitdata node_to_pxm_map[MAX_NUMNODES]; | ||
| 16 | |||
| 17 | extern int __cpuinit pxm_to_node(int); | ||
| 18 | extern int __cpuinit node_to_pxm(int); | ||
| 19 | extern int __cpuinit acpi_map_pxm_to_node(int); | ||
| 20 | extern void __cpuinit acpi_unmap_pxm_to_node(int); | ||
| 21 | |||
| 22 | #endif /* CONFIG_ACPI_NUMA */ | ||
| 23 | #endif /* __ACP_NUMA_H */ | ||
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h index 1cc92fe02503..933ff11ece15 100644 --- a/include/asm-x86_64/numa.h +++ b/include/asm-x86_64/numa.h | |||
| @@ -8,7 +8,6 @@ struct bootnode { | |||
| 8 | }; | 8 | }; |
| 9 | 9 | ||
| 10 | extern int compute_hash_shift(struct bootnode *nodes, int numnodes); | 10 | extern int compute_hash_shift(struct bootnode *nodes, int numnodes); |
| 11 | extern int pxm_to_node(int nid); | ||
| 12 | 11 | ||
| 13 | #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) | 12 | #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) |
| 14 | 13 | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 1cf0b91d05bd..90d6df1551ed 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <acpi/acpi.h> | 37 | #include <acpi/acpi.h> |
| 38 | #include <acpi/acpi_bus.h> | 38 | #include <acpi/acpi_bus.h> |
| 39 | #include <acpi/acpi_drivers.h> | 39 | #include <acpi/acpi_drivers.h> |
| 40 | #include <acpi/acpi_numa.h> | ||
| 40 | #include <asm/acpi.h> | 41 | #include <asm/acpi.h> |
| 41 | 42 | ||
| 42 | 43 | ||
| @@ -407,10 +408,18 @@ void acpi_table_print_madt_entry (acpi_table_entry_header *madt); | |||
| 407 | void acpi_table_print_srat_entry (acpi_table_entry_header *srat); | 408 | void acpi_table_print_srat_entry (acpi_table_entry_header *srat); |
| 408 | 409 | ||
| 409 | /* the following four functions are architecture-dependent */ | 410 | /* the following four functions are architecture-dependent */ |
| 411 | #ifdef CONFIG_HAVE_ARCH_PARSE_SRAT | ||
| 412 | #define NR_NODE_MEMBLKS MAX_NUMNODES | ||
| 413 | #define acpi_numa_slit_init(slit) do {} while (0) | ||
| 414 | #define acpi_numa_processor_affinity_init(pa) do {} while (0) | ||
| 415 | #define acpi_numa_memory_affinity_init(ma) do {} while (0) | ||
| 416 | #define acpi_numa_arch_fixup() do {} while (0) | ||
| 417 | #else | ||
| 410 | void acpi_numa_slit_init (struct acpi_table_slit *slit); | 418 | void acpi_numa_slit_init (struct acpi_table_slit *slit); |
| 411 | void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa); | 419 | void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa); |
| 412 | void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma); | 420 | void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma); |
| 413 | void acpi_numa_arch_fixup(void); | 421 | void acpi_numa_arch_fixup(void); |
| 422 | #endif | ||
| 414 | 423 | ||
| 415 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | 424 | #ifdef CONFIG_ACPI_HOTPLUG_CPU |
| 416 | /* Arch dependent functions for cpu hotplug support */ | 425 | /* Arch dependent functions for cpu hotplug support */ |
