aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/omnia-kernel-patches/0049-PCI-aardvark-Dispose-bridge-irq-prior-to-removing-br.patch
blob: 95519e984c67cb2bcfc39a4ade4246d4fb960162 (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
From f771fdb6b6dfeab92087c7e3dbc27794b1066585 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Wed, 24 Aug 2022 15:59:49 +0200
Subject: [PATCH 49/53] PCI: aardvark: Dispose bridge irq prior to removing
 bridge 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 bridge irq is 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: 815bc3136867 ("PCI: aardvark: Use separate INTA interrupt for emulated root bridge")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pci/controller/pci-aardvark.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index 671d89fd91fc..65cd1095984f 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1574,6 +1574,11 @@ static int advk_pcie_init_rp_irq_domain(struct advk_pcie *pcie)
 
 static void advk_pcie_remove_rp_irq_domain(struct advk_pcie *pcie)
 {
+	int virq;
+
+	virq = irq_find_mapping(pcie->rp_irq_domain, 0);
+	if (virq > 0)
+		irq_dispose_mapping(virq);
 	irq_domain_remove(pcie->rp_irq_domain);
 }
 
-- 
2.37.3