Re: [PATCH] pci: irq: Add an early parameter to limit pci irq numbers

From: Marc Zyngier
Date: Thu May 25 2023 - 05:09:25 EST


On Wed, 24 May 2023 16:21:09 +0100,
Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:
>
> [+cc Marc, LKML]
>
> On Wed, May 24, 2023 at 05:36:23PM +0800, Huacai Chen wrote:
> > Some platforms (such as LoongArch) cannot provide enough irq numbers as
> > many as logical cpu numbers. So we should limit pci irq numbers when
> > allocate msi/msix vectors, otherwise some device drivers may fail at
> > initialization. This patch add a cmdline parameter "pci_irq_limit=xxxx"
> > to control the limit.
> >
> > The default pci msi/msix number limit is defined 32 for LoongArch and
> > NR_IRQS for other platforms.
>
> The IRQ experts can chime in on this, but this doesn't feel right to
> me. I assume arch code should set things up so only valid IRQ numbers
> can be allocated. This doesn't seem necessarily PCI-specific, I'd
> prefer to avoid an arch #ifdef here, and I'd also prefer to avoid a
> command-line parameter that users have to discover and supply.

I'd tend to agree. The irqchip driver that provides the interrupt
numbers should perform the capping, not the core PCI code.

Furthermore, MSI allocation is never guaranteed anyway, and drivers
shouldn't expect to get all the interrupts they request. If they do,
they need fixing.

Overall, interrupt architectures that provide as few as 32 possible
interrupts for MSIs will be crippled, and there isn't much we can do
about it. This also applies to a large number of ARM systems that use
the Designware IP.

M.

--
Without deviation from the norm, progress is not possible.