aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-01-24 13:54:36 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-02-03 12:38:35 -0500
commitafcf21c2beca6604dbdc24fed1624c2499a85e7d (patch)
treef6845bbb0b38f56dec7a2434800f9b0bad54e87a /arch/x86
parent49886cf4c4cd2ef77d0698c389199ad3e236f48e (diff)
x86/PCI: Add x86_pci_root_bus_node() to look up NUMA node from PCI bus
The AMD early_fill_mp_bus_info() already allocates a struct pci_root_info for each PCI host bridge it finds, and that structure contains the NUMA node number. We don't need to keep the same information in the mp_bus_to_node[] table. This adds x86_pci_root_bus_node(), which returns the NUMA node number, or NUMA_NO_NODE if the node is unknown. Note that unlike get_mp_bus_to_node(), x86_pci_root_bus_node() only works for root buses. For example, if amd_bus.c finds a host bridge on node 1 to [bus 00-0f], get_mp_bus_to_node() returns 1 for any bus between 00 and 0f, but x86_pci_root_bus_node() returns 1 for bus 00 and NUMA_NO_NODE for buses 01-0f. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/topology.h1
-rw-r--r--arch/x86/pci/bus_numa.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index d35f24e231cd..09046a1a6c35 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
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
index c2735feb2508..2e36a4469549 100644
--- a/arch/x86/pci/bus_numa.c
+++ b/arch/x86/pci/bus_numa.c
@@ -20,6 +20,16 @@ static struct pci_root_info *x86_find_pci_root_info(int bus)
20 return NULL; 20 return NULL;
21} 21}
22 22
23int x86_pci_root_bus_node(int bus)
24{
25 struct pci_root_info *info = x86_find_pci_root_info(bus);
26
27 if (!info)
28 return NUMA_NO_NODE;
29
30 return info->node;
31}
32
23void x86_pci_root_bus_resources(int bus, struct list_head *resources) 33void x86_pci_root_bus_resources(int bus, struct list_head *resources)
24{ 34{
25 struct pci_root_info *info = x86_find_pci_root_info(bus); 35 struct pci_root_info *info = x86_find_pci_root_info(bus);