aboutsummaryrefslogtreecommitdiff
path: root/pkgs/patches-linux-5.15/0092-PCI-aardvark-Dispose-INTx-irqs-prior-to-removing-INT.patch
blob: bc21fc18fbb156d194a1207c772f5082e484a5d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From dbd2881ab44968823962a14f6de0ed73f916e7b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Sat, 9 Jul 2022 16:55:54 +0200
Subject: [PATCH 2/9] PCI: aardvark: Dispose INTx irqs prior to removing INTx
 domain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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 8f01bf82a754..5dda72ce4d7e 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1439,6 +1439,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.34.1