linux-stable/drivers/pci
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
..
controller PCI: imx6: Install the fault handler only on compatible match 2023-05-11 23:11:21 +09:00
endpoint PCI: endpoint: pci-epf-vntb: Add epf_ntb_mw_bar_clear() num_mws kernel-doc 2023-03-10 09:28:49 +01:00
hotplug PCI: pciehp: Fix AB-BA deadlock between reset_lock and device_lock 2023-05-11 23:10:49 +09:00
msi PCI/MSI: Remove over-zealous hardware size check in pci_msix_validate_entries() 2023-04-26 14:30:08 +02:00
pcie PCI/portdrv: Prevent LS7A Bus Master clearing on shutdown 2023-03-11 13:50:41 +01:00
switch PCI: switchtec: Return -EFAULT for copy_to_user() errors 2023-03-10 09:28:49 +01:00
access.c
ats.c
bus.c PCI: s390: Fix use-after-free of PCI resources with per-function hotplug 2023-03-22 13:37:46 +01:00
doe.c PCI/DOE: Fix memory leak with CONFIG_DEBUG_OBJECTS=y 2023-04-13 17:02:42 +02:00
ecam.c
host-bridge.c
iov.c PCI/IOV: Enlarge virtfn sysfs name buffer 2023-03-10 09:28:49 +01:00
irq.c
Kconfig
Makefile
mmap.c
of.c
p2pdma.c for-6.2/block-2022-12-08 2022-12-13 10:43:59 -08:00
pci-acpi.c PCI/ACPI: Account for _S0W of the target bridge in acpi_pci_bridge_d3() 2023-03-11 13:50:38 +01:00
pci-bridge-emul.c
pci-bridge-emul.h
pci-driver.c PCI: Unify delay handling for reset and resume 2023-03-10 09:29:54 +01:00
pci-label.c
pci-mid.c
pci-pf-stub.c
pci-stub.c
pci-sysfs.c pci-v6.2-changes 2022-12-14 09:54:10 -08:00
pci.c PCI: loongson: Prevent LS7A MRRS increases 2023-03-11 13:50:41 +01:00
pci.h PCI/DPC: Await readiness of secondary bus after reset 2023-03-10 09:29:54 +01:00
probe.c PCI: Fix dropping valid root bus resources with .end = zero 2023-03-10 09:28:56 +01:00
proc.c
quirks.c PCI: Add ACS quirk for Wangxun NICs 2023-03-11 13:50:45 +01:00
remove.c PCI: Fix use-after-free in pci_bus_release_domain_nr() 2023-04-20 12:36:58 +02:00
rom.c
search.c
setup-bus.c PCI: Distribute available resources for root buses, too 2023-03-11 13:50:44 +01:00
setup-irq.c
setup-res.c
slot.c
syscall.c
vc.c
vgaarb.c
vpd.c
xen-pcifront.c xen: make remove callback of xen driver void returned 2022-12-15 16:06:10 +01:00