Commit bb4c6910 authored by Laurent Vivier's avatar Laurent Vivier Committed by Thomas Gleixner

genirq/irqdomain: Add an irq_create_mapping_affinity() function

There is currently no way to convey the affinity of an interrupt
via irq_create_mapping(), which creates issues for devices that
expect that affinity to be managed by the kernel.

In order to sort this out, rename irq_create_mapping() to
irq_create_mapping_affinity() with an additional affinity parameter that
can be passed down to irq_domain_alloc_descs().

irq_create_mapping() is re-implemented as a wrapper around
irq_create_mapping_affinity().

No functional change.

Fixes: e75eafb9 ("genirq/msi: Switch to new irq spreading infrastructure")
Signed-off-by: default avatarLaurent Vivier <lvivier@redhat.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201126082852.1178497-2-lvivier@redhat.com
parent 509920ae
...@@ -384,11 +384,19 @@ extern void irq_domain_associate_many(struct irq_domain *domain, ...@@ -384,11 +384,19 @@ extern void irq_domain_associate_many(struct irq_domain *domain,
extern void irq_domain_disassociate(struct irq_domain *domain, extern void irq_domain_disassociate(struct irq_domain *domain,
unsigned int irq); unsigned int irq);
extern unsigned int irq_create_mapping(struct irq_domain *host, extern unsigned int irq_create_mapping_affinity(struct irq_domain *host,
irq_hw_number_t hwirq); irq_hw_number_t hwirq,
const struct irq_affinity_desc *affinity);
extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec); extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec);
extern void irq_dispose_mapping(unsigned int virq); extern void irq_dispose_mapping(unsigned int virq);
static inline unsigned int irq_create_mapping(struct irq_domain *host,
irq_hw_number_t hwirq)
{
return irq_create_mapping_affinity(host, hwirq, NULL);
}
/** /**
* irq_linear_revmap() - Find a linux irq from a hw irq number. * irq_linear_revmap() - Find a linux irq from a hw irq number.
* @domain: domain owning this hardware interrupt * @domain: domain owning this hardware interrupt
......
...@@ -624,17 +624,19 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) ...@@ -624,17 +624,19 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain)
EXPORT_SYMBOL_GPL(irq_create_direct_mapping); EXPORT_SYMBOL_GPL(irq_create_direct_mapping);
/** /**
* irq_create_mapping() - Map a hardware interrupt into linux irq space * irq_create_mapping_affinity() - Map a hardware interrupt into linux irq space
* @domain: domain owning this hardware interrupt or NULL for default domain * @domain: domain owning this hardware interrupt or NULL for default domain
* @hwirq: hardware irq number in that domain space * @hwirq: hardware irq number in that domain space
* @affinity: irq affinity
* *
* Only one mapping per hardware interrupt is permitted. Returns a linux * Only one mapping per hardware interrupt is permitted. Returns a linux
* irq number. * irq number.
* If the sense/trigger is to be specified, set_irq_type() should be called * If the sense/trigger is to be specified, set_irq_type() should be called
* on the number returned from that call. * on the number returned from that call.
*/ */
unsigned int irq_create_mapping(struct irq_domain *domain, unsigned int irq_create_mapping_affinity(struct irq_domain *domain,
irq_hw_number_t hwirq) irq_hw_number_t hwirq,
const struct irq_affinity_desc *affinity)
{ {
struct device_node *of_node; struct device_node *of_node;
int virq; int virq;
...@@ -660,7 +662,8 @@ unsigned int irq_create_mapping(struct irq_domain *domain, ...@@ -660,7 +662,8 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
} }
/* Allocate a virtual interrupt number */ /* Allocate a virtual interrupt number */
virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), NULL); virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node),
affinity);
if (virq <= 0) { if (virq <= 0) {
pr_debug("-> virq allocation failed\n"); pr_debug("-> virq allocation failed\n");
return 0; return 0;
...@@ -676,7 +679,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain, ...@@ -676,7 +679,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
return virq; return virq;
} }
EXPORT_SYMBOL_GPL(irq_create_mapping); EXPORT_SYMBOL_GPL(irq_create_mapping_affinity);
/** /**
* irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs * irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment