Lines Matching +full:interrupt +full:- +full:affinity

1 // SPDX-License-Identifier: GPL-2.0
3 * Generic cpu hotunplug interrupt migration code copied from the
12 #include <linux/interrupt.h>
19 /* For !GENERIC_IRQ_EFFECTIVE_AFF_MASK this looks at general affinity mask */
27 * The cpumask_empty() check is a workaround for interrupt chips, in irq_needs_fixup()
28 * which do not implement effective affinity, but the architecture has in irq_needs_fixup()
29 * enabled the config switch. Use the general affinity mask instead. in irq_needs_fixup()
45 pr_warn("Eff. affinity %*pbl of IRQ %u contains only offline CPUs after offlining CPU %u\n", in irq_needs_fixup()
46 cpumask_pr_args(m), d->irq, cpu); in irq_needs_fixup()
58 const struct cpumask *affinity; in migrate_one_irq() local
64 * still in the radix tree. Also if the chip has no affinity setter, in migrate_one_irq()
67 if (!chip || !chip->irq_set_affinity) { in migrate_one_irq()
68 pr_debug("IRQ %u: Unable to migrate away\n", d->irq); in migrate_one_irq()
74 * - Interrupt is per cpu in migrate_one_irq()
75 * - Interrupt is not started in migrate_one_irq()
76 * - Affinity mask does not include this CPU. in migrate_one_irq()
78 * Note: Do not check desc->action as this might be a chained in migrate_one_irq()
79 * interrupt. in migrate_one_irq()
92 * interrupt was moved in hard irq context, then the vectors need in migrate_one_irq()
93 * to be cleaned up. It can't wait until this interrupt actually in migrate_one_irq()
100 * mask, so the last change of the affinity does not get lost. If in migrate_one_irq()
102 * any online CPU, use the current affinity mask. in migrate_one_irq()
105 affinity = irq_desc_get_pending_mask(desc); in migrate_one_irq()
107 affinity = irq_data_get_affinity_mask(d); in migrate_one_irq()
110 if (maskchip && chip->irq_mask) in migrate_one_irq()
111 chip->irq_mask(d); in migrate_one_irq()
113 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { in migrate_one_irq()
115 * If the interrupt is managed, then shut it down and leave in migrate_one_irq()
116 * the affinity untouched. in migrate_one_irq()
123 affinity = cpu_online_mask; in migrate_one_irq()
128 * disables the masking of offline CPUs from the supplied affinity in migrate_one_irq()
132 err = irq_do_set_affinity(d, affinity, false); in migrate_one_irq()
134 pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", in migrate_one_irq()
135 d->irq, err); in migrate_one_irq()
139 if (maskchip && chip->irq_unmask) in migrate_one_irq()
140 chip->irq_unmask(d); in migrate_one_irq()
146 * irq_migrate_all_off_this_cpu - Migrate irqs away from offline cpu
149 * If the affinity settings do not allow other CPUs, force them onto any
164 raw_spin_lock(&desc->lock); in irq_migrate_all_off_this_cpu()
166 raw_spin_unlock(&desc->lock); in irq_migrate_all_off_this_cpu()
192 const struct cpumask *affinity = irq_data_get_affinity_mask(data); in irq_restore_affinity_of_irq() local
194 if (!irqd_affinity_is_managed(data) || !desc->action || in irq_restore_affinity_of_irq()
195 !irq_data_get_irq_chip(data) || !cpumask_test_cpu(cpu, affinity)) in irq_restore_affinity_of_irq()
204 * If the interrupt can only be directed to a single target in irq_restore_affinity_of_irq()
205 * CPU then it is already assigned to a CPU in the affinity in irq_restore_affinity_of_irq()
211 irq_set_affinity_locked(data, affinity, false); in irq_restore_affinity_of_irq()
215 * irq_affinity_online_cpu - Restore affinity for managed interrupts
226 raw_spin_lock_irq(&desc->lock); in irq_affinity_online_cpu()
228 raw_spin_unlock_irq(&desc->lock); in irq_affinity_online_cpu()