]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: imx6: Install the fault handler only on compatible match
authorH. Nikolaus Schaller <hns@goldelico.com>
Thu, 9 Mar 2023 16:56:31 +0000 (17:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:46 +0000 (11:35 +0200)
commit3edcc4180725e0a908075ba18a95a4739cb489ca
treeeccb7094e1af5b2a55285c435b6750f381ea8a87
parent6a96d90dbe63f306893fe07daeed13d1b4a1b43b
PCI: imx6: Install the fault handler only on compatible match

[ Upstream commit 5f5ac460dfe7f4e11f99de9870f240e39189cf72 ]

commit ce33279efb3c ("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 284bb39c2aca ("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 ad52c8386b45 ("PCI: imx6: Fix config read timeout handling")
extended the fault handling code.

commit 022475978c17 ("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: 284bb39c2aca ("PCI: imx6: Allow probe deferral by reset GPIO")
Fixes: ad52c8386b45 ("PCI: imx6: Fix config read timeout handling")
Fixes: 022475978c17 ("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>
drivers/pci/controller/dwc/pci-imx6.c