ee1acf4b9ccecfaddd7bbda6570383a4d4e2ca11
[openwrt/openwrt.git] / target / linux / generic / backport-5.10 / 821-v5.13-let-pci-host-bridges-declar-their-reliance-on-msi-domains.patch
1 From 94e89b145371b68fa0ea294855adebcd03e0522e Mon Sep 17 00:00:00 2001
2 From: Marc Zyngier <maz@kernel.org>
3 Date: Tue, 30 Mar 2021 16:11:41 +0100
4 Subject: PCI/MSI: Let PCI host bridges declare their reliance on MSI domains
5
6 There is a whole class of host bridges that cannot know whether
7 MSIs will be provided or not, as they rely on other blocks
8 to provide the MSI functionnality, using MSI domains. This is
9 the case for example on systems that use the ARM GIC architecture.
10
11 Introduce a new attribute ('msi_domain') indicating that implicit
12 dependency, and use this property to set the NO_MSI flag when
13 no MSI domain is found at probe time.
14
15 Link: https://lore.kernel.org/r/20210330151145.997953-11-maz@kernel.org
16 Signed-off-by: Marc Zyngier <maz@kernel.org>
17 Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
18 Acked-by: Bjorn Helgaas <bhelgaas@google.com>
19 ---
20 drivers/pci/probe.c | 2 ++
21 include/linux/pci.h | 1 +
22 2 files changed, 3 insertions(+)
23
24 --- a/drivers/pci/probe.c
25 +++ b/drivers/pci/probe.c
26 @@ -925,6 +925,8 @@ static int pci_register_host_bridge(stru
27 device_enable_async_suspend(bus->bridge);
28 pci_set_bus_of_node(bus);
29 pci_set_bus_msi_domain(bus);
30 + if (bridge->msi_domain && !dev_get_msi_domain(&bus->dev))
31 + bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
32
33 if (!parent)
34 set_dev_node(bus->bridge, pcibus_to_node(bus));
35 --- a/include/linux/pci.h
36 +++ b/include/linux/pci.h
37 @@ -548,6 +548,7 @@ struct pci_host_bridge {
38 unsigned int native_dpc:1; /* OS may use PCIe DPC */
39 unsigned int preserve_config:1; /* Preserve FW resource setup */
40 unsigned int size_windows:1; /* Enable root bus sizing */
41 + unsigned int msi_domain:1; /* Bridge wants MSI domain */
42
43 /* Resource alignment requirements */
44 resource_size_t (*align_resource)(struct pci_dev *dev,