Commit | Line | Data |
---|---|---|
c777ac55 | 1 | |
d824e66a | 2 | #include <linux/irq.h> |
c777ac55 | 3 | |
e7b946e9 | 4 | void move_masked_irq(int irq) |
c777ac55 | 5 | { |
08678b08 | 6 | struct irq_desc *desc = irq_to_desc(irq); |
c777ac55 | 7 | cpumask_t tmp; |
c777ac55 | 8 | |
a24ceab4 | 9 | if (likely(!(desc->status & IRQ_MOVE_PENDING))) |
c777ac55 AM |
10 | return; |
11 | ||
501f2499 BH |
12 | /* |
13 | * Paranoia: cpu-local interrupts shouldn't be calling in here anyway. | |
14 | */ | |
15 | if (CHECK_IRQ_PER_CPU(desc->status)) { | |
16 | WARN_ON(1); | |
17 | return; | |
18 | } | |
19 | ||
a24ceab4 | 20 | desc->status &= ~IRQ_MOVE_PENDING; |
c777ac55 | 21 | |
08678b08 | 22 | if (unlikely(cpus_empty(desc->pending_mask))) |
c777ac55 AM |
23 | return; |
24 | ||
d1bef4ed | 25 | if (!desc->chip->set_affinity) |
c777ac55 AM |
26 | return; |
27 | ||
501f2499 BH |
28 | assert_spin_locked(&desc->lock); |
29 | ||
08678b08 | 30 | cpus_and(tmp, desc->pending_mask, cpu_online_map); |
c777ac55 AM |
31 | |
32 | /* | |
33 | * If there was a valid mask to work with, please | |
34 | * do the disable, re-program, enable sequence. | |
35 | * This is *not* particularly important for level triggered | |
36 | * but in a edge trigger case, we might be setting rte | |
37 | * when an active trigger is comming in. This could | |
38 | * cause some ioapics to mal-function. | |
39 | * Being paranoid i guess! | |
e7b946e9 EB |
40 | * |
41 | * For correct operation this depends on the caller | |
42 | * masking the irqs. | |
c777ac55 | 43 | */ |
89d0cf01 | 44 | if (likely(!cpus_empty(tmp))) { |
d1bef4ed | 45 | desc->chip->set_affinity(irq,tmp); |
c777ac55 | 46 | } |
08678b08 | 47 | cpus_clear(desc->pending_mask); |
c777ac55 | 48 | } |
e7b946e9 EB |
49 | |
50 | void move_native_irq(int irq) | |
51 | { | |
08678b08 | 52 | struct irq_desc *desc = irq_to_desc(irq); |
e7b946e9 EB |
53 | |
54 | if (likely(!(desc->status & IRQ_MOVE_PENDING))) | |
55 | return; | |
56 | ||
2a786b45 EB |
57 | if (unlikely(desc->status & IRQ_DISABLED)) |
58 | return; | |
e7b946e9 | 59 | |
2a786b45 | 60 | desc->chip->mask(irq); |
e7b946e9 | 61 | move_masked_irq(irq); |
2a786b45 | 62 | desc->chip->unmask(irq); |
e7b946e9 EB |
63 | } |
64 |