Commit | Line | Data |
---|---|---|
c777ac55 | 1 | |
d824e66a | 2 | #include <linux/irq.h> |
57b150cc YL |
3 | #include <linux/interrupt.h> |
4 | ||
5 | #include "internals.h" | |
c777ac55 | 6 | |
e7b946e9 | 7 | void move_masked_irq(int irq) |
c777ac55 | 8 | { |
08678b08 | 9 | struct irq_desc *desc = irq_to_desc(irq); |
c777ac55 | 10 | |
a24ceab4 | 11 | if (likely(!(desc->status & IRQ_MOVE_PENDING))) |
c777ac55 AM |
12 | return; |
13 | ||
501f2499 BH |
14 | /* |
15 | * Paranoia: cpu-local interrupts shouldn't be calling in here anyway. | |
16 | */ | |
17 | if (CHECK_IRQ_PER_CPU(desc->status)) { | |
18 | WARN_ON(1); | |
19 | return; | |
20 | } | |
21 | ||
a24ceab4 | 22 | desc->status &= ~IRQ_MOVE_PENDING; |
c777ac55 | 23 | |
7f7ace0c | 24 | if (unlikely(cpumask_empty(desc->pending_mask))) |
c777ac55 AM |
25 | return; |
26 | ||
d1bef4ed | 27 | if (!desc->chip->set_affinity) |
c777ac55 AM |
28 | return; |
29 | ||
239007b8 | 30 | assert_raw_spin_locked(&desc->lock); |
501f2499 | 31 | |
c777ac55 AM |
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 | */ |
7f7ace0c | 44 | if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask) |
57b150cc YL |
45 | < nr_cpu_ids)) |
46 | if (!desc->chip->set_affinity(irq, desc->pending_mask)) { | |
47 | cpumask_copy(desc->affinity, desc->pending_mask); | |
591d2fb0 | 48 | irq_set_thread_affinity(desc); |
57b150cc YL |
49 | } |
50 | ||
7f7ace0c | 51 | cpumask_clear(desc->pending_mask); |
c777ac55 | 52 | } |
e7b946e9 EB |
53 | |
54 | void move_native_irq(int irq) | |
55 | { | |
08678b08 | 56 | struct irq_desc *desc = irq_to_desc(irq); |
e7b946e9 EB |
57 | |
58 | if (likely(!(desc->status & IRQ_MOVE_PENDING))) | |
59 | return; | |
60 | ||
2a786b45 EB |
61 | if (unlikely(desc->status & IRQ_DISABLED)) |
62 | return; | |
e7b946e9 | 63 | |
2a786b45 | 64 | desc->chip->mask(irq); |
e7b946e9 | 65 | move_masked_irq(irq); |
2a786b45 | 66 | desc->chip->unmask(irq); |
e7b946e9 EB |
67 | } |
68 |