diff mbox series

[2/2] PCI: iproc: Fix BCMA probe resource handling

Message ID 20210803215656.3803204-2-robh@kernel.org (mailing list archive)
State Accepted
Delegated to: Bjorn Helgaas
Headers show
Series [1/2] PCI: of: Don't fail devm_pci_alloc_host_bridge() on missing 'ranges' | expand

Commit Message

Rob Herring (Arm) Aug. 3, 2021, 9:56 p.m. UTC
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@gmail.com>
Cc: Srinath Mannam <srinath.mannam@broadcom.com>
Cc: Roman Bacik <roman.bacik@broadcom.com>
Cc: Bharat Gooty <bharat.gooty@broadcom.com>
Cc: Abhishek Shah <abhishek.shah@broadcom.com>
Cc: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Cc: Ray Jui <ray.jui@broadcom.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: "Krzysztof Wilczyński" <kw@linux.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/pci/controller/pcie-iproc-bcma.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

Comments

Rafał Miłecki Aug. 4, 2021, 6:49 a.m. UTC | #1
On 03.08.2021 23:56, Rob Herring wrote:
> 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@gmail.com>
> Cc: Srinath Mannam <srinath.mannam@broadcom.com>
> Cc: Roman Bacik <roman.bacik@broadcom.com>
> Cc: Bharat Gooty <bharat.gooty@broadcom.com>
> Cc: Abhishek Shah <abhishek.shah@broadcom.com>
> Cc: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
> Cc: Ray Jui <ray.jui@broadcom.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: "Krzysztof Wilczyński" <kw@linux.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Signed-off-by: Rob Herring <robh@kernel.org>

It works great again, thank you!

Tested-by: Rafał Miłecki <rafal@milecki.pl>

[    6.624535] pcie_iproc_bcma bcma0:7: host bridge /axi@18000000/pcie@12000 ranges:
[    6.632048] pcie_iproc_bcma bcma0:7:   No bus range found for /axi@18000000/pcie@12000, using [bus 00-ff]
[    6.641661] OF: /axi@18000000/pcie@12000: Missing device_type
[    6.647432] pcie_iproc_bcma bcma0:7: non-prefetchable memory resource required
[    6.783993] pcie_iproc_bcma bcma0:7: link: UP
[    6.788471] pcie_iproc_bcma bcma0:7: PCI host bridge to bus 0000:00
[    6.794784] pci_bus 0000:00: root bus resource [bus 00-ff]
[    6.800288] pci_bus 0000:00: root bus resource [mem 0x08000000-0x0fffffff]
[    6.807216] pci 0000:00:00.0: [14e4:d612] type 01 class 0x060400
[    6.813242] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x4 may corrupt adjacent RW1C bits
[    6.822927] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x4 may corrupt adjacent RW1C bits
[    6.832620] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x1c may corrupt adjacent RW1C bits
[    6.842387] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x1c may corrupt adjacent RW1C bits
[    6.852162] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x3e may corrupt adjacent RW1C bits
[    6.861951] pci 0000:00:00.0: PME# supported from D0 D3hot D3cold
[    6.868065] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x4c may corrupt adjacent RW1C bits
[    6.878472] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x3e may corrupt adjacent RW1C bits
[    6.888259] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x4 may corrupt adjacent RW1C bits
[    6.897947] pci_bus 0000:00: 1-byte config write to 0000:00:00.0 offset 0xc may corrupt adjacent RW1C bits
[    6.907634] PCI: bus0: Fast back to back transfers disabled
[    6.913224] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    6.921255] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x3e may corrupt adjacent RW1C bits
[    6.931146] pci 0000:01:00.0: [14e4:4365] type 00 class 0x028000
[    6.937212] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00007fff 64bit]
[    6.944032] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x007fffff 64bit]
[    6.950839] pci 0000:01:00.0: reg 0x20: [mem 0x00000000-0x000fffff 64bit pref]
[    6.958167] pci 0000:01:00.0: supports D1 D2
[    6.963074] PCI: bus1: Fast back to back transfers disabled
[    6.968693] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    6.975354] pci 0000:00:00.0: BAR 8: assigned [mem 0x08000000-0x08bfffff]
[    6.982159] pci 0000:00:00.0: BAR 9: assigned [mem 0x08c00000-0x08cfffff 64bit pref]
[    6.989931] pci 0000:01:00.0: BAR 2: assigned [mem 0x08000000-0x087fffff 64bit]
[    6.997275] pci 0000:01:00.0: BAR 4: assigned [mem 0x08c00000-0x08cfffff 64bit pref]
[    7.005046] pci 0000:01:00.0: BAR 0: assigned [mem 0x08800000-0x08807fff 64bit]
[    7.012377] pci 0000:00:00.0: PCI bridge to [bus 01]
[    7.017354] pci 0000:00:00.0:   bridge window [mem 0x08000000-0x08bfffff]
[    7.024162] pci 0000:00:00.0:   bridge window [mem 0x08c00000-0x08cfffff 64bit pref]
[    7.032111] pcie_iproc_bcma bcma0:8: host bridge /axi@18000000/pcie@13000 ranges:
[    7.039647] pcie_iproc_bcma bcma0:8:   No bus range found for /axi@18000000/pcie@13000, using [bus 00-ff]
[    7.049252] pcie_iproc_bcma bcma0:8: non-prefetchable memory resource required
[    7.183989] pcie_iproc_bcma bcma0:8: link: UP
[    7.188463] pcie_iproc_bcma bcma0:8: PCI host bridge to bus 0001:00
[    7.194776] pci_bus 0001:00: root bus resource [bus 00-ff]
[    7.200280] pci_bus 0001:00: root bus resource [mem 0x20000000-0x27ffffff]
[    7.207206] pci 0001:00:00.0: [14e4:d612] type 01 class 0x060400
[    7.213267] pci 0001:00:00.0: PME# supported from D0 D3hot D3cold
[    7.220014] PCI: bus0: Fast back to back transfers disabled
[    7.225619] pci 0001:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    7.233772] pci 0001:01:00.0: [14e4:4365] type 00 class 0x028000
[    7.239834] pci 0001:01:00.0: reg 0x10: [mem 0x00000000-0x00007fff 64bit]
[    7.246659] pci 0001:01:00.0: reg 0x18: [mem 0x00000000-0x007fffff 64bit]
[    7.253469] pci 0001:01:00.0: reg 0x20: [mem 0x00000000-0x000fffff 64bit pref]
[    7.260805] pci 0001:01:00.0: supports D1 D2
[    7.265717] PCI: bus1: Fast back to back transfers disabled
[    7.271311] pci_bus 0001:01: busn_res: [bus 01-ff] end is updated to 01
[    7.277970] pci 0001:00:00.0: BAR 8: assigned [mem 0x20000000-0x20bfffff]
[    7.284778] pci 0001:00:00.0: BAR 9: assigned [mem 0x20c00000-0x20cfffff 64bit pref]
[    7.292546] pci 0001:01:00.0: BAR 2: assigned [mem 0x20000000-0x207fffff 64bit]
[    7.299887] pci 0001:01:00.0: BAR 4: assigned [mem 0x20c00000-0x20cfffff 64bit pref]
[    7.307670] pci 0001:01:00.0: BAR 0: assigned [mem 0x20800000-0x20807fff 64bit]
[    7.315016] pci 0001:00:00.0: PCI bridge to [bus 01]
[    7.319995] pci 0001:00:00.0:   bridge window [mem 0x20000000-0x20bfffff]
[    7.326807] pci 0001:00:00.0:   bridge window [mem 0x20c00000-0x20cfffff 64bit pref]
[    7.334761] pcie_iproc_bcma bcma0:9: host bridge /axi@18000000/pcie@14000 ranges:
[    7.342279] pcie_iproc_bcma bcma0:9:   No bus range found for /axi@18000000/pcie@14000, using [bus 00-ff]
[    7.351896] pcie_iproc_bcma bcma0:9: non-prefetchable memory resource required
[    7.483989] pcie_iproc_bcma bcma0:9: PHY or data link is INACTIVE!
[    7.490184] pcie_iproc_bcma bcma0:9: no PCIe EP device detected
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-iproc-bcma.c b/drivers/pci/controller/pcie-iproc-bcma.c
index 56b8ee7bf330..f918c713afb0 100644
--- 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 bcma_device *bdev)
 {
 	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 bcma_device *bdev)
 	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)