All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] PCI: aardvark: Dispose INTx irqs prior to removing INTx domain
@ 2022-07-11 12:06 ` Pali Rohár
  0 siblings, 0 replies; 6+ messages in thread
From: Pali Rohár @ 2022-07-11 12:06 UTC (permalink / raw)
  To: Thomas Petazzoni, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, Marek Behún
  Cc: linux-pci, linux-arm-kernel, linux-kernel

Documentation for irq_domain_remove() says that all mapping within the
domain must be disposed prior to domain remove.

Currently INTx irqs are not disposed in pci-aardvark.c device unbind callback
which cause that kernel crashes after unloading driver and trying to read
/sys/kernel/debug/irq/irqs/<num> or /proc/interrupts.

Fixes: 526a76991b7b ("PCI: aardvark: Implement driver 'remove' function and allow to build it as module")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pci/controller/pci-aardvark.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index ffec82c8a523..6cb65e64859d 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1433,6 +1433,14 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie)
 
 static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie)
 {
+	int virq, i;
+
+	for (i = 0; i < PCI_NUM_INTX; i++) {
+		virq = irq_find_mapping(pcie->irq_domain, i);
+		if (virq > 0)
+			irq_dispose_mapping(virq);
+	}
+
 	irq_domain_remove(pcie->irq_domain);
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-11 12:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 12:06 [PATCH 1/3] PCI: aardvark: Dispose INTx irqs prior to removing INTx domain Pali Rohár
2022-07-11 12:06 ` Pali Rohár
2022-07-11 12:06 ` [PATCH 2/3] PCI: aardvark: Dispose bridge irq prior to removing bridge domain Pali Rohár
2022-07-11 12:06   ` Pali Rohár
2022-07-11 12:06 ` [PATCH 3/3] PCI: aardvark: Do static allocation of irq_chip Pali Rohár
2022-07-11 12:06   ` Pali Rohár

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.