linux-stable/drivers/pci/controller
H. Nikolaus Schaller cd090996c7 PCI: imx6: Install the fault handler only on compatible match
[ Upstream commit 5f5ac460df ]

commit bb38919ec5 ("PCI: imx6: Add support for i.MX6 PCIe controller")
added a fault hook to this driver in the probe function. So it was only
installed if needed.

commit bde4a5a00e ("PCI: imx6: Allow probe deferral by reset GPIO")
moved it from probe to driver init which installs the hook unconditionally
as soon as the driver is compiled into a kernel.

When this driver is compiled as a module, the hook is not registered
until after the driver has been matched with a .compatible and
loaded.

commit 415b6185c5 ("PCI: imx6: Fix config read timeout handling")
extended the fault handling code.

commit 2d8ed461db ("PCI: imx6: Add support for i.MX8MQ")
added some protection for non-ARM architectures, but this does not
protect non-i.MX ARM architectures.

Since fault handlers can be triggered on any architecture for different
reasons, there is no guarantee that they will be triggered only for the
assumed situation, leading to improper error handling (i.MX6-specific
imx6q_pcie_abort_handler) on foreign systems.

I had seen strange L3 imprecise external abort messages several times on
OMAP4 and OMAP5 devices and couldn't make sense of them until I realized
they were related to this unused imx6q driver because I had
CONFIG_PCI_IMX6=y.

Note that CONFIG_PCI_IMX6=y is useful for kernel binaries that are designed
to run on different ARM SoC and be differentiated only by device tree
binaries. So turning off CONFIG_PCI_IMX6 is not a solution.

Therefore we check the compatible in the init function before registering
the fault handler.

Link: https://lore.kernel.org/r/e1bcfc3078c82b53aa9b78077a89955abe4ea009.1678380991.git.hns@goldelico.com
Fixes: bde4a5a00e ("PCI: imx6: Allow probe deferral by reset GPIO")
Fixes: 415b6185c5 ("PCI: imx6: Fix config read timeout handling")
Fixes: 2d8ed461db ("PCI: imx6: Add support for i.MX8MQ")
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:11:21 +09:00
..
cadence PCI: Remove unnecessary <linux/of_irq.h> includes 2022-11-10 14:53:51 -06:00
dwc PCI: imx6: Install the fault handler only on compatible match 2023-05-11 23:11:21 +09:00
mobiveil PCI/MSI: Get rid of PCI_MSI_IRQ_DOMAIN 2022-11-17 15:15:19 +01:00
Kconfig PCI/MSI: Get rid of PCI_MSI_IRQ_DOMAIN 2022-11-17 15:15:19 +01:00
Makefile
pci-aardvark.c PCI: aardvark: Switch to using devm_gpiod_get_optional() 2022-12-07 08:19:53 -06:00
pci-ftpci100.c PCI: Drop of_match_ptr() to avoid unused variables 2022-11-17 13:32:21 -06:00
pci-host-common.c
pci-host-generic.c
pci-hyperv-intf.c
pci-hyperv.c Updates for the interrupt core and driver subsystem: 2022-12-12 11:21:29 -08:00
pci-ixp4xx.c
pci-loongson.c PCI: loongson: Add more devices that need MRRS quirk 2023-03-11 13:50:45 +01:00
pci-mvebu.c Merge branch 'pci/kbuild' 2022-12-10 10:36:52 -06:00
pci-rcar-gen2.c PCI: rcar-gen2: Add RZ/N1 SOC family compatible string 2022-06-23 17:37:05 -05:00
pci-tegra.c pci-v6.2-changes 2022-12-14 09:54:10 -08:00
pci-thunder-ecam.c
pci-thunder-pem.c
pci-v3-semi.c PCI: Drop of_match_ptr() to avoid unused variables 2022-11-17 13:32:21 -06:00
pci-versatile.c PCI: versatile: Remove redundant variable retval 2022-04-28 10:46:37 +01:00
pci-xgene-msi.c PCI: Remove unnecessary <linux/of_irq.h> includes 2022-11-10 14:53:51 -06:00
pci-xgene.c PCI: Remove unnecessary <linux/of_irq.h> includes 2022-11-10 14:53:51 -06:00
pcie-altera-msi.c PCI: Remove unnecessary <linux/of_irq.h> includes 2022-11-10 14:53:51 -06:00
pcie-altera.c
pcie-apple.c PCI: apple: Do not leak reset GPIO on unbind/unload/error 2022-09-14 17:45:47 +02:00
pcie-brcmstb.c PCI: brcmstb: Set RCB_{MPS,64B}_MODE bits 2022-11-11 11:42:05 +01:00
pcie-hisi-error.c
pcie-iproc-bcma.c
pcie-iproc-msi.c PCI: iproc: Use bitmap API to allocate bitmaps 2022-07-05 15:02:56 -05:00
pcie-iproc-platform.c PCI: Remove unnecessary <linux/of_irq.h> includes 2022-11-10 14:53:51 -06:00
pcie-iproc.c PCI: Remove unnecessary <linux/of_irq.h> includes 2022-11-10 14:53:51 -06:00
pcie-iproc.h
pcie-mediatek-gen3.c PCI: mediatek-gen3: Change driver name to mtk-pcie-gen3 2022-08-23 14:58:49 +02:00
pcie-mediatek.c PCI: Convert to new *_PM_OPS macros 2022-07-27 11:56:17 -05:00
pcie-microchip-host.c PCI: Remove unnecessary <linux/of_irq.h> includes 2022-11-10 14:53:51 -06:00
pcie-mt7621.c PCI: mt7621: Delay phy ports initialization 2023-03-10 09:28:54 +01:00
pcie-rcar-ep.c
pcie-rcar-host.c PCI: Convert to new *_PM_OPS macros 2022-07-27 11:56:17 -05:00
pcie-rcar.c
pcie-rcar.h
pcie-rockchip-ep.c PCI: rockchip: Fix find_first_zero_bit() limit 2022-04-08 14:42:07 +01:00
pcie-rockchip-host.c PCI: Remove unnecessary <linux/of_irq.h> includes 2022-11-10 14:53:51 -06:00
pcie-rockchip.c
pcie-rockchip.h
pcie-xilinx-cpm.c PCI: Remove unnecessary <linux/of_irq.h> includes 2022-11-10 14:53:51 -06:00
pcie-xilinx-nwl.c Merge branch 'pci/kbuild' 2022-12-10 10:36:52 -06:00
pcie-xilinx.c
vmd.c PCI: vmd: Fix secondary bus reset for Intel bridges 2022-12-06 11:45:25 +01:00