linux/drivers/pci/controller
Javier Martinez Canillas d420b11666 PCI: rockchip: Register IRQ handlers after device and data are ready
[ Upstream commit 3cf5f7ab23 ]

An IRQ handler may be called at any time after it is registered, so
anything it relies on must be ready before registration.

rockchip_pcie_subsys_irq_handler() and rockchip_pcie_client_irq_handler()
read registers in the PCIe controller, but we registered them before
turning on clocks to the controller.  If either is called before the clocks
are turned on, the register reads fail and the machine hangs.

Similarly, rockchip_pcie_legacy_int_handler() uses rockchip->irq_domain,
but we installed it before initializing irq_domain.

Register IRQ handlers after their data structures are initialized and
clocks are enabled.

Found by enabling CONFIG_DEBUG_SHIRQ, which calls the IRQ handler when it
is being unregistered.  An error during the probe path might cause this
unregistration and IRQ handler execution before the device or data
structure init has finished.

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/20210608080409.1729276-1-javierm@redhat.com
Reported-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-20 16:05:49 +02:00
..
cadence PCI: cadence: Retrain Link to work around Gen2 training defect 2021-03-11 14:17:29 +01:00
dwc PCI: tegra: Fix runtime PM imbalance in pex_ep_event_pex_rst_deassert() 2021-05-22 11:40:52 +02:00
mobiveil
Kconfig pci-v5.10-changes 2020-10-22 12:41:00 -07:00
Makefile
pci-aardvark.c PCI: aardvark: Implement workaround for the readback value of VEND_ID 2021-07-19 09:45:01 +02:00
pci-ftpci100.c PCI: ftpci100: Rename macro name collision 2021-07-20 16:05:46 +02:00
pci-host-common.c
pci-host-generic.c
pci-hyperv-intf.c
pci-hyperv.c PCI: hv: Fix a race condition when removing the device 2021-07-20 16:05:47 +02:00
pci-loongson.c
pci-mvebu.c PCI: mvebu: Fix duplicate resource requests 2020-11-04 13:55:30 -06:00
pci-rcar-gen2.c
pci-tegra.c PCI: tegra: Add missing MODULE_DEVICE_TABLE 2021-07-20 16:05:48 +02:00
pci-thunder-ecam.c PCI: thunder: Fix compile testing 2021-05-22 11:40:52 +02:00
pci-thunder-pem.c PCI: thunder: Fix compile testing 2021-05-22 11:40:52 +02:00
pci-v3-semi.c PCI: v3-semi: Remove unneeded break 2020-10-20 10:59:55 -05:00
pci-versatile.c
pci-xgene-msi.c PCI: xgene-msi: Fix race in installing chained irq handler 2021-03-17 17:06:24 +01:00
pci-xgene.c PCI: xgene: Fix cfg resource mapping 2021-05-14 09:49:57 +02:00
pcie-altera-msi.c
pcie-altera.c
pcie-brcmstb.c PCI: brcmstb: Initialize "tmp" before use 2020-12-30 11:53:18 +01:00
pcie-hisi-error.c
pcie-iproc-bcma.c
pcie-iproc-msi.c PCI: iproc: Fix return value of iproc_msi_irq_domain_alloc() 2021-05-19 10:13:01 +02:00
pcie-iproc-platform.c PCI: iproc: Fix using plain integer as NULL pointer in iproc_pcie_pltfm_probe 2020-10-09 13:37:57 +01:00
pcie-iproc.c PCI: iproc: Invalidate correct PAXB inbound windows 2020-12-30 11:53:27 +01:00
pcie-iproc.h
pcie-mediatek.c PCI: mediatek: Add missing of_node_put() to fix reference leak 2021-03-17 17:06:24 +01:00
pcie-rcar-ep.c
pcie-rcar-host.c PCI: rcar: Always allocate MSI addresses in 32bit space 2021-03-04 11:38:11 +01:00
pcie-rcar.c
pcie-rcar.h
pcie-rockchip-ep.c
pcie-rockchip-host.c PCI: rockchip: Register IRQ handlers after device and data are ready 2021-07-20 16:05:49 +02:00
pcie-rockchip.c PCI: rockchip: Make 'ep-gpios' DT property optional 2021-03-04 11:38:18 +01:00
pcie-rockchip.h
pcie-tango.c
pcie-xilinx-cpm.c PCI: xilinx-cpm: Fix reference count leak on error path 2021-03-04 11:38:11 +01:00
pcie-xilinx-nwl.c
pcie-xilinx.c
vmd.c pci-v5.10-changes 2020-10-22 12:41:00 -07:00