imx6: fix legacy IRQ support (4.19)
[openwrt/openwrt.git] / target / linux / generic / backport-4.19 / 030-PCI-dwc-skip-MSI-init-if-MSIs-have-been-explicitly-d.patch
1 From 26a3cdb73644090ff9a2fb68775ef61d361a8883 Mon Sep 17 00:00:00 2001
2 From: Lucas Stach <l.stach@pengutronix.de>
3 Date: Wed, 27 Feb 2019 17:52:19 +0100
4 Subject: [PATCH] PCI: dwc: skip MSI init if MSIs have been explicitly disabled
5
6 commit 3afc8299f39a27b60e1519a28e18878ce878e7dd upstream.
7
8 Since 7c5925afbc58 (PCI: dwc: Move MSI IRQs allocation to IRQ domains
9 hierarchical API) the MSI init claims one of the controller IRQs as a
10 chained IRQ line for the MSI controller. On some designs, like the i.MX6,
11 this line is shared with a PCIe legacy IRQ. When the line is claimed for
12 the MSI domain, any device trying to use this legacy IRQs will fail to
13 request this IRQ line.
14
15 As MSI and legacy IRQs are already mutually exclusive on the DWC core,
16 as the core won't forward any legacy IRQs once any MSI has been enabled,
17 users wishing to use legacy IRQs already need to explictly disable MSI
18 support (usually via the pci=nomsi kernel commandline option). To avoid
19 any issues with MSI conflicting with legacy IRQs, just skip all of the
20 DWC MSI initalization, including the IRQ line claim, when MSI is disabled.
21
22 Fixes: 7c5925afbc58 ("PCI: dwc: Move MSI IRQs allocation to IRQ domains hierarchical API")
23 Tested-by: Tim Harvey <tharvey@gateworks.com>
24 Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
25 Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
26 Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
27 Cc: stable@vger.kernel.org
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29 ---
30 drivers/pci/controller/dwc/pcie-designware-host.c | 2 +-
31 1 file changed, 1 insertion(+), 1 deletion(-)
32
33 diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
34 index 0fa9e8fdce66..b56e22262a77 100644
35 --- a/drivers/pci/controller/dwc/pcie-designware-host.c
36 +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
37 @@ -439,7 +439,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
38 if (ret)
39 pci->num_viewport = 2;
40
41 - if (IS_ENABLED(CONFIG_PCI_MSI)) {
42 + if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled()) {
43 /*
44 * If a specific SoC driver needs to change the
45 * default number of vectors, it needs to implement
46 --
47 2.17.1
48