]>
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 | |
a439520f | 7 | void irq_move_masked_irq(struct irq_data *idata) |
c777ac55 | 8 | { |
a439520f TG |
9 | struct irq_desc *desc = irq_data_to_desc(idata); |
10 | struct irq_chip *chip = idata->chip; | |
c777ac55 | 11 | |
f230b6d5 | 12 | if (likely(!irqd_is_setaffinity_pending(&desc->irq_data))) |
c777ac55 AM |
13 | return; |
14 | ||
501f2499 BH |
15 | /* |
16 | * Paranoia: cpu-local interrupts shouldn't be calling in here anyway. | |
17 | */ | |
a005677b | 18 | if (!irqd_can_balance(&desc->irq_data)) { |
501f2499 BH |
19 | WARN_ON(1); |
20 | return; | |
21 | } | |
22 | ||
f230b6d5 | 23 | irqd_clr_move_pending(&desc->irq_data); |
c777ac55 | 24 | |
7f7ace0c | 25 | if (unlikely(cpumask_empty(desc->pending_mask))) |
c777ac55 AM |
26 | return; |
27 | ||
c96b3b3c | 28 | if (!chip->irq_set_affinity) |
c777ac55 AM |
29 | return; |
30 | ||
239007b8 | 31 | assert_raw_spin_locked(&desc->lock); |
501f2499 | 32 | |
c777ac55 AM |
33 | /* |
34 | * If there was a valid mask to work with, please | |
35 | * do the disable, re-program, enable sequence. | |
36 | * This is *not* particularly important for level triggered | |
37 | * but in a edge trigger case, we might be setting rte | |
25985edc | 38 | * when an active trigger is coming in. This could |
c777ac55 AM |
39 | * cause some ioapics to mal-function. |
40 | * Being paranoid i guess! | |
e7b946e9 EB |
41 | * |
42 | * For correct operation this depends on the caller | |
43 | * masking the irqs. | |
c777ac55 | 44 | */ |
818b0f3b JL |
45 | if (cpumask_any_and(desc->pending_mask, cpu_online_mask) < nr_cpu_ids) |
46 | irq_do_set_affinity(&desc->irq_data, desc->pending_mask, false); | |
57b150cc | 47 | |
7f7ace0c | 48 | cpumask_clear(desc->pending_mask); |
c777ac55 | 49 | } |
e7b946e9 | 50 | |
a439520f | 51 | void irq_move_irq(struct irq_data *idata) |
e7b946e9 | 52 | { |
f1a06390 | 53 | bool masked; |
e7b946e9 | 54 | |
a439520f | 55 | if (likely(!irqd_is_setaffinity_pending(idata))) |
e7b946e9 EB |
56 | return; |
57 | ||
32f4125e | 58 | if (unlikely(irqd_irq_disabled(idata))) |
2a786b45 | 59 | return; |
e7b946e9 | 60 | |
f1a06390 TG |
61 | /* |
62 | * Be careful vs. already masked interrupts. If this is a | |
63 | * threaded interrupt with ONESHOT set, we can end up with an | |
64 | * interrupt storm. | |
65 | */ | |
32f4125e | 66 | masked = irqd_irq_masked(idata); |
f1a06390 | 67 | if (!masked) |
a439520f TG |
68 | idata->chip->irq_mask(idata); |
69 | irq_move_masked_irq(idata); | |
f1a06390 | 70 | if (!masked) |
a439520f TG |
71 | idata->chip->irq_unmask(idata); |
72 | } |