diff options
-rw-r--r-- | arch/x86/include/asm/es7000/apic.h | 32 | ||||
-rw-r--r-- | arch/x86/include/asm/lguest.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/numaq/apic.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/summit/apic.h | 42 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpuid.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/msr.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/reboot.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 2 | ||||
-rw-r--r-- | arch/x86/mach-voyager/voyager_smp.c | 7 |
12 files changed, 26 insertions, 79 deletions
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h index 51ac1230294e..bc53d5ef1386 100644 --- a/arch/x86/include/asm/es7000/apic.h +++ b/arch/x86/include/asm/es7000/apic.h | |||
@@ -157,7 +157,7 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | |||
157 | 157 | ||
158 | num_bits_set = cpumask_weight(cpumask); | 158 | num_bits_set = cpumask_weight(cpumask); |
159 | /* Return id to all */ | 159 | /* Return id to all */ |
160 | if (num_bits_set == NR_CPUS) | 160 | if (num_bits_set == nr_cpu_ids) |
161 | return 0xFF; | 161 | return 0xFF; |
162 | /* | 162 | /* |
163 | * The cpus in the mask must all be on the apic cluster. If are not | 163 | * The cpus in the mask must all be on the apic cluster. If are not |
@@ -190,7 +190,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
190 | 190 | ||
191 | num_bits_set = cpus_weight(*cpumask); | 191 | num_bits_set = cpus_weight(*cpumask); |
192 | /* Return id to all */ | 192 | /* Return id to all */ |
193 | if (num_bits_set == NR_CPUS) | 193 | if (num_bits_set == nr_cpu_ids) |
194 | return cpu_to_logical_apicid(0); | 194 | return cpu_to_logical_apicid(0); |
195 | /* | 195 | /* |
196 | * The cpus in the mask must all be on the apic cluster. If are not | 196 | * The cpus in the mask must all be on the apic cluster. If are not |
@@ -218,9 +218,6 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
218 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | 218 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, |
219 | const struct cpumask *andmask) | 219 | const struct cpumask *andmask) |
220 | { | 220 | { |
221 | int num_bits_set; | ||
222 | int cpus_found = 0; | ||
223 | int cpu; | ||
224 | int apicid = cpu_to_logical_apicid(0); | 221 | int apicid = cpu_to_logical_apicid(0); |
225 | cpumask_var_t cpumask; | 222 | cpumask_var_t cpumask; |
226 | 223 | ||
@@ -229,31 +226,8 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | |||
229 | 226 | ||
230 | cpumask_and(cpumask, inmask, andmask); | 227 | cpumask_and(cpumask, inmask, andmask); |
231 | cpumask_and(cpumask, cpumask, cpu_online_mask); | 228 | cpumask_and(cpumask, cpumask, cpu_online_mask); |
229 | apicid = cpu_mask_to_apicid(cpumask); | ||
232 | 230 | ||
233 | num_bits_set = cpumask_weight(cpumask); | ||
234 | /* Return id to all */ | ||
235 | if (num_bits_set == NR_CPUS) | ||
236 | goto exit; | ||
237 | /* | ||
238 | * The cpus in the mask must all be on the apic cluster. If are not | ||
239 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
240 | */ | ||
241 | cpu = cpumask_first(cpumask); | ||
242 | apicid = cpu_to_logical_apicid(cpu); | ||
243 | while (cpus_found < num_bits_set) { | ||
244 | if (cpumask_test_cpu(cpu, cpumask)) { | ||
245 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
246 | if (apicid_cluster(apicid) != | ||
247 | apicid_cluster(new_apicid)){ | ||
248 | printk ("%s: Not a valid mask!\n", __func__); | ||
249 | return cpu_to_logical_apicid(0); | ||
250 | } | ||
251 | apicid = new_apicid; | ||
252 | cpus_found++; | ||
253 | } | ||
254 | cpu++; | ||
255 | } | ||
256 | exit: | ||
257 | free_cpumask_var(cpumask); | 231 | free_cpumask_var(cpumask); |
258 | return apicid; | 232 | return apicid; |
259 | } | 233 | } |
diff --git a/arch/x86/include/asm/lguest.h b/arch/x86/include/asm/lguest.h index d28a507cef39..1caf57628b9c 100644 --- a/arch/x86/include/asm/lguest.h +++ b/arch/x86/include/asm/lguest.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #define SHARED_SWITCHER_PAGES \ | 15 | #define SHARED_SWITCHER_PAGES \ |
16 | DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE) | 16 | DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE) |
17 | /* Pages for switcher itself, then two pages per cpu */ | 17 | /* Pages for switcher itself, then two pages per cpu */ |
18 | #define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * NR_CPUS) | 18 | #define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * nr_cpu_ids) |
19 | 19 | ||
20 | /* We map at -4M for ease of mapping into the guest (one PTE page). */ | 20 | /* We map at -4M for ease of mapping into the guest (one PTE page). */ |
21 | #define SWITCHER_ADDR 0xFFC00000 | 21 | #define SWITCHER_ADDR 0xFFC00000 |
diff --git a/arch/x86/include/asm/numaq/apic.h b/arch/x86/include/asm/numaq/apic.h index c80f00d29965..bf37bc49bd8e 100644 --- a/arch/x86/include/asm/numaq/apic.h +++ b/arch/x86/include/asm/numaq/apic.h | |||
@@ -63,8 +63,8 @@ static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | |||
63 | extern u8 cpu_2_logical_apicid[]; | 63 | extern u8 cpu_2_logical_apicid[]; |
64 | static inline int cpu_to_logical_apicid(int cpu) | 64 | static inline int cpu_to_logical_apicid(int cpu) |
65 | { | 65 | { |
66 | if (cpu >= NR_CPUS) | 66 | if (cpu >= nr_cpu_ids) |
67 | return BAD_APICID; | 67 | return BAD_APICID; |
68 | return (int)cpu_2_logical_apicid[cpu]; | 68 | return (int)cpu_2_logical_apicid[cpu]; |
69 | } | 69 | } |
70 | 70 | ||
diff --git a/arch/x86/include/asm/summit/apic.h b/arch/x86/include/asm/summit/apic.h index 99327d1be49f..4bb5fb34f030 100644 --- a/arch/x86/include/asm/summit/apic.h +++ b/arch/x86/include/asm/summit/apic.h | |||
@@ -52,7 +52,7 @@ static inline void init_apic_ldr(void) | |||
52 | int i; | 52 | int i; |
53 | 53 | ||
54 | /* Create logical APIC IDs by counting CPUs already in cluster. */ | 54 | /* Create logical APIC IDs by counting CPUs already in cluster. */ |
55 | for (count = 0, i = NR_CPUS; --i >= 0; ) { | 55 | for (count = 0, i = nr_cpu_ids; --i >= 0; ) { |
56 | lid = cpu_2_logical_apicid[i]; | 56 | lid = cpu_2_logical_apicid[i]; |
57 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) | 57 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) |
58 | ++count; | 58 | ++count; |
@@ -97,8 +97,8 @@ static inline int apicid_to_node(int logical_apicid) | |||
97 | static inline int cpu_to_logical_apicid(int cpu) | 97 | static inline int cpu_to_logical_apicid(int cpu) |
98 | { | 98 | { |
99 | #ifdef CONFIG_SMP | 99 | #ifdef CONFIG_SMP |
100 | if (cpu >= NR_CPUS) | 100 | if (cpu >= nr_cpu_ids) |
101 | return BAD_APICID; | 101 | return BAD_APICID; |
102 | return (int)cpu_2_logical_apicid[cpu]; | 102 | return (int)cpu_2_logical_apicid[cpu]; |
103 | #else | 103 | #else |
104 | return logical_smp_processor_id(); | 104 | return logical_smp_processor_id(); |
@@ -107,7 +107,7 @@ static inline int cpu_to_logical_apicid(int cpu) | |||
107 | 107 | ||
108 | static inline int cpu_present_to_apicid(int mps_cpu) | 108 | static inline int cpu_present_to_apicid(int mps_cpu) |
109 | { | 109 | { |
110 | if (mps_cpu < NR_CPUS) | 110 | if (mps_cpu < nr_cpu_ids) |
111 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | 111 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); |
112 | else | 112 | else |
113 | return BAD_APICID; | 113 | return BAD_APICID; |
@@ -146,7 +146,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
146 | 146 | ||
147 | num_bits_set = cpus_weight(*cpumask); | 147 | num_bits_set = cpus_weight(*cpumask); |
148 | /* Return id to all */ | 148 | /* Return id to all */ |
149 | if (num_bits_set == NR_CPUS) | 149 | if (num_bits_set >= nr_cpu_ids) |
150 | return (int) 0xFF; | 150 | return (int) 0xFF; |
151 | /* | 151 | /* |
152 | * The cpus in the mask must all be on the apic cluster. If are not | 152 | * The cpus in the mask must all be on the apic cluster. If are not |
@@ -173,42 +173,16 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
173 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | 173 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, |
174 | const struct cpumask *andmask) | 174 | const struct cpumask *andmask) |
175 | { | 175 | { |
176 | int num_bits_set; | 176 | int apicid = cpu_to_logical_apicid(0); |
177 | int cpus_found = 0; | ||
178 | int cpu; | ||
179 | int apicid = 0xFF; | ||
180 | cpumask_var_t cpumask; | 177 | cpumask_var_t cpumask; |
181 | 178 | ||
182 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) | 179 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) |
183 | return (int) 0xFF; | 180 | return apicid; |
184 | 181 | ||
185 | cpumask_and(cpumask, inmask, andmask); | 182 | cpumask_and(cpumask, inmask, andmask); |
186 | cpumask_and(cpumask, cpumask, cpu_online_mask); | 183 | cpumask_and(cpumask, cpumask, cpu_online_mask); |
184 | apicid = cpu_mask_to_apicid(cpumask); | ||
187 | 185 | ||
188 | num_bits_set = cpumask_weight(cpumask); | ||
189 | /* Return id to all */ | ||
190 | if (num_bits_set == nr_cpu_ids) | ||
191 | goto exit; | ||
192 | /* | ||
193 | * The cpus in the mask must all be on the apic cluster. If are not | ||
194 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
195 | */ | ||
196 | cpu = cpumask_first(cpumask); | ||
197 | apicid = cpu_to_logical_apicid(cpu); | ||
198 | while (cpus_found < num_bits_set) { | ||
199 | if (cpumask_test_cpu(cpu, cpumask)) { | ||
200 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
201 | if (apicid_cluster(apicid) != | ||
202 | apicid_cluster(new_apicid)){ | ||
203 | printk ("%s: Not a valid mask!\n", __func__); | ||
204 | return 0xFF; | ||
205 | } | ||
206 | apicid = apicid | new_apicid; | ||
207 | cpus_found++; | ||
208 | } | ||
209 | cpu++; | ||
210 | } | ||
211 | exit: | ||
212 | free_cpumask_var(cpumask); | 186 | free_cpumask_var(cpumask); |
213 | return apicid; | 187 | return apicid; |
214 | } | 188 | } |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 65d0b72777ea..fd24c55e4ae2 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -598,7 +598,7 @@ EXPORT_SYMBOL(acpi_map_lsapic); | |||
598 | int acpi_unmap_lsapic(int cpu) | 598 | int acpi_unmap_lsapic(int cpu) |
599 | { | 599 | { |
600 | per_cpu(x86_cpu_to_apicid, cpu) = -1; | 600 | per_cpu(x86_cpu_to_apicid, cpu) = -1; |
601 | cpu_clear(cpu, cpu_present_map); | 601 | set_cpu_present(cpu, false); |
602 | num_processors--; | 602 | num_processors--; |
603 | 603 | ||
604 | return (0); | 604 | return (0); |
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index 6b7f824db160..99589245fd8d 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c | |||
@@ -140,7 +140,7 @@ static int lapic_next_event(unsigned long delta, | |||
140 | struct clock_event_device *evt); | 140 | struct clock_event_device *evt); |
141 | static void lapic_timer_setup(enum clock_event_mode mode, | 141 | static void lapic_timer_setup(enum clock_event_mode mode, |
142 | struct clock_event_device *evt); | 142 | struct clock_event_device *evt); |
143 | static void lapic_timer_broadcast(const cpumask_t *mask); | 143 | static void lapic_timer_broadcast(const struct cpumask *mask); |
144 | static void apic_pm_activate(void); | 144 | static void apic_pm_activate(void); |
145 | 145 | ||
146 | /* | 146 | /* |
@@ -453,7 +453,7 @@ static void lapic_timer_setup(enum clock_event_mode mode, | |||
453 | /* | 453 | /* |
454 | * Local APIC timer broadcast function | 454 | * Local APIC timer broadcast function |
455 | */ | 455 | */ |
456 | static void lapic_timer_broadcast(const cpumask_t *mask) | 456 | static void lapic_timer_broadcast(const struct cpumask *mask) |
457 | { | 457 | { |
458 | #ifdef CONFIG_SMP | 458 | #ifdef CONFIG_SMP |
459 | send_IPI_mask(mask, LOCAL_TIMER_VECTOR); | 459 | send_IPI_mask(mask, LOCAL_TIMER_VECTOR); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 42e0853030cb..3f95a40f718a 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -355,7 +355,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
355 | printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); | 355 | printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); |
356 | } else if (smp_num_siblings > 1) { | 356 | } else if (smp_num_siblings > 1) { |
357 | 357 | ||
358 | if (smp_num_siblings > NR_CPUS) { | 358 | if (smp_num_siblings > nr_cpu_ids) { |
359 | printk(KERN_WARNING "CPU: Unsupported number of siblings %d", | 359 | printk(KERN_WARNING "CPU: Unsupported number of siblings %d", |
360 | smp_num_siblings); | 360 | smp_num_siblings); |
361 | smp_num_siblings = 1; | 361 | smp_num_siblings = 1; |
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 72cefd1e649b..62a3c23bd703 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
@@ -121,7 +121,7 @@ static int cpuid_open(struct inode *inode, struct file *file) | |||
121 | lock_kernel(); | 121 | lock_kernel(); |
122 | 122 | ||
123 | cpu = iminor(file->f_path.dentry->d_inode); | 123 | cpu = iminor(file->f_path.dentry->d_inode); |
124 | if (cpu >= NR_CPUS || !cpu_online(cpu)) { | 124 | if (cpu >= nr_cpu_ids || !cpu_online(cpu)) { |
125 | ret = -ENXIO; /* No such CPU */ | 125 | ret = -ENXIO; /* No such CPU */ |
126 | goto out; | 126 | goto out; |
127 | } | 127 | } |
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 82a7c7ed6d45..726266695b2c 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -136,7 +136,7 @@ static int msr_open(struct inode *inode, struct file *file) | |||
136 | lock_kernel(); | 136 | lock_kernel(); |
137 | cpu = iminor(file->f_path.dentry->d_inode); | 137 | cpu = iminor(file->f_path.dentry->d_inode); |
138 | 138 | ||
139 | if (cpu >= NR_CPUS || !cpu_online(cpu)) { | 139 | if (cpu >= nr_cpu_ids || !cpu_online(cpu)) { |
140 | ret = -ENXIO; /* No such CPU */ | 140 | ret = -ENXIO; /* No such CPU */ |
141 | goto out; | 141 | goto out; |
142 | } | 142 | } |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index ba7b9a0e6063..de4a9d643bee 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -449,7 +449,7 @@ void native_machine_shutdown(void) | |||
449 | 449 | ||
450 | #ifdef CONFIG_X86_32 | 450 | #ifdef CONFIG_X86_32 |
451 | /* See if there has been given a command line override */ | 451 | /* See if there has been given a command line override */ |
452 | if ((reboot_cpu != -1) && (reboot_cpu < NR_CPUS) && | 452 | if ((reboot_cpu != -1) && (reboot_cpu < nr_cpu_ids) && |
453 | cpu_online(reboot_cpu)) | 453 | cpu_online(reboot_cpu)) |
454 | reboot_cpu_id = reboot_cpu; | 454 | reboot_cpu_id = reboot_cpu; |
455 | #endif | 455 | #endif |
@@ -459,7 +459,7 @@ void native_machine_shutdown(void) | |||
459 | reboot_cpu_id = smp_processor_id(); | 459 | reboot_cpu_id = smp_processor_id(); |
460 | 460 | ||
461 | /* Make certain I only run on the appropriate processor */ | 461 | /* Make certain I only run on the appropriate processor */ |
462 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(reboot_cpu_id)); | 462 | set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id)); |
463 | 463 | ||
464 | /* O.K Now that I'm on the appropriate processor, | 464 | /* O.K Now that I'm on the appropriate processor, |
465 | * stop all of the others. | 465 | * stop all of the others. |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index f49c26bd7e2d..6bd4d9b73870 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -1154,7 +1154,7 @@ static void __init smp_cpu_index_default(void) | |||
1154 | for_each_possible_cpu(i) { | 1154 | for_each_possible_cpu(i) { |
1155 | c = &cpu_data(i); | 1155 | c = &cpu_data(i); |
1156 | /* mark all to hotplug */ | 1156 | /* mark all to hotplug */ |
1157 | c->cpu_index = NR_CPUS; | 1157 | c->cpu_index = nr_cpu_ids; |
1158 | } | 1158 | } |
1159 | } | 1159 | } |
1160 | 1160 | ||
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c index a5bc05492b1e..9840b7ec749a 100644 --- a/arch/x86/mach-voyager/voyager_smp.c +++ b/arch/x86/mach-voyager/voyager_smp.c | |||
@@ -357,9 +357,8 @@ void __init find_smp_config(void) | |||
357 | printk("VOYAGER SMP: Boot cpu is %d\n", boot_cpu_id); | 357 | printk("VOYAGER SMP: Boot cpu is %d\n", boot_cpu_id); |
358 | 358 | ||
359 | /* initialize the CPU structures (moved from smp_boot_cpus) */ | 359 | /* initialize the CPU structures (moved from smp_boot_cpus) */ |
360 | for (i = 0; i < NR_CPUS; i++) { | 360 | for (i = 0; i < nr_cpu_ids; i++) |
361 | cpu_irq_affinity[i] = ~0; | 361 | cpu_irq_affinity[i] = ~0; |
362 | } | ||
363 | cpu_online_map = cpumask_of_cpu(boot_cpu_id); | 362 | cpu_online_map = cpumask_of_cpu(boot_cpu_id); |
364 | 363 | ||
365 | /* The boot CPU must be extended */ | 364 | /* The boot CPU must be extended */ |
@@ -1227,7 +1226,7 @@ int setup_profiling_timer(unsigned int multiplier) | |||
1227 | * new values until the next timer interrupt in which they do process | 1226 | * new values until the next timer interrupt in which they do process |
1228 | * accounting. | 1227 | * accounting. |
1229 | */ | 1228 | */ |
1230 | for (i = 0; i < NR_CPUS; ++i) | 1229 | for (i = 0; i < nr_cpu_ids; ++i) |
1231 | per_cpu(prof_multiplier, i) = multiplier; | 1230 | per_cpu(prof_multiplier, i) = multiplier; |
1232 | 1231 | ||
1233 | return 0; | 1232 | return 0; |
@@ -1257,7 +1256,7 @@ void __init voyager_smp_intr_init(void) | |||
1257 | int i; | 1256 | int i; |
1258 | 1257 | ||
1259 | /* initialize the per cpu irq mask to all disabled */ | 1258 | /* initialize the per cpu irq mask to all disabled */ |
1260 | for (i = 0; i < NR_CPUS; i++) | 1259 | for (i = 0; i < nr_cpu_ids; i++) |
1261 | vic_irq_mask[i] = 0xFFFF; | 1260 | vic_irq_mask[i] = 0xFFFF; |
1262 | 1261 | ||
1263 | VIC_SET_GATE(VIC_CPI_LEVEL0, vic_cpi_interrupt); | 1262 | VIC_SET_GATE(VIC_CPI_LEVEL0, vic_cpi_interrupt); |