Skip to content

Commit 01292ce

Browse files
mpredfearnKAGA-KOKO
authored andcommitted
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 <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: Qais Yousef <[email protected]> Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent b75a2bf commit 01292ce

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

include/linux/irqdomain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr,
348348
/* IPI functions */
349349
unsigned int irq_reserve_ipi(struct irq_domain *domain,
350350
const struct cpumask *dest);
351-
void irq_destroy_ipi(unsigned int irq);
351+
void irq_destroy_ipi(unsigned int irq, const struct cpumask *dest);
352352

353353
/* V2 interfaces to support hierarchy IRQ domains. */
354354
extern struct irq_data *irq_domain_get_irq_data(struct irq_domain *domain,

kernel/irq/ipi.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,12 @@ unsigned int irq_reserve_ipi(struct irq_domain *domain,
106106
/**
107107
* irq_destroy_ipi() - unreserve an IPI that was previously allocated
108108
* @irq: linux irq number to be destroyed
109+
* @dest: cpumask of cpus which should have the IPI removed
109110
*
110111
* Return the IPIs allocated with irq_reserve_ipi() to the system destroying
111112
* all virqs associated with them.
112113
*/
113-
void irq_destroy_ipi(unsigned int irq)
114+
void irq_destroy_ipi(unsigned int irq, const struct cpumask *dest)
114115
{
115116
struct irq_data *data = irq_get_irq_data(irq);
116117
struct cpumask *ipimask = data ? irq_data_get_affinity_mask(data) : NULL;
@@ -129,10 +130,19 @@ void irq_destroy_ipi(unsigned int irq)
129130
return;
130131
}
131132

132-
if (irq_domain_is_ipi_per_cpu(domain))
133-
nr_irqs = cpumask_weight(ipimask);
134-
else
133+
if (WARN_ON(!cpumask_subset(dest, ipimask)))
134+
/*
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 {
135144
nr_irqs = 1;
145+
}
136146

137147
irq_domain_free_irqs(irq, nr_irqs);
138148
}

0 commit comments

Comments
 (0)