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

Bjorn Helgaas
2022-01-11T21:47:34Z

[-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?

> diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
> index fc4e38fec928..97433beff6cf 100644
> --- a/drivers/pci/controller/pci-tegra.c
> +++ b/drivers/pci/controller/pci-tegra.c
> @@ -2709,7 +2709,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
>
> host->ops = &tegra_pcie_ops;
> host->map_irq = tegra_pcie_map_irq;
> - host->swizzle_irq = pci_common_swizzle;
>
> err = pci_host_probe(host);
> if (err < 0) {

> diff --git a/drivers/pci/controller/pcie-iproc-platform.c b/drivers/pci/controller/pcie-iproc-platform.c
> index 7c10c1cb6f65..a956b0c18bd1 100644
> --- a/drivers/pci/controller/pcie-iproc-platform.c
> +++ b/drivers/pci/controller/pcie-iproc-platform.c
> @@ -99,9 +99,10 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
> switch (pcie->type) {
> case IPROC_PCIE_PAXC:
> case IPROC_PCIE_PAXC_V2:
> + pcie->map_irq = 0;
> break;
> default:
> - pcie->map_irq = of_irq_parse_and_map_pci;
> + break;
> }
>
> ret = iproc_pcie_setup(pcie, &bridge->windows);

> diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> index e98dafd0fff4..905e93808243 100644
> --- a/drivers/pci/controller/pcie-iproc.c
> +++ b/drivers/pci/controller/pcie-iproc.c
> @@ -1526,7 +1526,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
> host->ops = &iproc_pcie_ops;
> host->sysdata = pcie;
> host->map_irq = pcie->map_irq;
> - host->swizzle_irq = pci_common_swizzle;
>
> ret = pci_host_probe(host);
> if (ret < 0) {

drivers/pci/controller/pci-loongson.c:

static int loongson_pci_probe(struct platform_device *pdev)
{
...
bridge->map_irq = loongson_map_irq;