diff mbox series

[v3,2/2] PCI: mvebu: Dispose INTx IRQs before to removing INTx domain

Message ID 20240715114854.4792-3-kabel@kernel.org (mailing list archive)
State New, archived
Headers show
Series PCI: mvebu: Dispose INTx IRQs before to removing INTx domain | expand

Commit Message

Marek Behún July 15, 2024, 11:48 a.m. UTC
From: Pali Rohár <pali@kernel.org>

The documentation for the irq_domain_remove() function says that all
mappings within the IRQ domain must be disposed before the domain is
removed.

Use the new helper function pci_remove_irq_domain() that also disposes
all IRQ mappings of a IRQ domain before removing sait domain.

Currently, the INTx IRQs are not disposed in pci-mvebu driver .remove()
method, which causes the kernel to crash when unloading the driver and
then reading /sys/kernel/debug/irq/irqs/<num> or /proc/interrupts.

Unmapping of the IRQs at this point of the .remove() method is safe,
since the PCIe bus is already unregistered, and all its devices are
unbound from their drivers and removed. If there was indeed any
remaining use of PCIe resources, then it would mean that PCIe hotplug
code is broken, and we have bigger problems.

Fixes: ec075262648f ("PCI: mvebu: Implement support for legacy INTx interrupts")
Reported-by: Hajo Noerenberg <hajo-linux-bugzilla@noerenberg.de>
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <kabel@kernel.org>
[ Marek: refactored a little, added more explanation to commit message ]
Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/pci-mvebu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
index 29fe09c99e7d..590f121bd91a 100644
--- a/drivers/pci/controller/pci-mvebu.c
+++ b/drivers/pci/controller/pci-mvebu.c
@@ -1684,7 +1684,7 @@  static void mvebu_pcie_remove(struct platform_device *pdev)
 
 		/* Remove IRQ domains. */
 		if (port->intx_irq_domain)
-			irq_domain_remove(port->intx_irq_domain);
+			pci_remove_irq_domain(port->intx_irq_domain);
 
 		/* Free config space for emulated root bridge. */
 		pci_bridge_emul_cleanup(&port->bridge);