Skip to content

Commit bb4c691

Browse files
vivierKAGA-KOKO
authored andcommitted
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: e75eafb ("genirq/msi: Switch to new irq spreading infrastructure") Signed-off-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Greg 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
1 parent 509920a commit bb4c691

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

include/linux/irqdomain.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,19 @@ extern void irq_domain_associate_many(struct irq_domain *domain,
384384
extern void irq_domain_disassociate(struct irq_domain *domain,
385385
unsigned int irq);
386386

387-
extern unsigned int irq_create_mapping(struct irq_domain *host,
388-
irq_hw_number_t hwirq);
387+
extern unsigned int irq_create_mapping_affinity(struct irq_domain *host,
388+
irq_hw_number_t hwirq,
389+
const struct irq_affinity_desc *affinity);
389390
extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec);
390391
extern void irq_dispose_mapping(unsigned int virq);
391392

393+
static inline unsigned int irq_create_mapping(struct irq_domain *host,
394+
irq_hw_number_t hwirq)
395+
{
396+
return irq_create_mapping_affinity(host, hwirq, NULL);
397+
}
398+
399+
392400
/**
393401
* irq_linear_revmap() - Find a linux irq from a hw irq number.
394402
* @domain: domain owning this hardware interrupt

kernel/irq/irqdomain.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -624,17 +624,19 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain)
624624
EXPORT_SYMBOL_GPL(irq_create_direct_mapping);
625625

626626
/**
627-
* irq_create_mapping() - Map a hardware interrupt into linux irq space
627+
* irq_create_mapping_affinity() - Map a hardware interrupt into linux irq space
628628
* @domain: domain owning this hardware interrupt or NULL for default domain
629629
* @hwirq: hardware irq number in that domain space
630+
* @affinity: irq affinity
630631
*
631632
* Only one mapping per hardware interrupt is permitted. Returns a linux
632633
* irq number.
633634
* If the sense/trigger is to be specified, set_irq_type() should be called
634635
* on the number returned from that call.
635636
*/
636-
unsigned int irq_create_mapping(struct irq_domain *domain,
637-
irq_hw_number_t hwirq)
637+
unsigned int irq_create_mapping_affinity(struct irq_domain *domain,
638+
irq_hw_number_t hwirq,
639+
const struct irq_affinity_desc *affinity)
638640
{
639641
struct device_node *of_node;
640642
int virq;
@@ -660,7 +662,8 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
660662
}
661663

662664
/* Allocate a virtual interrupt number */
663-
virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), NULL);
665+
virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node),
666+
affinity);
664667
if (virq <= 0) {
665668
pr_debug("-> virq allocation failed\n");
666669
return 0;
@@ -676,7 +679,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
676679

677680
return virq;
678681
}
679-
EXPORT_SYMBOL_GPL(irq_create_mapping);
682+
EXPORT_SYMBOL_GPL(irq_create_mapping_affinity);
680683

681684
/**
682685
* irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs

0 commit comments

Comments
 (0)