Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 259098
b: refs/heads/master
c: 6ec36b5
h: refs/heads/master
v: v3
  • Loading branch information
Stuart Yoder authored and Kumar Gala committed Jun 23, 2011
1 parent 128168c commit 0970394
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 37 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 47fe819e7555b31d24f8a11d9b2568d8f5de8b01
refs/heads/master: 6ec36b5848a8336d3a0010727b9365c3254d2d2e
2 changes: 2 additions & 0 deletions trunk/arch/powerpc/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,5 +330,7 @@ extern int call_handle_irq(int irq, void *p1,
struct thread_info *tp, void *func);
extern void do_IRQ(struct pt_regs *regs);

int irq_choose_cpu(const struct cpumask *mask);

#endif /* _ASM_IRQ_H */
#endif /* __KERNEL__ */
35 changes: 35 additions & 0 deletions trunk/arch/powerpc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,41 @@ unsigned int irq_find_mapping(struct irq_host *host,
}
EXPORT_SYMBOL_GPL(irq_find_mapping);

#ifdef CONFIG_SMP
int irq_choose_cpu(const struct cpumask *mask)
{
int cpuid;

if (cpumask_equal(mask, cpu_all_mask)) {
static int irq_rover;
static DEFINE_RAW_SPINLOCK(irq_rover_lock);
unsigned long flags;

/* Round-robin distribution... */
do_round_robin:
raw_spin_lock_irqsave(&irq_rover_lock, flags);

irq_rover = cpumask_next(irq_rover, cpu_online_mask);
if (irq_rover >= nr_cpu_ids)
irq_rover = cpumask_first(cpu_online_mask);

cpuid = irq_rover;

raw_spin_unlock_irqrestore(&irq_rover_lock, flags);
} else {
cpuid = cpumask_first_and(mask, cpu_online_mask);
if (cpuid >= nr_cpu_ids)
goto do_round_robin;
}

return get_hard_smp_processor_id(cpuid);
}
#else
int irq_choose_cpu(const struct cpumask *mask)
{
return hard_smp_processor_id();
}
#endif

unsigned int irq_radix_revmap_lookup(struct irq_host *host,
irq_hw_number_t hwirq)
Expand Down
36 changes: 0 additions & 36 deletions trunk/arch/powerpc/sysdev/mpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,42 +597,6 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)

#endif /* CONFIG_MPIC_U3_HT_IRQS */

#ifdef CONFIG_SMP
static int irq_choose_cpu(const struct cpumask *mask)
{
int cpuid;

if (cpumask_equal(mask, cpu_all_mask)) {
static int irq_rover = 0;
static DEFINE_RAW_SPINLOCK(irq_rover_lock);
unsigned long flags;

/* Round-robin distribution... */
do_round_robin:
raw_spin_lock_irqsave(&irq_rover_lock, flags);

irq_rover = cpumask_next(irq_rover, cpu_online_mask);
if (irq_rover >= nr_cpu_ids)
irq_rover = cpumask_first(cpu_online_mask);

cpuid = irq_rover;

raw_spin_unlock_irqrestore(&irq_rover_lock, flags);
} else {
cpuid = cpumask_first_and(mask, cpu_online_mask);
if (cpuid >= nr_cpu_ids)
goto do_round_robin;
}

return get_hard_smp_processor_id(cpuid);
}
#else
static int irq_choose_cpu(const struct cpumask *mask)
{
return hard_smp_processor_id();
}
#endif

/* Find an mpic associated with a given linux interrupt */
static struct mpic *mpic_find(unsigned int irq)
{
Expand Down

0 comments on commit 0970394

Please sign in to comment.