migration.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <linux/irq.h>
  2. #include <linux/interrupt.h>
  3. #include "internals.h"
  4. void irq_move_masked_irq(struct irq_data *idata)
  5. {
  6. struct irq_desc *desc = irq_data_to_desc(idata);
  7. struct irq_chip *chip = idata->chip;
  8. if (likely(!irqd_is_setaffinity_pending(&desc->irq_data)))
  9. return;
  10. /*
  11. * Paranoia: cpu-local interrupts shouldn't be calling in here anyway.
  12. */
  13. if (!irqd_can_balance(&desc->irq_data)) {
  14. WARN_ON(1);
  15. return;
  16. }
  17. irqd_clr_move_pending(&desc->irq_data);
  18. if (unlikely(cpumask_empty(desc->pending_mask)))
  19. return;
  20. if (!chip->irq_set_affinity)
  21. return;
  22. assert_raw_spin_locked(&desc->lock);
  23. /*
  24. * If there was a valid mask to work with, please
  25. * do the disable, re-program, enable sequence.
  26. * This is *not* particularly important for level triggered
  27. * but in a edge trigger case, we might be setting rte
  28. * when an active trigger is coming in. This could
  29. * cause some ioapics to mal-function.
  30. * Being paranoid i guess!
  31. *
  32. * For correct operation this depends on the caller
  33. * masking the irqs.
  34. */
  35. if (cpumask_any_and(desc->pending_mask, cpu_online_mask) < nr_cpu_ids)
  36. irq_do_set_affinity(&desc->irq_data, desc->pending_mask, false);
  37. cpumask_clear(desc->pending_mask);
  38. }
  39. void irq_move_irq(struct irq_data *idata)
  40. {
  41. bool masked;
  42. if (likely(!irqd_is_setaffinity_pending(idata)))
  43. return;
  44. if (unlikely(irqd_irq_disabled(idata)))
  45. return;
  46. /*
  47. * Be careful vs. already masked interrupts. If this is a
  48. * threaded interrupt with ONESHOT set, we can end up with an
  49. * interrupt storm.
  50. */
  51. masked = irqd_irq_masked(idata);
  52. if (!masked)
  53. idata->chip->irq_mask(idata);
  54. irq_move_masked_irq(idata);
  55. if (!masked)
  56. idata->chip->irq_unmask(idata);
  57. }