[PATCH 2/2] genirq/irqdomain/msi: Add irq_domain_alloc_irqs_affinity() wrapper

Johan Hovold johan+linaro at kernel.org
Tue Dec 13 06:08:44 PST 2022


The full __irq_domain_alloc_irqs() interface was initially only intended
for some legacy (x86) use cases while most callers should use the
irq_domain_alloc_irqs() wrapper.

Add a matching irq_domain_alloc_irqs_affinity() wrapper that can be used
when an affinity hint needs to be provided and use it for MSI
allocations.

Signed-off-by: Johan Hovold <johan+linaro at kernel.org>
---
 include/linux/irqdomain.h | 15 +++++++++++++++
 kernel/irq/msi.c          |  6 +++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index cad47737a052..b1b06d75d31a 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -507,6 +507,14 @@ static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
 				       NULL);
 }
 
+static inline int irq_domain_alloc_irqs_affinity(struct irq_domain *domain,
+			unsigned int nr_irqs, int node, void *arg,
+			const struct irq_affinity_desc *affinity)
+{
+	return __irq_domain_alloc_irqs(domain, -1, nr_irqs, node, arg, false,
+				       affinity);
+}
+
 extern int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
 					   unsigned int irq_base,
 					   unsigned int nr_irqs, void *arg);
@@ -585,6 +593,13 @@ static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
 	return -1;
 }
 
+static inline int irq_domain_alloc_irqs_affinity(struct irq_domain *domain,
+			unsigned int nr_irqs, int node, void *arg,
+			const struct irq_affinity_desc *affinity)
+{
+	return -1;
+}
+
 static inline void irq_domain_free_irqs(unsigned int virq,
 					unsigned int nr_irqs) { }
 
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index bd4d4dd626b4..01f7f3c8d77a 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -1272,9 +1272,9 @@ static int __msi_domain_alloc_irqs(struct device *dev, struct irq_domain *domain
 
 		ops->set_desc(&arg, desc);
 
-		virq = __irq_domain_alloc_irqs(domain, -1, desc->nvec_used,
-					       dev_to_node(dev), &arg, false,
-					       desc->affinity);
+		virq = irq_domain_alloc_irqs_affinity(domain, desc->nvec_used,
+						      dev_to_node(dev), &arg,
+						      desc->affinity);
 		if (virq < 0)
 			return msi_handle_pci_fail(domain, desc, allocated);
 
-- 
2.37.4




More information about the linux-arm-kernel mailing list