aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-02-03 13:45:03 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-02-03 13:45:03 -0500
commit17f2d86f5d53d61b12085812a650ae12a76eaa69 (patch)
tree13b86f9b6e2768db8a631b45b71e528200bad638
parent38dbfb59d1175ef458d006556061adeaa8751b72 (diff)
parentbeffbe54fa2df3a80d74f168c38e0248adbde082 (diff)
Merge branch 'pci/numa-cleanup' into next
* pci/numa-cleanup: ACPI / numa: Use __weak, not the gcc-specific version ACPI / numa: Make __acpi_map_pxm_to_node(), acpi_get_pxm() static ACPI / numa: Simplify acpi_get_node() style ACPI / numa: Fix acpi_get_node() prototype ia64: Remove acpi_get_pxm() usage ia64 / sba_iommu: Use NUMA_NO_NODE, not MAX_NUMNODES, for unknown node x86/PCI: Remove acpi_get_pxm() usage x86/PCI: Use NUMA_NO_NODE, not -1, for unknown node x86/PCI: Remove unnecessary list_empty(&pci_root_infos) check x86/PCI: Remove mp_bus_to_node[], set_mp_bus_to_node(), get_mp_bus_to_node() x86/PCI: Use x86_pci_root_bus_node() instead of get_mp_bus_to_node() x86/PCI: Add x86_pci_root_bus_node() to look up NUMA node from PCI bus x86/PCI: Drop return value of pcibios_scan_root() x86/PCI: Merge pci_scan_bus_on_node() into pcibios_scan_root() x86/PCI: Use pcibios_scan_root() instead of pci_scan_bus_on_node() x86/PCI: Use pcibios_scan_root() instead of pci_scan_bus_with_sysdata() x86/PCI: Drop pcibios_scan_root() check for bus already scanned
-rw-r--r--arch/ia64/hp/common/sba_iommu.c32
-rw-r--r--arch/ia64/include/asm/pci.h2
-rw-r--r--arch/ia64/kernel/acpi.c28
-rw-r--r--arch/ia64/pci/pci.c10
-rw-r--r--arch/x86/include/asm/pci.h7
-rw-r--r--arch/x86/include/asm/topology.h14
-rw-r--r--arch/x86/pci/acpi.c29
-rw-r--r--arch/x86/pci/amd_bus.c10
-rw-r--r--arch/x86/pci/bus_numa.c13
-rw-r--r--arch/x86/pci/common.c128
-rw-r--r--arch/x86/pci/fixup.c6
-rw-r--r--arch/x86/pci/irq.c6
-rw-r--r--arch/x86/pci/legacy.c4
-rw-r--r--arch/x86/pci/numaq_32.c6
-rw-r--r--arch/x86/pci/visws.c4
-rw-r--r--drivers/acpi/numa.c16
-rw-r--r--include/acpi/acpi_numa.h1
-rw-r--r--include/linux/acpi.h9
18 files changed, 75 insertions, 250 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 8e858b593e4f..007361d59aa6 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1140,11 +1140,13 @@ sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
1140 1140
1141#ifdef CONFIG_NUMA 1141#ifdef CONFIG_NUMA
1142 { 1142 {
1143 int node = ioc->node;
1143 struct page *page; 1144 struct page *page;
1144 page = alloc_pages_exact_node(ioc->node == MAX_NUMNODES ?
1145 numa_node_id() : ioc->node, flags,
1146 get_order(size));
1147 1145
1146 if (node == NUMA_NO_NODE)
1147 node = numa_node_id();
1148
1149 page = alloc_pages_exact_node(node, flags, get_order(size));
1148 if (unlikely(!page)) 1150 if (unlikely(!page))
1149 return NULL; 1151 return NULL;
1150 1152
@@ -1914,7 +1916,7 @@ ioc_show(struct seq_file *s, void *v)
1914 seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n", 1916 seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n",
1915 ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF)); 1917 ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF));
1916#ifdef CONFIG_NUMA 1918#ifdef CONFIG_NUMA
1917 if (ioc->node != MAX_NUMNODES) 1919 if (ioc->node != NUMA_NO_NODE)
1918 seq_printf(s, "NUMA node : %d\n", ioc->node); 1920 seq_printf(s, "NUMA node : %d\n", ioc->node);
1919#endif 1921#endif
1920 seq_printf(s, "IOVA size : %ld MB\n", ((ioc->pdir_size >> 3) * iovp_size)/(1024*1024)); 1922 seq_printf(s, "IOVA size : %ld MB\n", ((ioc->pdir_size >> 3) * iovp_size)/(1024*1024));
@@ -2015,31 +2017,19 @@ sba_connect_bus(struct pci_bus *bus)
2015 printk(KERN_WARNING "No IOC for PCI Bus %04x:%02x in ACPI\n", pci_domain_nr(bus), bus->number); 2017 printk(KERN_WARNING "No IOC for PCI Bus %04x:%02x in ACPI\n", pci_domain_nr(bus), bus->number);
2016} 2018}
2017 2019
2018#ifdef CONFIG_NUMA
2019static void __init 2020static void __init
2020sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) 2021sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
2021{ 2022{
2023#ifdef CONFIG_NUMA
2022 unsigned int node; 2024 unsigned int node;
2023 int pxm;
2024
2025 ioc->node = MAX_NUMNODES;
2026
2027 pxm = acpi_get_pxm(handle);
2028
2029 if (pxm < 0)
2030 return;
2031
2032 node = pxm_to_node(pxm);
2033 2025
2034 if (node >= MAX_NUMNODES || !node_online(node)) 2026 node = acpi_get_node(handle);
2035 return; 2027 if (node != NUMA_NO_NODE && !node_online(node))
2028 node = NUMA_NO_NODE;
2036 2029
2037 ioc->node = node; 2030 ioc->node = node;
2038 return;
2039}
2040#else
2041#define sba_map_ioc_to_node(ioc, handle)
2042#endif 2031#endif
2032}
2043 2033
2044static int __init 2034static int __init
2045acpi_sba_ioc_add(struct acpi_device *device, 2035acpi_sba_ioc_add(struct acpi_device *device,
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 71fbaaa495cc..7d41cc089822 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -98,7 +98,7 @@ struct pci_controller {
98 struct acpi_device *companion; 98 struct acpi_device *companion;
99 void *iommu; 99 void *iommu;
100 int segment; 100 int segment;
101 int node; /* nearest node with memory or -1 for global allocation */ 101 int node; /* nearest node with memory or NUMA_NO_NODE for global allocation */
102 102
103 void *platform_data; 103 void *platform_data;
104}; 104};
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 07d209c9507f..5a585ebe9df3 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -803,14 +803,9 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
803 * ACPI based hotplug CPU support 803 * ACPI based hotplug CPU support
804 */ 804 */
805#ifdef CONFIG_ACPI_HOTPLUG_CPU 805#ifdef CONFIG_ACPI_HOTPLUG_CPU
806static 806static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
807int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
808{ 807{
809#ifdef CONFIG_ACPI_NUMA 808#ifdef CONFIG_ACPI_NUMA
810 int pxm_id;
811 int nid;
812
813 pxm_id = acpi_get_pxm(handle);
814 /* 809 /*
815 * We don't have cpu-only-node hotadd. But if the system equips 810 * We don't have cpu-only-node hotadd. But if the system equips
816 * SRAT table, pxm is already found and node is ready. 811 * SRAT table, pxm is already found and node is ready.
@@ -818,11 +813,10 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
818 * This code here is for the system which doesn't have full SRAT 813 * This code here is for the system which doesn't have full SRAT
819 * table for possible cpus. 814 * table for possible cpus.
820 */ 815 */
821 nid = acpi_map_pxm_to_node(pxm_id);
822 node_cpuid[cpu].phys_id = physid; 816 node_cpuid[cpu].phys_id = physid;
823 node_cpuid[cpu].nid = nid; 817 node_cpuid[cpu].nid = acpi_get_node(handle);
824#endif 818#endif
825 return (0); 819 return 0;
826} 820}
827 821
828int additional_cpus __initdata = -1; 822int additional_cpus __initdata = -1;
@@ -929,7 +923,7 @@ static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth,
929 union acpi_object *obj; 923 union acpi_object *obj;
930 struct acpi_madt_io_sapic *iosapic; 924 struct acpi_madt_io_sapic *iosapic;
931 unsigned int gsi_base; 925 unsigned int gsi_base;
932 int pxm, node; 926 int node;
933 927
934 /* Only care about objects w/ a method that returns the MADT */ 928 /* Only care about objects w/ a method that returns the MADT */
935 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) 929 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
@@ -956,17 +950,9 @@ static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth,
956 950
957 kfree(buffer.pointer); 951 kfree(buffer.pointer);
958 952
959 /* 953 /* OK, it's an IOSAPIC MADT entry; associate it with a node */
960 * OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell 954 node = acpi_get_node(handle);
961 * us which node to associate this with. 955 if (node == NUMA_NO_NODE || !node_online(node) ||
962 */
963 pxm = acpi_get_pxm(handle);
964 if (pxm < 0)
965 return AE_OK;
966
967 node = pxm_to_node(pxm);
968
969 if (node >= MAX_NUMNODES || !node_online(node) ||
970 cpumask_empty(cpumask_of_node(node))) 956 cpumask_empty(cpumask_of_node(node)))
971 return AE_OK; 957 return AE_OK;
972 958
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 9e4938d8ca4d..291a582777cf 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -126,7 +126,6 @@ static struct pci_controller *alloc_pci_controller(int seg)
126 return NULL; 126 return NULL;
127 127
128 controller->segment = seg; 128 controller->segment = seg;
129 controller->node = -1;
130 return controller; 129 return controller;
131} 130}
132 131
@@ -430,19 +429,14 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
430 struct pci_root_info *info = NULL; 429 struct pci_root_info *info = NULL;
431 int busnum = root->secondary.start; 430 int busnum = root->secondary.start;
432 struct pci_bus *pbus; 431 struct pci_bus *pbus;
433 int pxm, ret; 432 int ret;
434 433
435 controller = alloc_pci_controller(domain); 434 controller = alloc_pci_controller(domain);
436 if (!controller) 435 if (!controller)
437 return NULL; 436 return NULL;
438 437
439 controller->companion = device; 438 controller->companion = device;
440 439 controller->node = acpi_get_node(device->handle);
441 pxm = acpi_get_pxm(device->handle);
442#ifdef CONFIG_NUMA
443 if (pxm >= 0)
444 controller->node = pxm_to_node(pxm);
445#endif
446 440
447 info = kzalloc(sizeof(*info), GFP_KERNEL); 441 info = kzalloc(sizeof(*info), GFP_KERNEL);
448 if (!info) { 442 if (!info) {
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 1ac6114c9ea5..96ae4f4040bb 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -26,11 +26,6 @@ extern int pci_routeirq;
26extern int noioapicquirk; 26extern int noioapicquirk;
27extern int noioapicreroute; 27extern int noioapicreroute;
28 28
29/* scan a bus after allocating a pci_sysdata for it */
30extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops,
31 int node);
32extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
33
34#ifdef CONFIG_PCI 29#ifdef CONFIG_PCI
35 30
36#ifdef CONFIG_PCI_DOMAINS 31#ifdef CONFIG_PCI_DOMAINS
@@ -70,7 +65,7 @@ extern unsigned long pci_mem_start;
70 65
71extern int pcibios_enabled; 66extern int pcibios_enabled;
72void pcibios_config_init(void); 67void pcibios_config_init(void);
73struct pci_bus *pcibios_scan_root(int bus); 68void pcibios_scan_root(int bus);
74 69
75void pcibios_set_master(struct pci_dev *dev); 70void pcibios_set_master(struct pci_dev *dev);
76void pcibios_penalize_isa_irq(int irq, int active); 71void pcibios_penalize_isa_irq(int irq, int active);
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index d35f24e231cd..c840571afa4e 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -131,6 +131,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot)
131} 131}
132 132
133struct pci_bus; 133struct pci_bus;
134int x86_pci_root_bus_node(int bus);
134void x86_pci_root_bus_resources(int bus, struct list_head *resources); 135void x86_pci_root_bus_resources(int bus, struct list_head *resources);
135 136
136#ifdef CONFIG_SMP 137#ifdef CONFIG_SMP
@@ -139,17 +140,4 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources);
139#define smt_capable() (smp_num_siblings > 1) 140#define smt_capable() (smp_num_siblings > 1)
140#endif 141#endif
141 142
142#ifdef CONFIG_NUMA
143extern int get_mp_bus_to_node(int busnum);
144extern void set_mp_bus_to_node(int busnum, int node);
145#else
146static inline int get_mp_bus_to_node(int busnum)
147{
148 return 0;
149}
150static inline void set_mp_bus_to_node(int busnum, int node)
151{
152}
153#endif
154
155#endif /* _ASM_X86_TOPOLOGY_H */ 143#endif /* _ASM_X86_TOPOLOGY_H */
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 4f25ec077552..f44a64c74e37 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -480,9 +480,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
480 struct pci_bus *bus = NULL; 480 struct pci_bus *bus = NULL;
481 struct pci_sysdata *sd; 481 struct pci_sysdata *sd;
482 int node; 482 int node;
483#ifdef CONFIG_ACPI_NUMA
484 int pxm;
485#endif
486 483
487 if (pci_ignore_seg) 484 if (pci_ignore_seg)
488 domain = 0; 485 domain = 0;
@@ -494,19 +491,12 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
494 return NULL; 491 return NULL;
495 } 492 }
496 493
497 node = -1; 494 node = acpi_get_node(device->handle);
498#ifdef CONFIG_ACPI_NUMA 495 if (node == NUMA_NO_NODE)
499 pxm = acpi_get_pxm(device->handle); 496 node = x86_pci_root_bus_node(busnum);
500 if (pxm >= 0)
501 node = pxm_to_node(pxm);
502 if (node != -1)
503 set_mp_bus_to_node(busnum, node);
504 else
505#endif
506 node = get_mp_bus_to_node(busnum);
507 497
508 if (node != -1 && !node_online(node)) 498 if (node != NUMA_NO_NODE && !node_online(node))
509 node = -1; 499 node = NUMA_NO_NODE;
510 500
511 info = kzalloc(sizeof(*info), GFP_KERNEL); 501 info = kzalloc(sizeof(*info), GFP_KERNEL);
512 if (!info) { 502 if (!info) {
@@ -572,15 +562,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
572 pcie_bus_configure_settings(child); 562 pcie_bus_configure_settings(child);
573 } 563 }
574 564
575 if (bus && node != -1) { 565 if (bus && node != NUMA_NO_NODE)
576#ifdef CONFIG_ACPI_NUMA
577 if (pxm >= 0)
578 dev_printk(KERN_DEBUG, &bus->dev,
579 "on NUMA node %d (pxm %d)\n", node, pxm);
580#else
581 dev_printk(KERN_DEBUG, &bus->dev, "on NUMA node %d\n", node); 566 dev_printk(KERN_DEBUG, &bus->dev, "on NUMA node %d\n", node);
582#endif
583 }
584 567
585 return bus; 568 return bus;
586} 569}
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index a48be98e9ded..a313a7fb6b86 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -44,15 +44,6 @@ static struct pci_root_info __init *find_pci_root_info(int node, int link)
44 return NULL; 44 return NULL;
45} 45}
46 46
47static void __init set_mp_bus_range_to_node(int min_bus, int max_bus, int node)
48{
49#ifdef CONFIG_NUMA
50 int j;
51
52 for (j = min_bus; j <= max_bus; j++)
53 set_mp_bus_to_node(j, node);
54#endif
55}
56/** 47/**
57 * early_fill_mp_bus_to_node() 48 * early_fill_mp_bus_to_node()
58 * called before pcibios_scan_root and pci_scan_bus 49 * called before pcibios_scan_root and pci_scan_bus
@@ -117,7 +108,6 @@ static int __init early_fill_mp_bus_info(void)
117 min_bus = (reg >> 16) & 0xff; 108 min_bus = (reg >> 16) & 0xff;
118 max_bus = (reg >> 24) & 0xff; 109 max_bus = (reg >> 24) & 0xff;
119 node = (reg >> 4) & 0x07; 110 node = (reg >> 4) & 0x07;
120 set_mp_bus_range_to_node(min_bus, max_bus, node);
121 link = (reg >> 8) & 0x03; 111 link = (reg >> 8) & 0x03;
122 112
123 info = alloc_pci_root_info(min_bus, max_bus, node, link); 113 info = alloc_pci_root_info(min_bus, max_bus, node, link);
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
index c2735feb2508..f3a2cfc14125 100644
--- a/arch/x86/pci/bus_numa.c
+++ b/arch/x86/pci/bus_numa.c
@@ -10,9 +10,6 @@ static struct pci_root_info *x86_find_pci_root_info(int bus)
10{ 10{
11 struct pci_root_info *info; 11 struct pci_root_info *info;
12 12
13 if (list_empty(&pci_root_infos))
14 return NULL;
15
16 list_for_each_entry(info, &pci_root_infos, list) 13 list_for_each_entry(info, &pci_root_infos, list)
17 if (info->busn.start == bus) 14 if (info->busn.start == bus)
18 return info; 15 return info;
@@ -20,6 +17,16 @@ static struct pci_root_info *x86_find_pci_root_info(int bus)
20 return NULL; 17 return NULL;
21} 18}
22 19
20int x86_pci_root_bus_node(int bus)
21{
22 struct pci_root_info *info = x86_find_pci_root_info(bus);
23
24 if (!info)
25 return NUMA_NO_NODE;
26
27 return info->node;
28}
29
23void x86_pci_root_bus_resources(int bus, struct list_head *resources) 30void x86_pci_root_bus_resources(int bus, struct list_head *resources)
24{ 31{
25 struct pci_root_info *info = x86_find_pci_root_info(bus); 32 struct pci_root_info *info = x86_find_pci_root_info(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 981c2dbd72cc..d491deddebae 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -456,19 +456,25 @@ void __init dmi_check_pciprobe(void)
456 dmi_check_system(pciprobe_dmi_table); 456 dmi_check_system(pciprobe_dmi_table);
457} 457}
458 458
459struct pci_bus *pcibios_scan_root(int busnum) 459void pcibios_scan_root(int busnum)
460{ 460{
461 struct pci_bus *bus = NULL; 461 struct pci_bus *bus;
462 struct pci_sysdata *sd;
463 LIST_HEAD(resources);
462 464
463 while ((bus = pci_find_next_bus(bus)) != NULL) { 465 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
464 if (bus->number == busnum) { 466 if (!sd) {
465 /* Already scanned */ 467 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busnum);
466 return bus; 468 return;
467 } 469 }
470 sd->node = x86_pci_root_bus_node(busnum);
471 x86_pci_root_bus_resources(busnum, &resources);
472 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
473 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
474 if (!bus) {
475 pci_free_resource_list(&resources);
476 kfree(sd);
468 } 477 }
469
470 return pci_scan_bus_on_node(busnum, &pci_root_ops,
471 get_mp_bus_to_node(busnum));
472} 478}
473 479
474void __init pcibios_set_cache_line_size(void) 480void __init pcibios_set_cache_line_size(void)
@@ -677,105 +683,3 @@ int pci_ext_cfg_avail(void)
677 else 683 else
678 return 0; 684 return 0;
679} 685}
680
681struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node)
682{
683 LIST_HEAD(resources);
684 struct pci_bus *bus = NULL;
685 struct pci_sysdata *sd;
686
687 /*
688 * Allocate per-root-bus (not per bus) arch-specific data.
689 * TODO: leak; this memory is never freed.
690 * It's arguable whether it's worth the trouble to care.
691 */
692 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
693 if (!sd) {
694 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno);
695 return NULL;
696 }
697 sd->node = node;
698 x86_pci_root_bus_resources(busno, &resources);
699 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busno);
700 bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources);
701 if (!bus) {
702 pci_free_resource_list(&resources);
703 kfree(sd);
704 }
705
706 return bus;
707}
708
709struct pci_bus *pci_scan_bus_with_sysdata(int busno)
710{
711 return pci_scan_bus_on_node(busno, &pci_root_ops, -1);
712}
713
714/*
715 * NUMA info for PCI busses
716 *
717 * Early arch code is responsible for filling in reasonable values here.
718 * A node id of "-1" means "use current node". In other words, if a bus
719 * has a -1 node id, it's not tightly coupled to any particular chunk
720 * of memory (as is the case on some Nehalem systems).
721 */
722#ifdef CONFIG_NUMA
723
724#define BUS_NR 256
725
726#ifdef CONFIG_X86_64
727
728static int mp_bus_to_node[BUS_NR] = {
729 [0 ... BUS_NR - 1] = -1
730};
731
732void set_mp_bus_to_node(int busnum, int node)
733{
734 if (busnum >= 0 && busnum < BUS_NR)
735 mp_bus_to_node[busnum] = node;
736}
737
738int get_mp_bus_to_node(int busnum)
739{
740 int node = -1;
741
742 if (busnum < 0 || busnum > (BUS_NR - 1))
743 return node;
744
745 node = mp_bus_to_node[busnum];
746
747 /*
748 * let numa_node_id to decide it later in dma_alloc_pages
749 * if there is no ram on that node
750 */
751 if (node != -1 && !node_online(node))
752 node = -1;
753
754 return node;
755}
756
757#else /* CONFIG_X86_32 */
758
759static int mp_bus_to_node[BUS_NR] = {
760 [0 ... BUS_NR - 1] = -1
761};
762
763void set_mp_bus_to_node(int busnum, int node)
764{
765 if (busnum >= 0 && busnum < BUS_NR)
766 mp_bus_to_node[busnum] = (unsigned char) node;
767}
768
769int get_mp_bus_to_node(int busnum)
770{
771 int node;
772
773 if (busnum < 0 || busnum > (BUS_NR - 1))
774 return 0;
775 node = mp_bus_to_node[busnum];
776 return node;
777}
778
779#endif /* CONFIG_X86_32 */
780
781#endif /* CONFIG_NUMA */
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index bca9e85daaa5..201833f5f1bc 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -25,9 +25,9 @@ static void pci_fixup_i450nx(struct pci_dev *d)
25 dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, 25 dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno,
26 suba, subb); 26 suba, subb);
27 if (busno) 27 if (busno)
28 pci_scan_bus_with_sysdata(busno); /* Bus A */ 28 pcibios_scan_root(busno); /* Bus A */
29 if (suba < subb) 29 if (suba < subb)
30 pci_scan_bus_with_sysdata(suba+1); /* Bus B */ 30 pcibios_scan_root(suba+1); /* Bus B */
31 } 31 }
32 pcibios_last_bus = -1; 32 pcibios_last_bus = -1;
33} 33}
@@ -42,7 +42,7 @@ static void pci_fixup_i450gx(struct pci_dev *d)
42 u8 busno; 42 u8 busno;
43 pci_read_config_byte(d, 0x4a, &busno); 43 pci_read_config_byte(d, 0x4a, &busno);
44 dev_info(&d->dev, "i440KX/GX host bridge; secondary bus %02x\n", busno); 44 dev_info(&d->dev, "i440KX/GX host bridge; secondary bus %02x\n", busno);
45 pci_scan_bus_with_sysdata(busno); 45 pcibios_scan_root(busno);
46 pcibios_last_bus = -1; 46 pcibios_last_bus = -1;
47} 47}
48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx); 48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx);
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 372e9b8989b3..84112f55dd7a 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -136,13 +136,9 @@ static void __init pirq_peer_trick(void)
136 busmap[e->bus] = 1; 136 busmap[e->bus] = 1;
137 } 137 }
138 for (i = 1; i < 256; i++) { 138 for (i = 1; i < 256; i++) {
139 int node;
140 if (!busmap[i] || pci_find_bus(0, i)) 139 if (!busmap[i] || pci_find_bus(0, i))
141 continue; 140 continue;
142 node = get_mp_bus_to_node(i); 141 pcibios_scan_root(i);
143 if (pci_scan_bus_on_node(i, &pci_root_ops, node))
144 printk(KERN_INFO "PCI: Discovered primary peer "
145 "bus %02x [IRQ]\n", i);
146 } 142 }
147 pcibios_last_bus = -1; 143 pcibios_last_bus = -1;
148} 144}
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index 4db96fb1c232..5b662c0faf8c 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -37,19 +37,17 @@ int __init pci_legacy_init(void)
37void pcibios_scan_specific_bus(int busn) 37void pcibios_scan_specific_bus(int busn)
38{ 38{
39 int devfn; 39 int devfn;
40 long node;
41 u32 l; 40 u32 l;
42 41
43 if (pci_find_bus(0, busn)) 42 if (pci_find_bus(0, busn))
44 return; 43 return;
45 44
46 node = get_mp_bus_to_node(busn);
47 for (devfn = 0; devfn < 256; devfn += 8) { 45 for (devfn = 0; devfn < 256; devfn += 8) {
48 if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) && 46 if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) &&
49 l != 0x0000 && l != 0xffff) { 47 l != 0x0000 && l != 0xffff) {
50 DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l); 48 DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l);
51 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", busn); 49 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", busn);
52 pci_scan_bus_on_node(busn, &pci_root_ops, node); 50 pcibios_scan_root(busn);
53 return; 51 return;
54 } 52 }
55 } 53 }
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c
index 72c229f9ebcf..080eb0374fff 100644
--- a/arch/x86/pci/numaq_32.c
+++ b/arch/x86/pci/numaq_32.c
@@ -135,11 +135,11 @@ static void pci_fixup_i450nx(struct pci_dev *d)
135 pxb, busno, suba, subb); 135 pxb, busno, suba, subb);
136 if (busno) { 136 if (busno) {
137 /* Bus A */ 137 /* Bus A */
138 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno)); 138 pcibios_scan_root(QUADLOCAL2BUS(quad, busno));
139 } 139 }
140 if (suba < subb) { 140 if (suba < subb) {
141 /* Bus B */ 141 /* Bus B */
142 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, suba+1)); 142 pcibios_scan_root(QUADLOCAL2BUS(quad, suba+1));
143 } 143 }
144 } 144 }
145 pcibios_last_bus = -1; 145 pcibios_last_bus = -1;
@@ -159,7 +159,7 @@ int __init pci_numaq_init(void)
159 continue; 159 continue;
160 printk("Scanning PCI bus %d for quad %d\n", 160 printk("Scanning PCI bus %d for quad %d\n",
161 QUADLOCAL2BUS(quad,0), quad); 161 QUADLOCAL2BUS(quad,0), quad);
162 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, 0)); 162 pcibios_scan_root(QUADLOCAL2BUS(quad, 0));
163 } 163 }
164 return 0; 164 return 0;
165} 165}
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c
index 3e6d2a6db866..cd9d4d1681d2 100644
--- a/arch/x86/pci/visws.c
+++ b/arch/x86/pci/visws.c
@@ -78,8 +78,8 @@ int __init pci_visws_init(void)
78 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0); 78 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0);
79 79
80 raw_pci_ops = &pci_direct_conf1; 80 raw_pci_ops = &pci_direct_conf1;
81 pci_scan_bus_with_sysdata(pci_bus0); 81 pcibios_scan_root(pci_bus0);
82 pci_scan_bus_with_sysdata(pci_bus1); 82 pcibios_scan_root(pci_bus1);
83 pci_fixup_irqs(pci_common_swizzle, visws_map_irq); 83 pci_fixup_irqs(pci_common_swizzle, visws_map_irq);
84 pcibios_resource_survey(); 84 pcibios_resource_survey();
85 /* Request bus scan */ 85 /* Request bus scan */
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 9e6816ef280a..24b5476449a1 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -60,7 +60,7 @@ int node_to_pxm(int node)
60 return node_to_pxm_map[node]; 60 return node_to_pxm_map[node];
61} 61}
62 62
63void __acpi_map_pxm_to_node(int pxm, int node) 63static void __acpi_map_pxm_to_node(int pxm, int node)
64{ 64{
65 if (pxm_to_node_map[pxm] == NUMA_NO_NODE || node < pxm_to_node_map[pxm]) 65 if (pxm_to_node_map[pxm] == NUMA_NO_NODE || node < pxm_to_node_map[pxm])
66 pxm_to_node_map[pxm] = node; 66 pxm_to_node_map[pxm] = node;
@@ -193,7 +193,7 @@ static int __init acpi_parse_slit(struct acpi_table_header *table)
193 return 0; 193 return 0;
194} 194}
195 195
196void __init __attribute__ ((weak)) 196void __init __weak
197acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) 197acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
198{ 198{
199 printk(KERN_WARNING PREFIX 199 printk(KERN_WARNING PREFIX
@@ -314,7 +314,7 @@ int __init acpi_numa_init(void)
314 return 0; 314 return 0;
315} 315}
316 316
317int acpi_get_pxm(acpi_handle h) 317static int acpi_get_pxm(acpi_handle h)
318{ 318{
319 unsigned long long pxm; 319 unsigned long long pxm;
320 acpi_status status; 320 acpi_status status;
@@ -331,14 +331,14 @@ int acpi_get_pxm(acpi_handle h)
331 return -1; 331 return -1;
332} 332}
333 333
334int acpi_get_node(acpi_handle *handle) 334int acpi_get_node(acpi_handle handle)
335{ 335{
336 int pxm, node = NUMA_NO_NODE; 336 int pxm;
337 337
338 pxm = acpi_get_pxm(handle); 338 pxm = acpi_get_pxm(handle);
339 if (pxm >= 0 && pxm < MAX_PXM_DOMAINS) 339 if (pxm < 0 || pxm >= MAX_PXM_DOMAINS)
340 node = acpi_map_pxm_to_node(pxm); 340 return NUMA_NO_NODE;
341 341
342 return node; 342 return acpi_map_pxm_to_node(pxm);
343} 343}
344EXPORT_SYMBOL(acpi_get_node); 344EXPORT_SYMBOL(acpi_get_node);
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
index 451823cb8837..94a37cd7fbda 100644
--- a/include/acpi/acpi_numa.h
+++ b/include/acpi/acpi_numa.h
@@ -13,7 +13,6 @@
13 13
14extern int pxm_to_node(int); 14extern int pxm_to_node(int);
15extern int node_to_pxm(int); 15extern int node_to_pxm(int);
16extern void __acpi_map_pxm_to_node(int, int);
17extern int acpi_map_pxm_to_node(int); 16extern int acpi_map_pxm_to_node(int);
18extern unsigned char acpi_srat_revision; 17extern unsigned char acpi_srat_revision;
19 18
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 1151a1dcfe41..6c29abbefd41 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -259,14 +259,9 @@ extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
259extern void acpi_osi_setup(char *str); 259extern void acpi_osi_setup(char *str);
260 260
261#ifdef CONFIG_ACPI_NUMA 261#ifdef CONFIG_ACPI_NUMA
262int acpi_get_pxm(acpi_handle handle); 262int acpi_get_node(acpi_handle handle);
263int acpi_get_node(acpi_handle *handle);
264#else 263#else
265static inline int acpi_get_pxm(acpi_handle handle) 264static inline int acpi_get_node(acpi_handle handle)
266{
267 return 0;
268}
269static inline int acpi_get_node(acpi_handle *handle)
270{ 265{
271 return 0; 266 return 0;
272} 267}