[2/2] genirq/irqdomain/msi: Add irq_domain_alloc_irqs_affinity() wrapper
Commit Message
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@kernel.org>
---
include/linux/irqdomain.h | 15 +++++++++++++++
kernel/irq/msi.c | 6 +++---
2 files changed, 18 insertions(+), 3 deletions(-)
Comments
On Tue, Dec 13 2022 at 15:08, Johan Hovold wrote:
> 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.
I definitely like the irqchip cleanup, but this one is core code and
having the extra wrapper is not really buying us much.
Thanks,
tglx
On Wed, Jan 11, 2023 at 07:52:42PM +0100, Thomas Gleixner wrote:
> On Tue, Dec 13 2022 at 15:08, Johan Hovold wrote:
> > 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.
>
> I definitely like the irqchip cleanup, but this one is core code and
> having the extra wrapper is not really buying us much.
Fair enough. If you don't expect there to be any further users then
perhaps it's not worth it even if it arguably makes the call site a bit
more readable (e.g. by dropping the base and realloc arguments).
Johan
On Thu, Jan 12, 2023 at 02:24:58PM +0100, Johan Hovold wrote:
> On Wed, Jan 11, 2023 at 07:52:42PM +0100, Thomas Gleixner wrote:
> > On Tue, Dec 13 2022 at 15:08, Johan Hovold wrote:
> > > 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.
> >
> > I definitely like the irqchip cleanup, but this one is core code and
> > having the extra wrapper is not really buying us much.
>
> Fair enough. If you don't expect there to be any further users then
> perhaps it's not worth it even if it arguably makes the call site a bit
> more readable (e.g. by dropping the base and realloc arguments).
And having this wrapper would also limit the use of the full (internal)
helper to places that actually need the realloc parameter (e.g. making
those stand out more).
Johan
@@ -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) { }
@@ -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);