Skip to contentSkip to conversation

PCI: imx: do not remap invalid res

PATCH Applied Tim Harvey 5 participants 8 messages Nov 1, 2021 – Dec 3, 2021

Subsystems (3)
lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 PCI: imx: do not remap invalid res

On imx6 and perhaps others when pcie probes you get a:
imx6q-pcie 33800000.pcie: invalid resource

This occurs because the atu is not specified in the DT and as such it should not be remapped.

---
 drivers/pci/controller/dwc/pcie-designware.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +4 -3
index a945f0c0e73d..3254f60d1713 100644
@@ -671,10 +671,11 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci)
 		if (!pci->atu_base) {
 			struct resource *res =
 				platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");
-			if (res)
+			if (res) {
 				pci->atu_size = resource_size(res);
-			pci->atu_base = devm_ioremap_resource(dev, res);
-			if (IS_ERR(pci->atu_base))
+				pci->atu_base = devm_ioremap_resource(dev, res);
+			}
+			if (!pci->atu_base || IS_ERR(pci->atu_base))
 				pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET;
 		}
 
Signature · 1 line
2.17.1
author
#1 lore raw
Quoted 33 lines · Tim Harvey

On imx6 and perhaps others when pcie probes you get a:
imx6q-pcie 33800000.pcie: invalid resource

This occurs because the atu is not specified in the DT and as such it should not be remapped.

---
 drivers/pci/controller/dwc/pcie-designware.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +4 -4
index a945f0c0e73d..3254f60d1713 100644
@@ -671,10 +671,11 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci)
                if (!pci->atu_base) {
                        struct resource *res =
                                platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");
-                       if (res)
+                       if (res) {
                                pci->atu_size = resource_size(res);
-                       pci->atu_base = devm_ioremap_resource(dev, res);
-                       if (IS_ERR(pci->atu_base))
+                               pci->atu_base = devm_ioremap_resource(dev, res);
+                       }
+                       if (!pci->atu_base || IS_ERR(pci->atu_base))
                                pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET;
                }
 
--
Quoted 2 lines

2.17.1

ping - any feedback on this?

Best regards,

Tim

#2 lore raw
Quoted 13 lines

-----Original Message-----
From: Tim Harvey <[email protected]>
Sent: Thursday, December 2, 2021 6:07 AM
To: Jingoo Han <[email protected]>; Gustavo Pimentel <[email protected]>; Rob Herring <[email protected]>; Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Bjorn Helgaas <[email protected]>; [email protected]
Cc: open list <[email protected]>; Hongxing Zhu <[email protected]>
Subject: Re: [PATCH] PCI: imx: do not remap invalid res

Quoted 11 lines
Quoted 9 lines · Tim Harvey

On imx6 and perhaps others when pcie probes you get a:
imx6q-pcie 33800000.pcie: invalid resource

This occurs because the atu is not specified in the DT and as such it should not be remapped.

[Richard Zhu] Please merge Rob's commit log changes. Then, Acked-by: Richard Zhu <[email protected]>

Best Regards
Richard Zhu

Quoted 40 lines

drivers/pci/controller/dwc/pcie-designware.c void dw_pcie_iatu_detect(struct dw_pcie

Quoted 10 lines
---
 drivers/pci/controller/dwc/pcie-designware.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +0 -0
index a945f0c0e73d..3254f60d1713 100644
@@ -671,10 +671,11 @@ void dw_pcie_iatu_detect(struct dw_pcie

*pci)

drivers/pci/controller/dwc/pcie-designware.c void dw_pcie_iatu_detect(struct dw_pcie *pci) · line 681

Quoted 3 lines
drivers/pci/controller/dwc/pcie-designware.c +0 -0
                if (!pci->atu_base) {
                        struct resource *res =
 

platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");

drivers/pci/controller/dwc/pcie-designware.c void dw_pcie_iatu_detect(struct dw_pcie *pci)

Quoted 3 lines
drivers/pci/controller/dwc/pcie-designware.c +1 -1
-                       if (res)
+                       if (res) {
                                pci->atu_size =

resource_size(res);

drivers/pci/controller/dwc/pcie-designware.c void dw_pcie_iatu_detect(struct dw_pcie · line 676

Quoted 1 line
drivers/pci/controller/dwc/pcie-designware.c +0 -1
-                       pci->atu_base =

devm_ioremap_resource(dev, res);

drivers/pci/controller/dwc/pcie-designware.c void dw_pcie_iatu_detect(struct dw_pcie · line 676

Quoted 2 lines
drivers/pci/controller/dwc/pcie-designware.c +1 -1
-                       if (IS_ERR(pci->atu_base))
+                               pci->atu_base =

devm_ioremap_resource(dev, res);

drivers/pci/controller/dwc/pcie-designware.c void dw_pcie_iatu_detect(struct dw_pcie · line 678

Quoted 2 lines
drivers/pci/controller/dwc/pcie-designware.c +2 -0
+                       }
+                       if (!pci->atu_base ||

IS_ERR(pci->atu_base))

drivers/pci/controller/dwc/pcie-designware.c void dw_pcie_iatu_detect(struct dw_pcie · line 679

Quoted 1 line
drivers/pci/controller/dwc/pcie-designware.c +0 -0
                                pci->atu_base = pci->dbi_base

+ DEFAULT_DBI_ATU_OFFSET;

Quoted 5 lines
drivers/pci/controller/dwc/pcie-designware.c +0 -1
                }
 
--

2.17.1

ping - any feedback on this?

Best regards,

Tim

reviewer
#3 lore raw
Quoted 13 lines · Hongxing Zhu
Quoted 13 lines

-----Original Message-----
From: Tim Harvey <[email protected]>
Sent: Thursday, December 2, 2021 6:07 AM
To: Jingoo Han <[email protected]>; Gustavo Pimentel <[email protected]>; Rob Herring <[email protected]>; Lorenzo Pieralisi <[email protected]>; Krzysztof Wilczyński <[email protected]>; Bjorn Helgaas <[email protected]>; [email protected]
Cc: open list <[email protected]>; Hongxing Zhu <[email protected]>
Subject: Re: [PATCH] PCI: imx: do not remap invalid res

Please fix your quoting style with all the headers (hint: don't use Outlook). It's base64 encoded too which isn't ideal for maillists, but somewhat tolerated nowadays.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines · Tim Harvey

On imx6 and perhaps others when pcie probes you get a:
imx6q-pcie 33800000.pcie: invalid resource

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

This occurs because the atu is not specified in the DT and as such it should not be remapped.

[Richard Zhu] Please merge Rob's commit log changes.

The maintainer tools do that automatically.

Quoted 1 line

Then, Acked-by: Richard Zhu <[email protected]>

But probably not when you prefix your tag with 'Then, '... :(

Rob

#4 lore raw
In reply to Tim Harvey
Quoted 33 lines · Tim Harvey
Quoted 32 lines · Tim Harvey

On imx6 and perhaps others when pcie probes you get a:
imx6q-pcie 33800000.pcie: invalid resource

This occurs because the atu is not specified in the DT and as such it should not be remapped.

---
 drivers/pci/controller/dwc/pcie-designware.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +4 -3
index a945f0c0e73d..3254f60d1713 100644
@@ -671,10 +671,11 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci)
                if (!pci->atu_base) {
                        struct resource *res =
                                platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");
-                       if (res)
+                       if (res) {
                                pci->atu_size = resource_size(res);
-                       pci->atu_base = devm_ioremap_resource(dev, res);
-                       if (IS_ERR(pci->atu_base))
+                               pci->atu_base = devm_ioremap_resource(dev, res);
+                       }
+                       if (!pci->atu_base || IS_ERR(pci->atu_base))
                                pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET;
                }
 
Quoted 5 lines
Quoted 3 lines

--
2.17.1

ping - any feedback on this?

Looks like Lorenzo corrected the subject line for you and applied it:

https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?id=6e5ebc96ec65

author
#5 lore raw
Quoted 41 lines · Bjorn Helgaas
Quoted 33 lines · Tim Harvey
Quoted 32 lines · Tim Harvey

On imx6 and perhaps others when pcie probes you get a:
imx6q-pcie 33800000.pcie: invalid resource

This occurs because the atu is not specified in the DT and as such it should not be remapped.

---
 drivers/pci/controller/dwc/pcie-designware.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +4 -3
index a945f0c0e73d..3254f60d1713 100644
@@ -671,10 +671,11 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci)
                if (!pci->atu_base) {
                        struct resource *res =
                                platform_get_resource_byname(pdev, IORESOURCE_MEM, "atu");
-                       if (res)
+                       if (res) {
                                pci->atu_size = resource_size(res);
-                       pci->atu_base = devm_ioremap_resource(dev, res);
-                       if (IS_ERR(pci->atu_base))
+                               pci->atu_base = devm_ioremap_resource(dev, res);
+                       }
+                       if (!pci->atu_base || IS_ERR(pci->atu_base))
                                pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET;
                }
 
Quoted 5 lines
Quoted 3 lines

--
2.17.1

ping - any feedback on this?

Quoted 3 lines

Looks like Lorenzo corrected the subject line for you and applied it:

https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?id=6e5ebc96ec65

Yes, I saw that. Thanks everyone!

Best regards,

Tim

reviewer Reviewed-by on v1 1/1
#6 lore raw
In reply to Tim Harvey
Quoted 7 lines · Tim Harvey

On imx6 and perhaps others when pcie probes you get a:
imx6q-pcie 33800000.pcie: invalid resource

This occurs because the atu is not specified in the DT and as such it should not be remapped.

Fixes 281f1f99cf3a ("PCI: dwc: Detect number of iATU windows")
Quoted 5 lines
---
 drivers/pci/controller/dwc/pcie-designware.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)