aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-12-16 20:33:55 -0500
committerMike Travis <travis@sgi.com>2008-12-16 20:40:56 -0500
commit6eeb7c5a99434596c5953a95baa17d2f085664e3 (patch)
tree30fd0b08b0a427b953beaf92927468bf86fad956
parent95d313cf1c1ecedc8bec5727b09bdacbf67dfc45 (diff)
x86: update add-cpu_mask_to_apicid_and to use struct cpumask*
Impact: use updated APIs Various API updates for x86:add-cpu_mask_to_apicid_and (Note: separate because previous patch has been "backported" to 2.6.27.) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Mike Travis <travis@sgi.com>
-rw-r--r--arch/x86/include/asm/bigsmp/apic.h10
-rw-r--r--arch/x86/include/asm/es7000/apic.h19
-rw-r--r--arch/x86/include/asm/genapic_32.h4
-rw-r--r--arch/x86/include/asm/genapic_64.h4
-rw-r--r--arch/x86/include/asm/mach-default/mach_apic.h8
-rw-r--r--arch/x86/include/asm/numaq/apic.h4
-rw-r--r--arch/x86/include/asm/summit/apic.h18
-rw-r--r--arch/x86/kernel/genapic_flat_64.c21
-rw-r--r--arch/x86/kernel/genx2apic_cluster.c10
-rw-r--r--arch/x86/kernel/genx2apic_phys.c10
-rw-r--r--arch/x86/kernel/genx2apic_uv_x.c10
11 files changed, 60 insertions, 58 deletions
diff --git a/arch/x86/include/asm/bigsmp/apic.h b/arch/x86/include/asm/bigsmp/apic.h
index 99f9abacf6a2..976399debb3f 100644
--- a/arch/x86/include/asm/bigsmp/apic.h
+++ b/arch/x86/include/asm/bigsmp/apic.h
@@ -129,8 +129,8 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
129 return apicid; 129 return apicid;
130} 130}
131 131
132static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask, 132static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
133 const cpumask_t *andmask) 133 const struct cpumask *andmask)
134{ 134{
135 int cpu; 135 int cpu;
136 136
@@ -138,9 +138,9 @@ static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask,
138 * We're using fixed IRQ delivery, can only return one phys APIC ID. 138 * We're using fixed IRQ delivery, can only return one phys APIC ID.
139 * May as well be the first. 139 * May as well be the first.
140 */ 140 */
141 while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids) 141 cpu = cpumask_any_and(cpumask, andmask);
142 if (cpu_isset(cpu, *andmask)) 142 if (cpu < nr_cpu_ids)
143 return cpu_to_logical_apicid(cpu); 143 return cpu_to_logical_apicid(cpu);
144 144
145 return BAD_APICID; 145 return BAD_APICID;
146} 146}
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h
index c2bed772af88..ba8423c5363f 100644
--- a/arch/x86/include/asm/es7000/apic.h
+++ b/arch/x86/include/asm/es7000/apic.h
@@ -214,8 +214,8 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
214 return apicid; 214 return apicid;
215} 215}
216 216
217static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask, 217static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
218 const cpumask_t *andmask) 218 const struct cpumask *andmask)
219{ 219{
220 int num_bits_set; 220 int num_bits_set;
221 int num_bits_set2; 221 int num_bits_set2;
@@ -223,9 +223,9 @@ static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask,
223 int cpu; 223 int cpu;
224 int apicid = 0; 224 int apicid = 0;
225 225
226 num_bits_set = cpus_weight(*cpumask); 226 num_bits_set = cpumask_weight(cpumask);
227 num_bits_set2 = cpus_weight(*andmask); 227 num_bits_set2 = cpumask_weight(andmask);
228 num_bits_set = min_t(int, num_bits_set, num_bits_set2); 228 num_bits_set = min(num_bits_set, num_bits_set2);
229 /* Return id to all */ 229 /* Return id to all */
230 if (num_bits_set >= nr_cpu_ids) 230 if (num_bits_set >= nr_cpu_ids)
231#if defined CONFIG_ES7000_CLUSTERED_APIC 231#if defined CONFIG_ES7000_CLUSTERED_APIC
@@ -237,11 +237,12 @@ static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask,
237 * The cpus in the mask must all be on the apic cluster. If are not 237 * The cpus in the mask must all be on the apic cluster. If are not
238 * on the same apicid cluster return default value of TARGET_CPUS. 238 * on the same apicid cluster return default value of TARGET_CPUS.
239 */ 239 */
240 while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids) 240 cpu = cpumask_first_and(cpumask, andmask);
241 if (cpu_isset(cpu, *andmask) 241 apicid = cpu_to_logical_apicid(cpu);
242 apicid = cpu_to_logical_apicid(cpu); 242
243 while (cpus_found < num_bits_set) { 243 while (cpus_found < num_bits_set) {
244 if (cpu_isset(cpu, *cpumask) && cpu_isset(cpu, *andmask)) { 244 if (cpumask_test_cpu(cpu, cpumask) &&
245 cpumask_test_cpu(cpu, andmask)) {
245 int new_apicid = cpu_to_logical_apicid(cpu); 246 int new_apicid = cpu_to_logical_apicid(cpu);
246 if (apicid_cluster(apicid) != 247 if (apicid_cluster(apicid) !=
247 apicid_cluster(new_apicid)) { 248 apicid_cluster(new_apicid)) {
diff --git a/arch/x86/include/asm/genapic_32.h b/arch/x86/include/asm/genapic_32.h
index 325298a82237..eed6e305291f 100644
--- a/arch/x86/include/asm/genapic_32.h
+++ b/arch/x86/include/asm/genapic_32.h
@@ -58,8 +58,8 @@ struct genapic {
58 unsigned (*get_apic_id)(unsigned long x); 58 unsigned (*get_apic_id)(unsigned long x);
59 unsigned long apic_id_mask; 59 unsigned long apic_id_mask;
60 unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask); 60 unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask);
61 unsigned int (*cpu_mask_to_apicid_and)(const cpumask_t *cpumask, 61 unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
62 const cpumask_t *andmask); 62 const struct cpumask *andmask);
63 void (*vector_allocation_domain)(int cpu, cpumask_t *retmask); 63 void (*vector_allocation_domain)(int cpu, cpumask_t *retmask);
64 64
65#ifdef CONFIG_SMP 65#ifdef CONFIG_SMP
diff --git a/arch/x86/include/asm/genapic_64.h b/arch/x86/include/asm/genapic_64.h
index 301c7f41125d..244b71729ecb 100644
--- a/arch/x86/include/asm/genapic_64.h
+++ b/arch/x86/include/asm/genapic_64.h
@@ -31,8 +31,8 @@ struct genapic {
31 void (*send_IPI_self)(int vector); 31 void (*send_IPI_self)(int vector);
32 /* */ 32 /* */
33 unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask); 33 unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask);
34 unsigned int (*cpu_mask_to_apicid_and)(const cpumask_t *cpumask, 34 unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
35 const cpumask_t *andmask); 35 const struct cpumask *andmask);
36 unsigned int (*phys_pkg_id)(int index_msb); 36 unsigned int (*phys_pkg_id)(int index_msb);
37 unsigned int (*get_apic_id)(unsigned long x); 37 unsigned int (*get_apic_id)(unsigned long x);
38 unsigned long (*set_apic_id)(unsigned int id); 38 unsigned long (*set_apic_id)(unsigned int id);
diff --git a/arch/x86/include/asm/mach-default/mach_apic.h b/arch/x86/include/asm/mach-default/mach_apic.h
index 229b605d104e..df8e024c43c5 100644
--- a/arch/x86/include/asm/mach-default/mach_apic.h
+++ b/arch/x86/include/asm/mach-default/mach_apic.h
@@ -67,11 +67,11 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
67 return cpus_addr(*cpumask)[0]; 67 return cpus_addr(*cpumask)[0];
68} 68}
69 69
70static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask, 70static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
71 const cpumask_t *andmask) 71 const struct cpumask *andmask)
72{ 72{
73 unsigned long mask1 = cpus_addr(*cpumask)[0]; 73 unsigned long mask1 = cpumask_bits(cpumask)[0];
74 unsigned long mask2 = cpus_addr(*andmask)[0]; 74 unsigned long mask2 = cpumask_bits(andmask)[0];
75 75
76 return (unsigned int)(mask1 & mask2); 76 return (unsigned int)(mask1 & mask2);
77} 77}
diff --git a/arch/x86/include/asm/numaq/apic.h b/arch/x86/include/asm/numaq/apic.h
index abf668ced503..c80f00d29965 100644
--- a/arch/x86/include/asm/numaq/apic.h
+++ b/arch/x86/include/asm/numaq/apic.h
@@ -127,8 +127,8 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
127 return (int) 0xF; 127 return (int) 0xF;
128} 128}
129 129
130static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask, 130static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
131 const cpumask_t *andmask) 131 const struct cpumask *andmask)
132{ 132{
133 return (int) 0xF; 133 return (int) 0xF;
134} 134}
diff --git a/arch/x86/include/asm/summit/apic.h b/arch/x86/include/asm/summit/apic.h
index cbcc2c7eb1d5..651a93849341 100644
--- a/arch/x86/include/asm/summit/apic.h
+++ b/arch/x86/include/asm/summit/apic.h
@@ -170,8 +170,8 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
170 return apicid; 170 return apicid;
171} 171}
172 172
173static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask, 173static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
174 const cpumask_t *andmask) 174 const struct cpumask *andmask)
175{ 175{
176 int num_bits_set; 176 int num_bits_set;
177 int num_bits_set2; 177 int num_bits_set2;
@@ -179,9 +179,9 @@ static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask,
179 int cpu; 179 int cpu;
180 int apicid = 0; 180 int apicid = 0;
181 181
182 num_bits_set = cpus_weight(*cpumask); 182 num_bits_set = cpumask_weight(cpumask);
183 num_bits_set2 = cpus_weight(*andmask); 183 num_bits_set2 = cpumask_weight(andmask);
184 num_bits_set = min_t(int, num_bits_set, num_bits_set2); 184 num_bits_set = min(num_bits_set, num_bits_set2);
185 /* Return id to all */ 185 /* Return id to all */
186 if (num_bits_set >= nr_cpu_ids) 186 if (num_bits_set >= nr_cpu_ids)
187 return 0xFF; 187 return 0xFF;
@@ -189,11 +189,11 @@ static inline unsigned int cpu_mask_to_apicid_and(const cpumask_t *cpumask,
189 * The cpus in the mask must all be on the apic cluster. If are not 189 * The cpus in the mask must all be on the apic cluster. If are not
190 * on the same apicid cluster return default value of TARGET_CPUS. 190 * on the same apicid cluster return default value of TARGET_CPUS.
191 */ 191 */
192 while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids) 192 cpu = cpumask_first_and(cpumask, andmask);
193 if (cpu_isset(cpu, *andmask) 193 apicid = cpu_to_logical_apicid(cpu);
194 apicid = cpu_to_logical_apicid(cpu);
195 while (cpus_found < num_bits_set) { 194 while (cpus_found < num_bits_set) {
196 if (cpu_isset(cpu, *cpumask) && cpu_isset(cpu, *andmask)) { 195 if (cpumask_test_cpu(cpu, cpumask)
196 && cpumask_test_cpu(cpu, andmask)) {
197 int new_apicid = cpu_to_logical_apicid(cpu); 197 int new_apicid = cpu_to_logical_apicid(cpu);
198 if (apicid_cluster(apicid) != 198 if (apicid_cluster(apicid) !=
199 apicid_cluster(new_apicid)) { 199 apicid_cluster(new_apicid)) {
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c
index 1efecd206a74..c772bb10b173 100644
--- a/arch/x86/kernel/genapic_flat_64.c
+++ b/arch/x86/kernel/genapic_flat_64.c
@@ -158,13 +158,13 @@ static unsigned int flat_cpu_mask_to_apicid(const cpumask_t *cpumask)
158 return cpus_addr(*cpumask)[0] & APIC_ALL_CPUS; 158 return cpus_addr(*cpumask)[0] & APIC_ALL_CPUS;
159} 159}
160 160
161static unsigned int flat_cpu_mask_to_apicid_and(const cpumask_t *cpumask, 161static unsigned int flat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
162 const cpumask_t *andmask) 162 const struct cpumask *andmask)
163{ 163{
164 unsigned long mask1 = cpus_addr(*cpumask)[0] & APIC_ALL_CPUS; 164 unsigned long mask1 = cpumask_bits(cpumask)[0] & APIC_ALL_CPUS;
165 unsigned long mask2 = cpus_addr(*andmask)[0] & APIC_ALL_CPUS; 165 unsigned long mask2 = cpumask_bits(andmask)[0] & APIC_ALL_CPUS;
166 166
167 return (int)(mask1 & mask2); 167 return mask1 & mask2;
168} 168}
169 169
170static unsigned int phys_pkg_id(int index_msb) 170static unsigned int phys_pkg_id(int index_msb)
@@ -264,8 +264,9 @@ static unsigned int physflat_cpu_mask_to_apicid(const cpumask_t *cpumask)
264 return BAD_APICID; 264 return BAD_APICID;
265} 265}
266 266
267static unsigned int physflat_cpu_mask_to_apicid_and(const cpumask_t *cpumask, 267static unsigned int
268 const cpumask_t *andmask) 268physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
269 const struct cpumask *andmask)
269{ 270{
270 int cpu; 271 int cpu;
271 272
@@ -273,9 +274,9 @@ static unsigned int physflat_cpu_mask_to_apicid_and(const cpumask_t *cpumask,
273 * We're using fixed IRQ delivery, can only return one phys APIC ID. 274 * We're using fixed IRQ delivery, can only return one phys APIC ID.
274 * May as well be the first. 275 * May as well be the first.
275 */ 276 */
276 while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids) 277 cpu = cpumask_any_and(cpumask, andmask);
277 if (cpu_isset(cpu, *andmask)) 278 if (cpu < nr_cpu_ids)
278 return per_cpu(x86_cpu_to_apicid, cpu); 279 return per_cpu(x86_cpu_to_apicid, cpu);
279 return BAD_APICID; 280 return BAD_APICID;
280} 281}
281 282
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c
index fd8047f4e455..e7d16f53b9cd 100644
--- a/arch/x86/kernel/genx2apic_cluster.c
+++ b/arch/x86/kernel/genx2apic_cluster.c
@@ -123,8 +123,8 @@ static unsigned int x2apic_cpu_mask_to_apicid(const cpumask_t *cpumask)
123 return BAD_APICID; 123 return BAD_APICID;
124} 124}
125 125
126static unsigned int x2apic_cpu_mask_to_apicid_and(const cpumask_t *cpumask, 126static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
127 const cpumask_t *andmask) 127 const struct cpumask *andmask)
128{ 128{
129 int cpu; 129 int cpu;
130 130
@@ -132,9 +132,9 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const cpumask_t *cpumask,
132 * We're using fixed IRQ delivery, can only return one phys APIC ID. 132 * We're using fixed IRQ delivery, can only return one phys APIC ID.
133 * May as well be the first. 133 * May as well be the first.
134 */ 134 */
135 while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids) 135 cpu = cpumask_any_and(cpumask, andmask);
136 if (cpu_isset(cpu, *andmask)) 136 if (cpu < nr_cpu_ids)
137 return per_cpu(x86_cpu_to_apicid, cpu); 137 return per_cpu(x86_cpu_to_apicid, cpu);
138 return BAD_APICID; 138 return BAD_APICID;
139} 139}
140 140
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c
index d5578bb8f165..9d0386c7e798 100644
--- a/arch/x86/kernel/genx2apic_phys.c
+++ b/arch/x86/kernel/genx2apic_phys.c
@@ -122,8 +122,8 @@ static unsigned int x2apic_cpu_mask_to_apicid(const cpumask_t *cpumask)
122 return BAD_APICID; 122 return BAD_APICID;
123} 123}
124 124
125static unsigned int x2apic_cpu_mask_to_apicid_and(const cpumask_t *cpumask, 125static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
126 const cpumask_t *andmask) 126 const struct cpumask *andmask)
127{ 127{
128 int cpu; 128 int cpu;
129 129
@@ -131,9 +131,9 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const cpumask_t *cpumask,
131 * We're using fixed IRQ delivery, can only return one phys APIC ID. 131 * We're using fixed IRQ delivery, can only return one phys APIC ID.
132 * May as well be the first. 132 * May as well be the first.
133 */ 133 */
134 while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids) 134 cpu = cpumask_any_and(cpumask, andmask);
135 if (cpu_isset(cpu, *andmask)) 135 if (cpu < nr_cpu_ids)
136 return per_cpu(x86_cpu_to_apicid, cpu); 136 return per_cpu(x86_cpu_to_apicid, cpu);
137 return BAD_APICID; 137 return BAD_APICID;
138} 138}
139 139
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c
index 53bd2570272c..22596ec94c82 100644
--- a/arch/x86/kernel/genx2apic_uv_x.c
+++ b/arch/x86/kernel/genx2apic_uv_x.c
@@ -179,8 +179,8 @@ static unsigned int uv_cpu_mask_to_apicid(const cpumask_t *cpumask)
179 return BAD_APICID; 179 return BAD_APICID;
180} 180}
181 181
182static unsigned int uv_cpu_mask_to_apicid_and(const cpumask_t *cpumask, 182static unsigned int uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
183 const cpumask_t *andmask) 183 const struct cpumask *andmask)
184{ 184{
185 int cpu; 185 int cpu;
186 186
@@ -188,9 +188,9 @@ static unsigned int uv_cpu_mask_to_apicid_and(const cpumask_t *cpumask,
188 * We're using fixed IRQ delivery, can only return one phys APIC ID. 188 * We're using fixed IRQ delivery, can only return one phys APIC ID.
189 * May as well be the first. 189 * May as well be the first.
190 */ 190 */
191 while ((cpu = next_cpu(-1, *cpumask)) < nr_cpu_ids) 191 cpu = cpumask_any_and(cpumask, andmask);
192 if (cpu_isset(cpu, *andmask)) 192 if (cpu < nr_cpu_ids)
193 return per_cpu(x86_cpu_to_apicid, cpu); 193 return per_cpu(x86_cpu_to_apicid, cpu);
194 return BAD_APICID; 194 return BAD_APICID;
195} 195}
196 196