Luca's patch ported
[cbs-scheduler.git] / kernel / irq / migration.c
blobfaf4bc343230001325679af0e21f585a1d44b931
2 #include <linux/irq.h>
4 void move_masked_irq(int irq)
6 struct irq_desc *desc = irq_to_desc(irq);
8 if (likely(!(desc->status & IRQ_MOVE_PENDING)))
9 return;
12 * Paranoia: cpu-local interrupts shouldn't be calling in here anyway.
14 if (CHECK_IRQ_PER_CPU(desc->status)) {
15 WARN_ON(1);
16 return;
19 desc->status &= ~IRQ_MOVE_PENDING;
21 if (unlikely(cpumask_empty(desc->pending_mask)))
22 return;
24 if (!desc->chip->set_affinity)
25 return;
27 assert_spin_locked(&desc->lock);
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!
38 * For correct operation this depends on the caller
39 * masking the irqs.
41 if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask)
42 < nr_cpu_ids)) {
43 cpumask_and(desc->affinity,
44 desc->pending_mask, cpu_online_mask);
45 desc->chip->set_affinity(irq, desc->affinity);
47 cpumask_clear(desc->pending_mask);
50 void move_native_irq(int irq)
52 struct irq_desc *desc = irq_to_desc(irq);
53 int mask = 1;
55 if (likely(!(desc->status & IRQ_MOVE_PENDING)))
56 return;
58 if (unlikely(desc->status & IRQ_DISABLED))
59 return;
62 * If the irq is already in progress, it should be masked.
63 * If we unmask it, we might cause an interrupt storm on RT.
65 if (unlikely(desc->status & IRQ_INPROGRESS))
66 mask = 0;
68 if (mask)
69 desc->chip->mask(irq);
70 move_masked_irq(irq);
71 if (mask)
72 desc->chip->unmask(irq);