[openwrt/openwrt] kernel: fix kernel 5.5 and 5.9 PCI DT regressions
LEDE Commits
lede-commits at lists.infradead.org
Tue Aug 3 23:43:02 PDT 2021
rmilecki pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/b37f0dde78656a352914c4d01010979530589103
commit b37f0dde78656a352914c4d01010979530589103
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Wed Aug 4 08:10:02 2021 +0200
kernel: fix kernel 5.5 and 5.9 PCI DT regressions
This fixes PCI on bcm53xx.
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
...t-fail-devm_pci_alloc_host_bridge-on-miss.patch | 48 ++++++++++++++
...CI-iproc-Fix-BCMA-probe-resource-handling.patch | 74 ++++++++++++++++++++++
2 files changed, 122 insertions(+)
diff --git a/target/linux/generic/backport-5.10/840-0001-PCI-of-Don-t-fail-devm_pci_alloc_host_bridge-on-miss.patch b/target/linux/generic/backport-5.10/840-0001-PCI-of-Don-t-fail-devm_pci_alloc_host_bridge-on-miss.patch
new file mode 100644
index 0000000000..b077530a8b
--- /dev/null
+++ b/target/linux/generic/backport-5.10/840-0001-PCI-of-Don-t-fail-devm_pci_alloc_host_bridge-on-miss.patch
@@ -0,0 +1,48 @@
+From: Rob Herring <robh at kernel.org>
+Date: Tue, 3 Aug 2021 15:56:55 -0600
+Subject: [PATCH] PCI: of: Don't fail devm_pci_alloc_host_bridge() on missing
+ 'ranges'
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Commit 669cbc708122 ("PCI: Move DT resource setup into
+devm_pci_alloc_host_bridge()") made devm_pci_alloc_host_bridge() fail on
+any DT resource parsing errors, but Broadcom iProc uses
+devm_pci_alloc_host_bridge() on BCMA bus devices that don't have DT
+resources. In particular, there is no 'ranges' property. Fix iProc by
+making 'ranges' optional.
+
+If 'ranges' is required by a platform, there's going to be more errors
+latter on if it is missing.
+
+Fixes: 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()")
+Reported-by: Rafał Miłecki <zajec5 at gmail.com>
+Cc: Srinath Mannam <srinath.mannam at broadcom.com>
+Cc: Roman Bacik <roman.bacik at broadcom.com>
+Cc: Bharat Gooty <bharat.gooty at broadcom.com>
+Cc: Abhishek Shah <abhishek.shah at broadcom.com>
+Cc: Jitendra Bhivare <jitendra.bhivare at broadcom.com>
+Cc: Ray Jui <ray.jui at broadcom.com>
+Cc: Florian Fainelli <f.fainelli at gmail.com>
+Cc: BCM Kernel Feedback <bcm-kernel-feedback-list at broadcom.com>
+Cc: Scott Branden <sbranden at broadcom.com>
+Cc: Bjorn Helgaas <bhelgaas at google.com>
+Cc: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
+Signed-off-by: Rob Herring <robh at kernel.org>
+Acked-by: Bjorn Helgaas <bhelgaas at google.com>
+---
+ drivers/pci/of.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/pci/of.c
++++ b/drivers/pci/of.c
+@@ -295,7 +295,7 @@ static int devm_of_pci_get_host_bridge_r
+ /* Check for ranges property */
+ err = of_pci_range_parser_init(&parser, dev_node);
+ if (err)
+- goto failed;
++ return 0;
+
+ dev_dbg(dev, "Parsing ranges property...\n");
+ for_each_of_pci_range(&parser, &range) {
diff --git a/target/linux/generic/backport-5.10/840-0002-PCI-iproc-Fix-BCMA-probe-resource-handling.patch b/target/linux/generic/backport-5.10/840-0002-PCI-iproc-Fix-BCMA-probe-resource-handling.patch
new file mode 100644
index 0000000000..54ba2631a2
--- /dev/null
+++ b/target/linux/generic/backport-5.10/840-0002-PCI-iproc-Fix-BCMA-probe-resource-handling.patch
@@ -0,0 +1,74 @@
+From: Rob Herring <robh at kernel.org>
+Date: Tue, 3 Aug 2021 15:56:56 -0600
+Subject: [PATCH] PCI: iproc: Fix BCMA probe resource handling
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In commit 7ef1c871da16 ("PCI: iproc: Use
+pci_parse_request_of_pci_ranges()"), calling
+devm_request_pci_bus_resources() was dropped from the common iProc
+probe code, but is still needed for BCMA bus probing. Without it, there
+will be lots of warnings like this:
+
+pci 0000:00:00.0: BAR 8: no space for [mem size 0x00c00000]
+pci 0000:00:00.0: BAR 8: failed to assign [mem size 0x00c00000]
+
+Add back calling devm_request_pci_bus_resources() and adding the
+resources to pci_host_bridge.windows for BCMA bus probe.
+
+Fixes: 7ef1c871da16 ("PCI: iproc: Use pci_parse_request_of_pci_ranges()")
+Reported-by: Rafał Miłecki <zajec5 at gmail.com>
+Cc: Srinath Mannam <srinath.mannam at broadcom.com>
+Cc: Roman Bacik <roman.bacik at broadcom.com>
+Cc: Bharat Gooty <bharat.gooty at broadcom.com>
+Cc: Abhishek Shah <abhishek.shah at broadcom.com>
+Cc: Jitendra Bhivare <jitendra.bhivare at broadcom.com>
+Cc: Ray Jui <ray.jui at broadcom.com>
+Cc: Florian Fainelli <f.fainelli at gmail.com>
+Cc: BCM Kernel Feedback <bcm-kernel-feedback-list at broadcom.com>
+Cc: Scott Branden <sbranden at broadcom.com>
+Cc: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
+Cc: "Krzysztof Wilczyński" <kw at linux.com>
+Cc: Bjorn Helgaas <bhelgaas at google.com>
+Signed-off-by: Rob Herring <robh at kernel.org>
+---
+ drivers/pci/controller/pcie-iproc-bcma.c | 16 ++++++----------
+ 1 file changed, 6 insertions(+), 10 deletions(-)
+
+--- a/drivers/pci/controller/pcie-iproc-bcma.c
++++ b/drivers/pci/controller/pcie-iproc-bcma.c
+@@ -35,7 +35,6 @@ static int iproc_pcie_bcma_probe(struct
+ {
+ struct device *dev = &bdev->dev;
+ struct iproc_pcie *pcie;
+- LIST_HEAD(resources);
+ struct pci_host_bridge *bridge;
+ int ret;
+
+@@ -60,19 +59,16 @@ static int iproc_pcie_bcma_probe(struct
+ pcie->mem.end = bdev->addr_s[0] + SZ_128M - 1;
+ pcie->mem.name = "PCIe MEM space";
+ pcie->mem.flags = IORESOURCE_MEM;
+- pci_add_resource(&resources, &pcie->mem);
++ pci_add_resource(&bridge->windows, &pcie->mem);
++ ret = devm_request_pci_bus_resources(dev, &bridge->windows);
++ if (ret)
++ return ret;
+
+ pcie->map_irq = iproc_pcie_bcma_map_irq;
+
+- ret = iproc_pcie_setup(pcie, &resources);
+- if (ret) {
+- dev_err(dev, "PCIe controller setup failed\n");
+- pci_free_resource_list(&resources);
+- return ret;
+- }
+-
+ bcma_set_drvdata(bdev, pcie);
+- return 0;
++
++ return iproc_pcie_setup(pcie, &bridge->windows);
+ }
+
+ static void iproc_pcie_bcma_remove(struct bcma_device *bdev)
More information about the lede-commits
mailing list