aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Redfearn <matt.redfearn@imgtec.com>2016-04-25 03:14:23 -0400
committerThomas Gleixner <tglx@linutronix.de>2016-05-02 07:42:50 -0400
commit01292cea0df86ed4a1eb6450d6eda375ef925716 (patch)
treefc5b2e42c595619148acc40f59a5937ade2450d2
parentb75a2bf899b668b1d52de8846aafdbcf81349c73 (diff)
genirq: Make irq_destroy_ipi take a cpumask of IPIs to destroy
Previously irq_destroy_ipi() would destroy IPIs to all CPUs that were configured by irq_reserve_ipi(). This change makes it possible to destroy just a subset of the IPIs. This may be useful to remove IPIs to CPUs that have been hot removed so that the IRQ numbers allocated within the IPI domain can be re-used. The original behaviour is restored by passing the complete mask that the IPI was created with. There are currently no users of this function that would break from the API change. Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com> Cc: linux-mips@linux-mips.org Cc: jason@lakedaemon.net Cc: marc.zyngier@arm.com Cc: ralf@linux-mips.org Cc: Qais Yousef <qsyousef@gmail.com> Cc: lisa.parratt@imgtec.com Cc: jiang.liu@linux.intel.com Link: http://lkml.kernel.org/r/1461568464-31701-1-git-send-email-matt.redfearn@imgtec.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/linux/irqdomain.h2
-rw-r--r--kernel/irq/ipi.c18
2 files changed, 15 insertions, 5 deletions
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 2aed04396210..e1b81d35e7a3 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -348,7 +348,7 @@ int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr,
348/* IPI functions */ 348/* IPI functions */
349unsigned int irq_reserve_ipi(struct irq_domain *domain, 349unsigned int irq_reserve_ipi(struct irq_domain *domain,
350 const struct cpumask *dest); 350 const struct cpumask *dest);
351void irq_destroy_ipi(unsigned int irq); 351void irq_destroy_ipi(unsigned int irq, const struct cpumask *dest);
352 352
353/* V2 interfaces to support hierarchy IRQ domains. */ 353/* V2 interfaces to support hierarchy IRQ domains. */
354extern struct irq_data *irq_domain_get_irq_data(struct irq_domain *domain, 354extern struct irq_data *irq_domain_get_irq_data(struct irq_domain *domain,
diff --git a/kernel/irq/ipi.c b/kernel/irq/ipi.c
index 14777af8e097..bedc995ae214 100644
--- a/kernel/irq/ipi.c
+++ b/kernel/irq/ipi.c
@@ -106,11 +106,12 @@ free_descs:
106/** 106/**
107 * irq_destroy_ipi() - unreserve an IPI that was previously allocated 107 * irq_destroy_ipi() - unreserve an IPI that was previously allocated
108 * @irq: linux irq number to be destroyed 108 * @irq: linux irq number to be destroyed
109 * @dest: cpumask of cpus which should have the IPI removed
109 * 110 *
110 * Return the IPIs allocated with irq_reserve_ipi() to the system destroying 111 * Return the IPIs allocated with irq_reserve_ipi() to the system destroying
111 * all virqs associated with them. 112 * all virqs associated with them.
112 */ 113 */
113void irq_destroy_ipi(unsigned int irq) 114void irq_destroy_ipi(unsigned int irq, const struct cpumask *dest)
114{ 115{
115 struct irq_data *data = irq_get_irq_data(irq); 116 struct irq_data *data = irq_get_irq_data(irq);
116 struct cpumask *ipimask = data ? irq_data_get_affinity_mask(data) : NULL; 117 struct cpumask *ipimask = data ? irq_data_get_affinity_mask(data) : NULL;
@@ -129,10 +130,19 @@ void irq_destroy_ipi(unsigned int irq)
129 return; 130 return;
130 } 131 }
131 132
132 if (irq_domain_is_ipi_per_cpu(domain)) 133 if (WARN_ON(!cpumask_subset(dest, ipimask)))
133 nr_irqs = cpumask_weight(ipimask); 134 /*
134 else 135 * Must be destroying a subset of CPUs to which this IPI
136 * was set up to target
137 */
138 return;
139
140 if (irq_domain_is_ipi_per_cpu(domain)) {
141 irq = irq + cpumask_first(dest) - data->common->ipi_offset;
142 nr_irqs = cpumask_weight(dest);
143 } else {
135 nr_irqs = 1; 144 nr_irqs = 1;
145 }
136 146
137 irq_domain_free_irqs(irq, nr_irqs); 147 irq_domain_free_irqs(irq, nr_irqs);
138} 148}