diff options
Diffstat (limited to 'arch/sparc/kernel/irq_64.c')
-rw-r--r-- | arch/sparc/kernel/irq_64.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c index e5e78f9cfc95..bd075054942b 100644 --- a/arch/sparc/kernel/irq_64.c +++ b/arch/sparc/kernel/irq_64.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <asm/cacheflush.h> | 45 | #include <asm/cacheflush.h> |
46 | 46 | ||
47 | #include "entry.h" | 47 | #include "entry.h" |
48 | #include "cpumap.h" | ||
48 | 49 | ||
49 | #define NUM_IVECS (IMAP_INR + 1) | 50 | #define NUM_IVECS (IMAP_INR + 1) |
50 | 51 | ||
@@ -256,35 +257,13 @@ static int irq_choose_cpu(unsigned int virt_irq) | |||
256 | int cpuid; | 257 | int cpuid; |
257 | 258 | ||
258 | cpumask_copy(&mask, irq_desc[virt_irq].affinity); | 259 | cpumask_copy(&mask, irq_desc[virt_irq].affinity); |
259 | if (cpus_equal(mask, CPU_MASK_ALL)) { | 260 | if (cpus_equal(mask, cpu_online_map)) { |
260 | static int irq_rover; | 261 | cpuid = map_to_cpu(virt_irq); |
261 | static DEFINE_SPINLOCK(irq_rover_lock); | ||
262 | unsigned long flags; | ||
263 | |||
264 | /* Round-robin distribution... */ | ||
265 | do_round_robin: | ||
266 | spin_lock_irqsave(&irq_rover_lock, flags); | ||
267 | |||
268 | while (!cpu_online(irq_rover)) { | ||
269 | if (++irq_rover >= nr_cpu_ids) | ||
270 | irq_rover = 0; | ||
271 | } | ||
272 | cpuid = irq_rover; | ||
273 | do { | ||
274 | if (++irq_rover >= nr_cpu_ids) | ||
275 | irq_rover = 0; | ||
276 | } while (!cpu_online(irq_rover)); | ||
277 | |||
278 | spin_unlock_irqrestore(&irq_rover_lock, flags); | ||
279 | } else { | 262 | } else { |
280 | cpumask_t tmp; | 263 | cpumask_t tmp; |
281 | 264 | ||
282 | cpus_and(tmp, cpu_online_map, mask); | 265 | cpus_and(tmp, cpu_online_map, mask); |
283 | 266 | cpuid = cpus_empty(tmp) ? map_to_cpu(virt_irq) : first_cpu(tmp); | |
284 | if (cpus_empty(tmp)) | ||
285 | goto do_round_robin; | ||
286 | |||
287 | cpuid = first_cpu(tmp); | ||
288 | } | 267 | } |
289 | 268 | ||
290 | return cpuid; | 269 | return cpuid; |