Re: [PATCH 19/19] PCI: Set bridge map_irq and swizzle_irq to default functions

Bjorn Helgaas
2022-01-12T15:27:25Z

On Wed, Jan 12, 2022 at 12:57:44PM +0000, Jiaxun Yang wrote:
> 在2022年1月11日一月 下午9:46，Bjorn Helgaas写道：
> > [-cc many, +cc iproc, loongson, tegra maintainers]
> >
> > On Tue, Jul 21, 2020 at 08:25:14PM -0600, Rob Herring wrote:
> >> The majority of DT based host drivers use the default .map_irq() and
> >> .swizzle_irq() functions, so let's initialize the function pointers to
> >> the default and drop setting them in the host drivers.
> >>
> >> Drivers like iProc which don't support legacy interrupts need to set
> >> .map_irq() back to NULL.
> >
> > Probably a dumb question...
> >
> > This patch removed all the ->swizzle_irq users in drivers/pci/, which
> > is great -- IIUC swizzling is specified by the PCI-to-PCI Bridge Spec,
> > r1.2, sec 9.1, and should not be device-specific. I assume the few
> > remaining arch/ users (arm and alpha) are either bugs or workarounds
> > for broken devices.
> >
> > My question is why we still have a few users of ->map_irq: loongson,
> > tegra, iproc. Shouldn't this mapping be described somehow via DT?
>
> For Loongson we are describing IRQ map in DT for newer platforms.
> But for legacy platforms (AMD RS780E North Bridge) with i8259 irqchip,
> we need to read PCI IRQ registers to get mapping information.
>
> It is not known until boot time, so we have to use map_irq callback.

I see these:

Documentation/devicetree/bindings/pci/loongson.yaml
arch/mips/boot/dts/loongson/rs780e-pch.dtsi

which makes me think there are Loongson systems with DT. Are there
some Loongson systems with DT and some legacy ones without?

The only driver I see is drivers/pci/controller/pci-loongson.c. Is
that used for all Loongson system? It unconditionally uses ->map_irq
= loongson_map_irq().

loongson_map_irq() reads PCI_INTERRUPT_LINE; I think that depends on
firmware having previously programmed it, right?

Bjorn