diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-28 07:31:22 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-28 17:20:26 -0500 |
commit | d4c9a9f3d416cfa1f5ffbe09d864d069467fe693 (patch) | |
tree | 647f78d7d845734fdab95c8a05a20b0a80015709 | |
parent | b0b20e5a3a6615ae750804523aeedd32911bb9d6 (diff) |
x86, apic: unify phys_pkg_id()
- unify the call signature of 64-bit to that of 32-bit
- clean up the types all around
- clean up namespace contamination
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/include/asm/bigsmp/apic.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/es7000/apic.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/genapic.h | 6 | ||||
-rw-r--r-- | arch/x86/include/asm/mach-default/mach_apic.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/numaq/apic.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/summit/apic.h | 5 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/addon_cpuid_features.c | 10 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 11 | ||||
-rw-r--r-- | arch/x86/kernel/genapic_flat_64.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/genx2apic_cluster.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/genx2apic_phys.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/genx2apic_uv_x.c | 4 |
12 files changed, 19 insertions, 39 deletions
diff --git a/arch/x86/include/asm/bigsmp/apic.h b/arch/x86/include/asm/bigsmp/apic.h index f49d440862f1..b7cba5b5635b 100644 --- a/arch/x86/include/asm/bigsmp/apic.h +++ b/arch/x86/include/asm/bigsmp/apic.h | |||
@@ -133,7 +133,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
133 | return BAD_APICID; | 133 | return BAD_APICID; |
134 | } | 134 | } |
135 | 135 | ||
136 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | 136 | static inline int phys_pkg_id(int cpuid_apic, int index_msb) |
137 | { | 137 | { |
138 | return cpuid_apic >> index_msb; | 138 | return cpuid_apic >> index_msb; |
139 | } | 139 | } |
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h index 038c4f0e480b..d2c6c202e8bd 100644 --- a/arch/x86/include/asm/es7000/apic.h +++ b/arch/x86/include/asm/es7000/apic.h | |||
@@ -221,7 +221,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | |||
221 | return apicid; | 221 | return apicid; |
222 | } | 222 | } |
223 | 223 | ||
224 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | 224 | static inline int phys_pkg_id(int cpuid_apic, int index_msb) |
225 | { | 225 | { |
226 | return cpuid_apic >> index_msb; | 226 | return cpuid_apic >> index_msb; |
227 | } | 227 | } |
diff --git a/arch/x86/include/asm/genapic.h b/arch/x86/include/asm/genapic.h index f292fd02ebab..14b19de8cd09 100644 --- a/arch/x86/include/asm/genapic.h +++ b/arch/x86/include/asm/genapic.h | |||
@@ -48,11 +48,7 @@ struct genapic { | |||
48 | void (*setup_portio_remap)(void); | 48 | void (*setup_portio_remap)(void); |
49 | int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); | 49 | int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); |
50 | void (*enable_apic_mode)(void); | 50 | void (*enable_apic_mode)(void); |
51 | #ifdef CONFIG_X86_32 | 51 | int (*phys_pkg_id)(int cpuid_apic, int index_msb); |
52 | u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb); | ||
53 | #else | ||
54 | unsigned int (*phys_pkg_id)(int index_msb); | ||
55 | #endif | ||
56 | 52 | ||
57 | /* | 53 | /* |
58 | * When one of the next two hooks returns 1 the genapic | 54 | * When one of the next two hooks returns 1 the genapic |
diff --git a/arch/x86/include/asm/mach-default/mach_apic.h b/arch/x86/include/asm/mach-default/mach_apic.h index 3647c92d45e5..55797a35150f 100644 --- a/arch/x86/include/asm/mach-default/mach_apic.h +++ b/arch/x86/include/asm/mach-default/mach_apic.h | |||
@@ -65,7 +65,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
65 | return (unsigned int)(mask1 & mask2 & mask3); | 65 | return (unsigned int)(mask1 & mask2 & mask3); |
66 | } | 66 | } |
67 | 67 | ||
68 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | 68 | static inline int phys_pkg_id(int cpuid_apic, int index_msb) |
69 | { | 69 | { |
70 | return cpuid_apic >> index_msb; | 70 | return cpuid_apic >> index_msb; |
71 | } | 71 | } |
diff --git a/arch/x86/include/asm/numaq/apic.h b/arch/x86/include/asm/numaq/apic.h index dc93c30972e7..bc2c8a425c03 100644 --- a/arch/x86/include/asm/numaq/apic.h +++ b/arch/x86/include/asm/numaq/apic.h | |||
@@ -113,7 +113,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
113 | } | 113 | } |
114 | 114 | ||
115 | /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */ | 115 | /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */ |
116 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | 116 | static inline int phys_pkg_id(int cpuid_apic, int index_msb) |
117 | { | 117 | { |
118 | return cpuid_apic >> index_msb; | 118 | return cpuid_apic >> index_msb; |
119 | } | 119 | } |
diff --git a/arch/x86/include/asm/summit/apic.h b/arch/x86/include/asm/summit/apic.h index 526d19e79447..64cd441ae006 100644 --- a/arch/x86/include/asm/summit/apic.h +++ b/arch/x86/include/asm/summit/apic.h | |||
@@ -175,13 +175,14 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | |||
175 | return apicid; | 175 | return apicid; |
176 | } | 176 | } |
177 | 177 | ||
178 | /* cpuid returns the value latched in the HW at reset, not the APIC ID | 178 | /* |
179 | * cpuid returns the value latched in the HW at reset, not the APIC ID | ||
179 | * register's value. For any box whose BIOS changes APIC IDs, like | 180 | * register's value. For any box whose BIOS changes APIC IDs, like |
180 | * clustered APIC systems, we must use hard_smp_processor_id. | 181 | * clustered APIC systems, we must use hard_smp_processor_id. |
181 | * | 182 | * |
182 | * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. | 183 | * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. |
183 | */ | 184 | */ |
184 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | 185 | static inline int phys_pkg_id(int cpuid_apic, int index_msb) |
185 | { | 186 | { |
186 | return hard_smp_processor_id() >> index_msb; | 187 | return hard_smp_processor_id() >> index_msb; |
187 | } | 188 | } |
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 4e581fdc0a5a..84f8e4a5aef7 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -116,7 +116,6 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) | |||
116 | 116 | ||
117 | core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width; | 117 | core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width; |
118 | 118 | ||
119 | #ifdef CONFIG_X86_32 | ||
120 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width) | 119 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width) |
121 | & core_select_mask; | 120 | & core_select_mask; |
122 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width); | 121 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width); |
@@ -124,14 +123,7 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) | |||
124 | * Reinit the apicid, now that we have extended initial_apicid. | 123 | * Reinit the apicid, now that we have extended initial_apicid. |
125 | */ | 124 | */ |
126 | c->apicid = phys_pkg_id(c->initial_apicid, 0); | 125 | c->apicid = phys_pkg_id(c->initial_apicid, 0); |
127 | #else | 126 | |
128 | c->cpu_core_id = phys_pkg_id(ht_mask_width) & core_select_mask; | ||
129 | c->phys_proc_id = phys_pkg_id(core_plus_mask_width); | ||
130 | /* | ||
131 | * Reinit the apicid, now that we have extended initial_apicid. | ||
132 | */ | ||
133 | c->apicid = phys_pkg_id(0); | ||
134 | #endif | ||
135 | c->x86_max_cores = (core_level_siblings / smp_num_siblings); | 127 | c->x86_max_cores = (core_level_siblings / smp_num_siblings); |
136 | 128 | ||
137 | 129 | ||
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 275e2cb43b91..93c491c4fe7f 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -442,11 +442,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
442 | } | 442 | } |
443 | 443 | ||
444 | index_msb = get_count_order(smp_num_siblings); | 444 | index_msb = get_count_order(smp_num_siblings); |
445 | #ifdef CONFIG_X86_64 | ||
446 | c->phys_proc_id = phys_pkg_id(index_msb); | ||
447 | #else | ||
448 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb); | 445 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb); |
449 | #endif | ||
450 | 446 | ||
451 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; | 447 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; |
452 | 448 | ||
@@ -454,13 +450,8 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
454 | 450 | ||
455 | core_bits = get_count_order(c->x86_max_cores); | 451 | core_bits = get_count_order(c->x86_max_cores); |
456 | 452 | ||
457 | #ifdef CONFIG_X86_64 | ||
458 | c->cpu_core_id = phys_pkg_id(index_msb) & | ||
459 | ((1 << core_bits) - 1); | ||
460 | #else | ||
461 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) & | 453 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) & |
462 | ((1 << core_bits) - 1); | 454 | ((1 << core_bits) - 1); |
463 | #endif | ||
464 | } | 455 | } |
465 | 456 | ||
466 | out: | 457 | out: |
@@ -742,7 +733,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
742 | this_cpu->c_identify(c); | 733 | this_cpu->c_identify(c); |
743 | 734 | ||
744 | #ifdef CONFIG_X86_64 | 735 | #ifdef CONFIG_X86_64 |
745 | c->apicid = phys_pkg_id(0); | 736 | c->apicid = phys_pkg_id(c->initial_apicid, 0); |
746 | #endif | 737 | #endif |
747 | 738 | ||
748 | /* | 739 | /* |
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c index 78adf71f7e55..cc9e07b96094 100644 --- a/arch/x86/kernel/genapic_flat_64.c +++ b/arch/x86/kernel/genapic_flat_64.c | |||
@@ -169,7 +169,7 @@ static unsigned int flat_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
169 | return mask1 & mask2; | 169 | return mask1 & mask2; |
170 | } | 170 | } |
171 | 171 | ||
172 | static unsigned int phys_pkg_id(int index_msb) | 172 | static int flat_phys_pkg_id(int initial_apic_id, int index_msb) |
173 | { | 173 | { |
174 | return hard_smp_processor_id() >> index_msb; | 174 | return hard_smp_processor_id() >> index_msb; |
175 | } | 175 | } |
@@ -202,7 +202,7 @@ struct genapic apic_flat = { | |||
202 | .setup_portio_remap = NULL, | 202 | .setup_portio_remap = NULL, |
203 | .check_phys_apicid_present = default_check_phys_apicid_present, | 203 | .check_phys_apicid_present = default_check_phys_apicid_present, |
204 | .enable_apic_mode = NULL, | 204 | .enable_apic_mode = NULL, |
205 | .phys_pkg_id = phys_pkg_id, | 205 | .phys_pkg_id = flat_phys_pkg_id, |
206 | .mps_oem_check = NULL, | 206 | .mps_oem_check = NULL, |
207 | 207 | ||
208 | .get_apic_id = get_apic_id, | 208 | .get_apic_id = get_apic_id, |
@@ -346,7 +346,7 @@ struct genapic apic_physflat = { | |||
346 | .setup_portio_remap = NULL, | 346 | .setup_portio_remap = NULL, |
347 | .check_phys_apicid_present = default_check_phys_apicid_present, | 347 | .check_phys_apicid_present = default_check_phys_apicid_present, |
348 | .enable_apic_mode = NULL, | 348 | .enable_apic_mode = NULL, |
349 | .phys_pkg_id = phys_pkg_id, | 349 | .phys_pkg_id = flat_phys_pkg_id, |
350 | .mps_oem_check = NULL, | 350 | .mps_oem_check = NULL, |
351 | 351 | ||
352 | .get_apic_id = get_apic_id, | 352 | .get_apic_id = get_apic_id, |
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c index 7062e24b18f6..18b6f14376eb 100644 --- a/arch/x86/kernel/genx2apic_cluster.c +++ b/arch/x86/kernel/genx2apic_cluster.c | |||
@@ -157,7 +157,7 @@ static unsigned long set_apic_id(unsigned int id) | |||
157 | return x; | 157 | return x; |
158 | } | 158 | } |
159 | 159 | ||
160 | static unsigned int phys_pkg_id(int index_msb) | 160 | static int x2apic_cluster_phys_pkg_id(int initial_apicid, int index_msb) |
161 | { | 161 | { |
162 | return current_cpu_data.initial_apicid >> index_msb; | 162 | return current_cpu_data.initial_apicid >> index_msb; |
163 | } | 163 | } |
@@ -204,7 +204,7 @@ struct genapic apic_x2apic_cluster = { | |||
204 | .setup_portio_remap = NULL, | 204 | .setup_portio_remap = NULL, |
205 | .check_phys_apicid_present = default_check_phys_apicid_present, | 205 | .check_phys_apicid_present = default_check_phys_apicid_present, |
206 | .enable_apic_mode = NULL, | 206 | .enable_apic_mode = NULL, |
207 | .phys_pkg_id = phys_pkg_id, | 207 | .phys_pkg_id = x2apic_cluster_phys_pkg_id, |
208 | .mps_oem_check = NULL, | 208 | .mps_oem_check = NULL, |
209 | 209 | ||
210 | .get_apic_id = get_apic_id, | 210 | .get_apic_id = get_apic_id, |
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c index 7177a1110f0d..2cb6f49e4c50 100644 --- a/arch/x86/kernel/genx2apic_phys.c +++ b/arch/x86/kernel/genx2apic_phys.c | |||
@@ -156,7 +156,7 @@ static unsigned long set_apic_id(unsigned int id) | |||
156 | return x; | 156 | return x; |
157 | } | 157 | } |
158 | 158 | ||
159 | static unsigned int phys_pkg_id(int index_msb) | 159 | static int x2apic_phys_pkg_id(int initial_apicid, int index_msb) |
160 | { | 160 | { |
161 | return current_cpu_data.initial_apicid >> index_msb; | 161 | return current_cpu_data.initial_apicid >> index_msb; |
162 | } | 162 | } |
@@ -200,7 +200,7 @@ struct genapic apic_x2apic_phys = { | |||
200 | .setup_portio_remap = NULL, | 200 | .setup_portio_remap = NULL, |
201 | .check_phys_apicid_present = default_check_phys_apicid_present, | 201 | .check_phys_apicid_present = default_check_phys_apicid_present, |
202 | .enable_apic_mode = NULL, | 202 | .enable_apic_mode = NULL, |
203 | .phys_pkg_id = phys_pkg_id, | 203 | .phys_pkg_id = x2apic_phys_pkg_id, |
204 | .mps_oem_check = NULL, | 204 | .mps_oem_check = NULL, |
205 | 205 | ||
206 | .get_apic_id = get_apic_id, | 206 | .get_apic_id = get_apic_id, |
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c index debd721f0b4e..67e7658775e7 100644 --- a/arch/x86/kernel/genx2apic_uv_x.c +++ b/arch/x86/kernel/genx2apic_uv_x.c | |||
@@ -226,7 +226,7 @@ static unsigned int uv_read_apic_id(void) | |||
226 | return get_apic_id(apic_read(APIC_ID)); | 226 | return get_apic_id(apic_read(APIC_ID)); |
227 | } | 227 | } |
228 | 228 | ||
229 | static unsigned int phys_pkg_id(int index_msb) | 229 | static int uv_phys_pkg_id(int initial_apicid, int index_msb) |
230 | { | 230 | { |
231 | return uv_read_apic_id() >> index_msb; | 231 | return uv_read_apic_id() >> index_msb; |
232 | } | 232 | } |
@@ -265,7 +265,7 @@ struct genapic apic_x2apic_uv_x = { | |||
265 | .setup_portio_remap = NULL, | 265 | .setup_portio_remap = NULL, |
266 | .check_phys_apicid_present = default_check_phys_apicid_present, | 266 | .check_phys_apicid_present = default_check_phys_apicid_present, |
267 | .enable_apic_mode = NULL, | 267 | .enable_apic_mode = NULL, |
268 | .phys_pkg_id = phys_pkg_id, | 268 | .phys_pkg_id = uv_phys_pkg_id, |
269 | .mps_oem_check = NULL, | 269 | .mps_oem_check = NULL, |
270 | 270 | ||
271 | .get_apic_id = get_apic_id, | 271 | .get_apic_id = get_apic_id, |