Lines Matching +full:single +full:- +full:cpu
1 // SPDX-License-Identifier: GPL-2.0
15 * irq_reserve_ipi() - Setup an IPI to destination cpumask
19 * Allocate a virq that can be used to send IPI to any CPU in dest mask.
32 return -EINVAL; in irq_reserve_ipi()
37 return -EINVAL; in irq_reserve_ipi()
43 return -EINVAL; in irq_reserve_ipi()
48 * If the underlying implementation uses a single HW irq on in irq_reserve_ipi()
49 * all cpus then we only need a single Linux irq number for in irq_reserve_ipi()
59 * The IPI requires a separate HW irq on each CPU. We require in irq_reserve_ipi()
74 return -EINVAL; in irq_reserve_ipi()
78 virq = irq_domain_alloc_descs(-1, nr_irqs, 0, NUMA_NO_NODE, NULL); in irq_reserve_ipi()
81 return -ENOMEM; in irq_reserve_ipi()
94 cpumask_copy(data->common->affinity, dest); in irq_reserve_ipi()
95 data->common->ipi_offset = offset; in irq_reserve_ipi()
102 return -EBUSY; in irq_reserve_ipi()
106 * irq_destroy_ipi() - unreserve an IPI that was previously allocated
123 return -EINVAL; in irq_destroy_ipi()
125 domain = data->domain; in irq_destroy_ipi()
127 return -EINVAL; in irq_destroy_ipi()
131 return -EINVAL; in irq_destroy_ipi()
140 return -EINVAL; in irq_destroy_ipi()
143 irq = irq + cpumask_first(dest) - data->common->ipi_offset; in irq_destroy_ipi()
154 * ipi_get_hwirq - Get the hwirq associated with an IPI to a CPU
156 * @cpu: the target CPU
163 irq_hw_number_t ipi_get_hwirq(unsigned int irq, unsigned int cpu) in ipi_get_hwirq() argument
168 if (!data || cpu >= nr_cpu_ids) in ipi_get_hwirq()
172 if (!ipimask || !cpumask_test_cpu(cpu, ipimask)) in ipi_get_hwirq()
177 * uses a separate irq per cpu. If the underlying implementation uses in ipi_get_hwirq()
178 * a single hardware irq for all cpus then the IPI send mechanism in ipi_get_hwirq()
179 * needs to take care of the cpu destinations. in ipi_get_hwirq()
181 if (irq_domain_is_ipi_per_cpu(data->domain)) in ipi_get_hwirq()
182 data = irq_get_irq_data(irq + cpu - data->common->ipi_offset); in ipi_get_hwirq()
189 const struct cpumask *dest, unsigned int cpu) in ipi_send_verify() argument
194 return -EINVAL; in ipi_send_verify()
196 if (!chip->ipi_send_single && !chip->ipi_send_mask) in ipi_send_verify()
197 return -EINVAL; in ipi_send_verify()
199 if (cpu >= nr_cpu_ids) in ipi_send_verify()
200 return -EINVAL; in ipi_send_verify()
204 return -EINVAL; in ipi_send_verify()
208 return -EINVAL; in ipi_send_verify()
210 if (!cpumask_test_cpu(cpu, ipimask)) in ipi_send_verify()
211 return -EINVAL; in ipi_send_verify()
217 * __ipi_send_single - send an IPI to a target Linux SMP CPU
219 * @cpu: destination CPU, must in the destination mask passed to
227 int __ipi_send_single(struct irq_desc *desc, unsigned int cpu) in __ipi_send_single() argument
238 if (WARN_ON_ONCE(ipi_send_verify(chip, data, NULL, cpu))) in __ipi_send_single()
239 return -EINVAL; in __ipi_send_single()
241 if (!chip->ipi_send_single) { in __ipi_send_single()
242 chip->ipi_send_mask(data, cpumask_of(cpu)); in __ipi_send_single()
247 if (irq_domain_is_ipi_per_cpu(data->domain) && in __ipi_send_single()
248 cpu != data->common->ipi_offset) { in __ipi_send_single()
249 /* use the correct data for that cpu */ in __ipi_send_single()
250 unsigned irq = data->irq + cpu - data->common->ipi_offset; in __ipi_send_single()
254 chip->ipi_send_single(data, cpu); in __ipi_send_single()
259 * __ipi_send_mask - send an IPI to target Linux SMP CPU(s)
261 * @dest: dest CPU(s), must be a subset of the mask passed to
273 unsigned int cpu; in __ipi_send_mask() local
282 return -EINVAL; in __ipi_send_mask()
284 if (chip->ipi_send_mask) { in __ipi_send_mask()
285 chip->ipi_send_mask(data, dest); in __ipi_send_mask()
289 if (irq_domain_is_ipi_per_cpu(data->domain)) { in __ipi_send_mask()
290 unsigned int base = data->irq; in __ipi_send_mask()
292 for_each_cpu(cpu, dest) { in __ipi_send_mask()
293 unsigned irq = base + cpu - data->common->ipi_offset; in __ipi_send_mask()
296 chip->ipi_send_single(data, cpu); in __ipi_send_mask()
299 for_each_cpu(cpu, dest) in __ipi_send_mask()
300 chip->ipi_send_single(data, cpu); in __ipi_send_mask()
306 * ipi_send_single - Send an IPI to a single CPU
308 * @cpu: destination CPU, must in the destination mask passed to
313 int ipi_send_single(unsigned int virq, unsigned int cpu) in ipi_send_single() argument
319 if (WARN_ON_ONCE(ipi_send_verify(chip, data, NULL, cpu))) in ipi_send_single()
320 return -EINVAL; in ipi_send_single()
322 return __ipi_send_single(desc, cpu); in ipi_send_single()
327 * ipi_send_mask - Send an IPI to target CPU(s)
329 * @dest: dest CPU(s), must be a subset of the mask passed to
341 return -EINVAL; in ipi_send_mask()