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 | |
a24ceab4 | 8 | if (likely(!(desc->status & IRQ_MOVE_PENDING))) |
c777ac55 AM |
9 | return; |
10 | ||
501f2499 BH |
11 | /* |
12 | * Paranoia: cpu-local interrupts shouldn't be calling in here anyway. | |
13 | */ | |
14 | if (CHECK_IRQ_PER_CPU(desc->status)) { | |
15 | WARN_ON(1); | |
16 | return; | |
17 | } | |
18 | ||
a24ceab4 | 19 | desc->status &= ~IRQ_MOVE_PENDING; |
c777ac55 | 20 | |
7f7ace0c | 21 | if (unlikely(cpumask_empty(desc->pending_mask))) |
c777ac55 AM |
22 | return; |
23 | ||
d1bef4ed | 24 | if (!desc->chip->set_affinity) |
c777ac55 AM |
25 | return; |
26 | ||
501f2499 BH |
27 | assert_spin_locked(&desc->lock); |
28 | ||
c777ac55 AM |
29 | /* |
30 | * If there was a valid mask to work with, please | |
31 | * do the disable, re-program, enable sequence. | |
32 | * This is *not* particularly important for level triggered | |
33 | * but in a edge trigger case, we might be setting rte | |
34 | * when an active trigger is comming in. This could | |
35 | * cause some ioapics to mal-function. | |
36 | * Being paranoid i guess! | |
e7b946e9 EB |
37 | * |
38 | * For correct operation this depends on the caller | |
39 | * masking the irqs. | |
c777ac55 | 40 | */ |
7f7ace0c | 41 | if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask) |
0de26520 | 42 | < nr_cpu_ids)) { |
7f7ace0c MT |
43 | cpumask_and(desc->affinity, |
44 | desc->pending_mask, cpu_online_mask); | |
45 | desc->chip->set_affinity(irq, desc->affinity); | |
c777ac55 | 46 | } |
7f7ace0c | 47 | cpumask_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 |