aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-09-14 10:18:49 -0400
committerThomas Gleixner <tglx@linutronix.de>2016-09-14 16:11:09 -0400
commite75eafb9b0395c338230b0eef2cc92ca8d20dee2 (patch)
tree1bb64d6fbd2a82db976c8fe145a49d1e90f9e2aa /kernel/irq
parent34c3d9819fda464be4f1bec59b63353814f76c73 (diff)
genirq/msi: Switch to new irq spreading infrastructure
Switch MSI over to the new spreading code. If a pci device contains a valid pointer to a cpumask, then this mask is used for spreading otherwise the online cpu mask is used. This allows a driver to restrict the spread to a subset of CPUs, e.g. cpus on a particular node. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Christoph Hellwig <hch@lst.de> Cc: axboe@fb.com Cc: keith.busch@intel.com Cc: agordeev@redhat.com Cc: linux-block@vger.kernel.org Link: http://lkml.kernel.org/r/1473862739-15032-4-git-send-email-hch@lst.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/irqdesc.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index a623b44f2d4b..5a5a685aba33 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -236,25 +236,24 @@ static int alloc_descs(unsigned int start, unsigned int cnt, int node,
236 const struct cpumask *mask = NULL; 236 const struct cpumask *mask = NULL;
237 struct irq_desc *desc; 237 struct irq_desc *desc;
238 unsigned int flags; 238 unsigned int flags;
239 int i, cpu = -1; 239 int i;
240 240
241 if (affinity && cpumask_empty(affinity)) 241 /* Validate affinity mask(s) */
242 return -EINVAL; 242 if (affinity) {
243 for (i = 0, mask = affinity; i < cnt; i++, mask++) {
244 if (cpumask_empty(mask))
245 return -EINVAL;
246 }
247 }
243 248
244 flags = affinity ? IRQD_AFFINITY_MANAGED : 0; 249 flags = affinity ? IRQD_AFFINITY_MANAGED : 0;
250 mask = NULL;
245 251
246 for (i = 0; i < cnt; i++) { 252 for (i = 0; i < cnt; i++) {
247 if (affinity) { 253 if (affinity) {
248 cpu = cpumask_next(cpu, affinity); 254 node = cpu_to_node(cpumask_first(affinity));
249 if (cpu >= nr_cpu_ids) 255 mask = affinity;
250 cpu = cpumask_first(affinity); 256 affinity++;
251 node = cpu_to_node(cpu);
252
253 /*
254 * For single allocations we use the caller provided
255 * mask otherwise we use the mask of the target cpu
256 */
257 mask = cnt == 1 ? affinity : cpumask_of(cpu);
258 } 257 }
259 desc = alloc_desc(start + i, node, flags, mask, owner); 258 desc = alloc_desc(start + i, node, flags, mask, owner);
260 if (!desc) 259 if (!desc)
@@ -481,9 +480,9 @@ EXPORT_SYMBOL_GPL(irq_free_descs);
481 * @cnt: Number of consecutive irqs to allocate. 480 * @cnt: Number of consecutive irqs to allocate.
482 * @node: Preferred node on which the irq descriptor should be allocated 481 * @node: Preferred node on which the irq descriptor should be allocated
483 * @owner: Owning module (can be NULL) 482 * @owner: Owning module (can be NULL)
484 * @affinity: Optional pointer to an affinity mask which hints where the 483 * @affinity: Optional pointer to an affinity mask array of size @cnt which
485 * irq descriptors should be allocated and which default 484 * hints where the irq descriptors should be allocated and which
486 * affinities to use 485 * default affinities to use
487 * 486 *
488 * Returns the first irq number or error code 487 * Returns the first irq number or error code
489 */ 488 */