diff options
-rw-r--r-- | include/asm-x86/pci.h | 13 | ||||
-rw-r--r-- | include/asm-x86/topology_32.h | 55 | ||||
-rw-r--r-- | include/asm-x86/topology_64.h | 60 |
3 files changed, 80 insertions, 48 deletions
diff --git a/include/asm-x86/pci.h b/include/asm-x86/pci.h index 6983730d86fd..c61190cb9e12 100644 --- a/include/asm-x86/pci.h +++ b/include/asm-x86/pci.h | |||
@@ -92,6 +92,19 @@ static inline void early_quirks(void) { } | |||
92 | /* generic pci stuff */ | 92 | /* generic pci stuff */ |
93 | #include <asm-generic/pci.h> | 93 | #include <asm-generic/pci.h> |
94 | 94 | ||
95 | #ifdef CONFIG_NUMA | ||
96 | /* Returns the node based on pci bus */ | ||
97 | static inline int __pcibus_to_node(struct pci_bus *bus) | ||
98 | { | ||
99 | struct pci_sysdata *sd = bus->sysdata; | ||
100 | |||
101 | return sd->node; | ||
102 | } | ||
95 | 103 | ||
104 | static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus) | ||
105 | { | ||
106 | return node_to_cpumask(__pcibus_to_node(bus)); | ||
107 | } | ||
108 | #endif | ||
96 | 109 | ||
97 | #endif | 110 | #endif |
diff --git a/include/asm-x86/topology_32.h b/include/asm-x86/topology_32.h index e28dbdcc5670..35b00067587d 100644 --- a/include/asm-x86/topology_32.h +++ b/include/asm-x86/topology_32.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2002, IBM Corp. | 4 | * Copyright (C) 2002, IBM Corp. |
5 | * | 5 | * |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
@@ -22,34 +22,27 @@ | |||
22 | * | 22 | * |
23 | * Send feedback to <colpatch@us.ibm.com> | 23 | * Send feedback to <colpatch@us.ibm.com> |
24 | */ | 24 | */ |
25 | #ifndef _ASM_I386_TOPOLOGY_H | 25 | #ifndef _ASM_X86_TOPOLOGY_H |
26 | #define _ASM_I386_TOPOLOGY_H | 26 | #define _ASM_X86_TOPOLOGY_H |
27 | |||
28 | #ifdef CONFIG_X86_HT | ||
29 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) | ||
30 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) | ||
31 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) | ||
32 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) | ||
33 | #endif | ||
34 | 27 | ||
35 | #ifdef CONFIG_NUMA | 28 | #ifdef CONFIG_NUMA |
36 | |||
37 | #include <asm/mpspec.h> | ||
38 | |||
39 | #include <linux/cpumask.h> | 29 | #include <linux/cpumask.h> |
30 | #include <asm/mpspec.h> | ||
40 | 31 | ||
41 | /* Mappings between logical cpu number and node number */ | 32 | /* Mappings between logical cpu number and node number */ |
42 | extern cpumask_t node_to_cpumask_map[]; | ||
43 | extern int cpu_to_node_map[]; | 33 | extern int cpu_to_node_map[]; |
34 | extern cpumask_t node_to_cpumask_map[]; | ||
44 | 35 | ||
45 | /* Returns the number of the node containing CPU 'cpu' */ | 36 | /* Returns the number of the node containing CPU 'cpu' */ |
46 | static inline int cpu_to_node(int cpu) | 37 | static inline int cpu_to_node(int cpu) |
47 | { | 38 | { |
48 | return cpu_to_node_map[cpu]; | 39 | return cpu_to_node_map[cpu]; |
49 | } | 40 | } |
50 | 41 | ||
51 | /* Returns the number of the node containing Node 'node'. This architecture is flat, | 42 | /* |
52 | so it is a pretty simple function! */ | 43 | * Returns the number of the node containing Node 'node'. This |
44 | * architecture is flat, so it is a pretty simple function! | ||
45 | */ | ||
53 | #define parent_node(node) (node) | 46 | #define parent_node(node) (node) |
54 | 47 | ||
55 | /* Returns a bitmask of CPUs on Node 'node'. */ | 48 | /* Returns a bitmask of CPUs on Node 'node'. */ |
@@ -60,13 +53,14 @@ static inline cpumask_t node_to_cpumask(int node) | |||
60 | 53 | ||
61 | /* Returns the number of the first CPU on Node 'node'. */ | 54 | /* Returns the number of the first CPU on Node 'node'. */ |
62 | static inline int node_to_first_cpu(int node) | 55 | static inline int node_to_first_cpu(int node) |
63 | { | 56 | { |
64 | cpumask_t mask = node_to_cpumask(node); | 57 | cpumask_t mask = node_to_cpumask(node); |
58 | |||
65 | return first_cpu(mask); | 59 | return first_cpu(mask); |
66 | } | 60 | } |
67 | 61 | ||
68 | #define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)->sysdata))->node | 62 | #define pcibus_to_node(bus) __pcibus_to_node(bus) |
69 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) | 63 | #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus) |
70 | 64 | ||
71 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ | 65 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ |
72 | #define SD_NODE_INIT (struct sched_domain) { \ | 66 | #define SD_NODE_INIT (struct sched_domain) { \ |
@@ -99,21 +93,24 @@ extern unsigned long node_remap_size[]; | |||
99 | 93 | ||
100 | #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid]) | 94 | #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid]) |
101 | 95 | ||
102 | #else /* !CONFIG_NUMA */ | 96 | #else /* CONFIG_NUMA */ |
103 | /* | ||
104 | * Other i386 platforms should define their own version of the | ||
105 | * above macros here. | ||
106 | */ | ||
107 | 97 | ||
108 | #include <asm-generic/topology.h> | 98 | #include <asm-generic/topology.h> |
109 | 99 | ||
110 | #endif /* CONFIG_NUMA */ | 100 | #endif |
111 | 101 | ||
112 | extern cpumask_t cpu_coregroup_map(int cpu); | 102 | extern cpumask_t cpu_coregroup_map(int cpu); |
113 | 103 | ||
104 | #ifdef CONFIG_X86_HT | ||
105 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) | ||
106 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) | ||
107 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) | ||
108 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) | ||
109 | #endif | ||
110 | |||
114 | #ifdef CONFIG_SMP | 111 | #ifdef CONFIG_SMP |
115 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) | 112 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) |
116 | #define smt_capable() (smp_num_siblings > 1) | 113 | #define smt_capable() (smp_num_siblings > 1) |
117 | #endif | 114 | #endif |
118 | 115 | ||
119 | #endif /* _ASM_I386_TOPOLOGY_H */ | 116 | #endif |
diff --git a/include/asm-x86/topology_64.h b/include/asm-x86/topology_64.h index cf529341b16c..93de948bd337 100644 --- a/include/asm-x86/topology_64.h +++ b/include/asm-x86/topology_64.h | |||
@@ -1,27 +1,47 @@ | |||
1 | #ifndef _ASM_X86_64_TOPOLOGY_H | 1 | #ifndef _ASM_X86_TOPOLOGY_H |
2 | #define _ASM_X86_64_TOPOLOGY_H | 2 | #define _ASM_X86_TOPOLOGY_H |
3 | |||
4 | 3 | ||
5 | #ifdef CONFIG_NUMA | 4 | #ifdef CONFIG_NUMA |
6 | 5 | #include <linux/cpumask.h> | |
7 | #include <asm/mpspec.h> | 6 | #include <asm/mpspec.h> |
8 | #include <linux/bitops.h> | ||
9 | 7 | ||
8 | /* Mappings between logical cpu number and node number */ | ||
10 | extern int cpu_to_node_map[]; | 9 | extern int cpu_to_node_map[]; |
11 | extern cpumask_t node_to_cpumask_map[]; | 10 | extern cpumask_t node_to_cpumask_map[]; |
12 | 11 | ||
13 | #ifdef CONFIG_ACPI_NUMA | 12 | #ifdef CONFIG_ACPI_NUMA |
14 | extern int __node_distance(int, int); | 13 | extern int __node_distance(int, int); |
15 | #define node_distance(a,b) __node_distance(a,b) | 14 | #define node_distance(a,b) __node_distance(a,b) |
16 | /* #else fallback version */ | ||
17 | #endif | 15 | #endif |
18 | 16 | ||
19 | #define cpu_to_node(cpu) (cpu_to_node_map[cpu]) | 17 | /* Returns the number of the node containing CPU 'cpu' */ |
20 | #define parent_node(node) (node) | 18 | static inline int cpu_to_node(int cpu) |
21 | #define node_to_first_cpu(node) (first_cpu(node_to_cpumask_map[node])) | 19 | { |
22 | #define node_to_cpumask(node) (node_to_cpumask_map[node]) | 20 | return cpu_to_node_map[cpu]; |
23 | #define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)->sysdata))->node | 21 | } |
24 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); | 22 | |
23 | /* | ||
24 | * Returns the number of the node containing Node 'node'. This | ||
25 | * architecture is flat, so it is a pretty simple function! | ||
26 | */ | ||
27 | #define parent_node(node) (node) | ||
28 | |||
29 | /* Returns a bitmask of CPUs on Node 'node'. */ | ||
30 | static inline cpumask_t node_to_cpumask(int node) | ||
31 | { | ||
32 | return node_to_cpumask_map[node]; | ||
33 | } | ||
34 | |||
35 | /* Returns the number of the first CPU on Node 'node'. */ | ||
36 | static inline int node_to_first_cpu(int node) | ||
37 | { | ||
38 | cpumask_t mask = node_to_cpumask(node); | ||
39 | |||
40 | return first_cpu(mask); | ||
41 | } | ||
42 | |||
43 | #define pcibus_to_node(bus) __pcibus_to_node(bus) | ||
44 | #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus) | ||
25 | 45 | ||
26 | #define numa_node_id() read_pda(nodenumber) | 46 | #define numa_node_id() read_pda(nodenumber) |
27 | 47 | ||
@@ -38,12 +58,12 @@ extern int __node_distance(int, int); | |||
38 | .cache_nice_tries = 2, \ | 58 | .cache_nice_tries = 2, \ |
39 | .busy_idx = 3, \ | 59 | .busy_idx = 3, \ |
40 | .idle_idx = 2, \ | 60 | .idle_idx = 2, \ |
41 | .newidle_idx = 0, \ | 61 | .newidle_idx = 0, \ |
42 | .wake_idx = 1, \ | 62 | .wake_idx = 1, \ |
43 | .forkexec_idx = 1, \ | 63 | .forkexec_idx = 1, \ |
44 | .flags = SD_LOAD_BALANCE \ | 64 | .flags = SD_LOAD_BALANCE \ |
45 | | SD_BALANCE_FORK \ | ||
46 | | SD_BALANCE_EXEC \ | 65 | | SD_BALANCE_EXEC \ |
66 | | SD_BALANCE_FORK \ | ||
47 | | SD_SERIALIZE \ | 67 | | SD_SERIALIZE \ |
48 | | SD_WAKE_BALANCE, \ | 68 | | SD_WAKE_BALANCE, \ |
49 | .last_balance = jiffies, \ | 69 | .last_balance = jiffies, \ |
@@ -51,19 +71,21 @@ extern int __node_distance(int, int); | |||
51 | .nr_balance_failed = 0, \ | 71 | .nr_balance_failed = 0, \ |
52 | } | 72 | } |
53 | 73 | ||
74 | #else /* CONFIG_NUMA */ | ||
75 | |||
76 | #include <asm-generic/topology.h> | ||
77 | |||
54 | #endif | 78 | #endif |
55 | 79 | ||
80 | extern cpumask_t cpu_coregroup_map(int cpu); | ||
81 | |||
56 | #ifdef CONFIG_SMP | 82 | #ifdef CONFIG_SMP |
57 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) | 83 | #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) |
58 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) | 84 | #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) |
59 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) | 85 | #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) |
60 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) | 86 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) |
61 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) | 87 | #define mc_capable() (boot_cpu_data.x86_max_cores > 1) |
62 | #define smt_capable() (smp_num_siblings > 1) | 88 | #define smt_capable() (smp_num_siblings > 1) |
63 | #endif | 89 | #endif |
64 | 90 | ||
65 | #include <asm-generic/topology.h> | ||
66 | |||
67 | extern cpumask_t cpu_coregroup_map(int cpu); | ||
68 | |||
69 | #endif | 91 | #endif |