diff options
-rw-r--r-- | arch/i386/kernel/srat.c | 8 | ||||
-rw-r--r-- | arch/i386/pci/acpi.c | 17 | ||||
-rw-r--r-- | arch/x86_64/kernel/mpparse.c | 2 | ||||
-rw-r--r-- | arch/x86_64/mm/srat.c | 7 | ||||
-rw-r--r-- | arch/x86_64/pci/k8-bus.c | 10 | ||||
-rw-r--r-- | include/asm-i386/numa.h | 3 | ||||
-rw-r--r-- | include/asm-i386/topology.h | 2 | ||||
-rw-r--r-- | include/asm-x86_64/numa.h | 1 | ||||
-rw-r--r-- | include/asm-x86_64/topology.h | 3 |
9 files changed, 44 insertions, 9 deletions
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c index 7b3b27d64409..516bf5653b02 100644 --- a/arch/i386/kernel/srat.c +++ b/arch/i386/kernel/srat.c | |||
@@ -213,12 +213,18 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c | |||
213 | node_end_pfn[nid] = memory_chunk->end_pfn; | 213 | node_end_pfn[nid] = memory_chunk->end_pfn; |
214 | } | 214 | } |
215 | 215 | ||
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 | |||
216 | /* Parse the ACPI Static Resource Affinity Table */ | 223 | /* Parse the ACPI Static Resource Affinity Table */ |
217 | static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | 224 | static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) |
218 | { | 225 | { |
219 | u8 *start, *end, *p; | 226 | u8 *start, *end, *p; |
220 | int i, j, nid; | 227 | int i, j, nid; |
221 | u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */ | ||
222 | u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */ | 228 | u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */ |
223 | 229 | ||
224 | start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ | 230 | start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ |
diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c index 42913f43feb0..2941674f35eb 100644 --- a/arch/i386/pci/acpi.c +++ b/arch/i386/pci/acpi.c | |||
@@ -3,16 +3,31 @@ | |||
3 | #include <linux/init.h> | 3 | #include <linux/init.h> |
4 | #include <linux/irq.h> | 4 | #include <linux/irq.h> |
5 | #include <asm/hw_irq.h> | 5 | #include <asm/hw_irq.h> |
6 | #include <asm/numa.h> | ||
6 | #include "pci.h" | 7 | #include "pci.h" |
7 | 8 | ||
8 | struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum) | 9 | struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum) |
9 | { | 10 | { |
11 | struct pci_bus *bus; | ||
12 | |||
10 | if (domain != 0) { | 13 | if (domain != 0) { |
11 | printk(KERN_WARNING "PCI: Multiple domains not supported\n"); | 14 | printk(KERN_WARNING "PCI: Multiple domains not supported\n"); |
12 | return NULL; | 15 | return NULL; |
13 | } | 16 | } |
14 | 17 | ||
15 | return pcibios_scan_root(busnum); | 18 | bus = pcibios_scan_root(busnum); |
19 | #ifdef CONFIG_ACPI_NUMA | ||
20 | if (bus != NULL) { | ||
21 | int pxm = acpi_get_pxm(device->handle); | ||
22 | if (pxm >= 0) { | ||
23 | bus->sysdata = (void *)(unsigned long)pxm_to_node(pxm); | ||
24 | printk("bus %d -> pxm %d -> node %ld\n", | ||
25 | busnum, pxm, (long)(bus->sysdata)); | ||
26 | } | ||
27 | } | ||
28 | #endif | ||
29 | |||
30 | return bus; | ||
16 | } | 31 | } |
17 | 32 | ||
18 | extern int pci_routeirq; | 33 | extern int pci_routeirq; |
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 312ecc9e5f7f..11642526c5b7 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c | |||
@@ -46,8 +46,6 @@ int acpi_found_madt; | |||
46 | int apic_version [MAX_APICS]; | 46 | int apic_version [MAX_APICS]; |
47 | unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; | 47 | unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; |
48 | int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; | 48 | int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; |
49 | unsigned char pci_bus_to_node [256]; | ||
50 | EXPORT_SYMBOL(pci_bus_to_node); | ||
51 | 49 | ||
52 | static int mp_current_pci_id = 0; | 50 | static int mp_current_pci_id = 0; |
53 | /* I/O APIC entries */ | 51 | /* I/O APIC entries */ |
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c index 92f6ec79b232..db6b073a149f 100644 --- a/arch/x86_64/mm/srat.c +++ b/arch/x86_64/mm/srat.c | |||
@@ -25,6 +25,13 @@ static nodemask_t nodes_found __initdata; | |||
25 | static struct node nodes[MAX_NUMNODES] __initdata; | 25 | static struct node nodes[MAX_NUMNODES] __initdata; |
26 | static __u8 pxm2node[256] = { [0 ... 255] = 0xff }; | 26 | static __u8 pxm2node[256] = { [0 ... 255] = 0xff }; |
27 | 27 | ||
28 | int pxm_to_node(int pxm) | ||
29 | { | ||
30 | if ((unsigned)pxm >= 256) | ||
31 | return 0; | ||
32 | return pxm2node[pxm]; | ||
33 | } | ||
34 | |||
28 | static __init int setup_node(int pxm) | 35 | static __init int setup_node(int pxm) |
29 | { | 36 | { |
30 | unsigned node = pxm2node[pxm]; | 37 | unsigned node = pxm2node[pxm]; |
diff --git a/arch/x86_64/pci/k8-bus.c b/arch/x86_64/pci/k8-bus.c index d80c323669e0..3acf60ded2a0 100644 --- a/arch/x86_64/pci/k8-bus.c +++ b/arch/x86_64/pci/k8-bus.c | |||
@@ -58,10 +58,16 @@ fill_mp_bus_to_cpumask(void) | |||
58 | for (j = SECONDARY_LDT_BUS_NUMBER(ldtbus); | 58 | for (j = SECONDARY_LDT_BUS_NUMBER(ldtbus); |
59 | j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus); | 59 | j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus); |
60 | j++) { | 60 | j++) { |
61 | int node = NODE_ID(nid); | 61 | struct pci_bus *bus; |
62 | long node = NODE_ID(nid); | ||
63 | /* Algorithm a bit dumb, but | ||
64 | it shouldn't matter here */ | ||
65 | bus = pci_find_bus(0, j); | ||
66 | if (!bus) | ||
67 | continue; | ||
62 | if (!node_online(node)) | 68 | if (!node_online(node)) |
63 | node = 0; | 69 | node = 0; |
64 | pci_bus_to_node[j] = node; | 70 | bus->sysdata = (void *)node; |
65 | } | 71 | } |
66 | } | 72 | } |
67 | } | 73 | } |
diff --git a/include/asm-i386/numa.h b/include/asm-i386/numa.h new file mode 100644 index 000000000000..96fcb157db1d --- /dev/null +++ b/include/asm-i386/numa.h | |||
@@ -0,0 +1,3 @@ | |||
1 | |||
2 | int pxm_to_nid(int pxm); | ||
3 | |||
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h index 2461b731781e..0ec27c9e8e45 100644 --- a/include/asm-i386/topology.h +++ b/include/asm-i386/topology.h | |||
@@ -60,7 +60,7 @@ static inline int node_to_first_cpu(int node) | |||
60 | return first_cpu(mask); | 60 | return first_cpu(mask); |
61 | } | 61 | } |
62 | 62 | ||
63 | #define pcibus_to_node(bus) mp_bus_id_to_node[(bus)->number] | 63 | #define pcibus_to_node(bus) ((long) (bus)->sysdata) |
64 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) | 64 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) |
65 | 65 | ||
66 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ | 66 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ |
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h index 3aaf70027213..bcf55c3f7f7f 100644 --- a/include/asm-x86_64/numa.h +++ b/include/asm-x86_64/numa.h | |||
@@ -9,6 +9,7 @@ struct node { | |||
9 | }; | 9 | }; |
10 | 10 | ||
11 | extern int compute_hash_shift(struct node *nodes, int numnodes); | 11 | extern int compute_hash_shift(struct node *nodes, int numnodes); |
12 | extern int pxm_to_node(int nid); | ||
12 | 13 | ||
13 | #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) | 14 | #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) |
14 | 15 | ||
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h index c1bc3fad482e..1c603cd7e4d0 100644 --- a/include/asm-x86_64/topology.h +++ b/include/asm-x86_64/topology.h | |||
@@ -13,7 +13,6 @@ | |||
13 | extern cpumask_t cpu_online_map; | 13 | extern cpumask_t cpu_online_map; |
14 | 14 | ||
15 | extern unsigned char cpu_to_node[]; | 15 | extern unsigned char cpu_to_node[]; |
16 | extern unsigned char pci_bus_to_node[]; | ||
17 | extern cpumask_t node_to_cpumask[]; | 16 | extern cpumask_t node_to_cpumask[]; |
18 | 17 | ||
19 | #ifdef CONFIG_ACPI_NUMA | 18 | #ifdef CONFIG_ACPI_NUMA |
@@ -26,7 +25,7 @@ extern int __node_distance(int, int); | |||
26 | #define parent_node(node) (node) | 25 | #define parent_node(node) (node) |
27 | #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) | 26 | #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) |
28 | #define node_to_cpumask(node) (node_to_cpumask[node]) | 27 | #define node_to_cpumask(node) (node_to_cpumask[node]) |
29 | #define pcibus_to_node(bus) pci_bus_to_node[(bus)->number] | 28 | #define pcibus_to_node(bus) ((long)(bus->sysdata)) |
30 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); | 29 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); |
31 | 30 | ||
32 | /* sched_domains SD_NODE_INIT for x86_64 machines */ | 31 | /* sched_domains SD_NODE_INIT for x86_64 machines */ |