lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 25 Mar 2021 15:19:32 -0500
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     Marek Szyprowski <m.szyprowski@...sung.com>
Cc:     Zhiqiang Hou <Zhiqiang.Hou@....com>, linux-kernel@...r.kernel.org,
        linux-pci@...r.kernel.org, lorenzo.pieralisi@....com,
        robh@...nel.org, bhelgaas@...gle.com,
        gustavo.pimentel@...opsys.com, jingoohan1@...il.com,
        정재훈 <jh80.chung@...sung.com>
Subject: Re: [PATCH] PCI: dwc: Move forward the iATU detection process

On Thu, Mar 25, 2021 at 10:24:28AM +0100, Marek Szyprowski wrote:
> On 25.01.2021 05:48, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang <Zhiqiang.Hou@....com>
> >
> > In the dw_pcie_ep_init(), it depends on the detected iATU region
> > numbers to allocate the in/outbound window management bit map.
> > It fails after the commit 281f1f99cf3a ("PCI: dwc: Detect number
> > of iATU windows").
> >
> > So this patch move the iATU region detection into a new function,
> > move forward the detection to the very beginning of functions
> > dw_pcie_host_init() and dw_pcie_ep_init(). And also remove it
> > from the dw_pcie_setup(), since it's more like a software
> > perspective initialization step than hardware setup.
> >
> > Fixes: 281f1f99cf3a ("PCI: dwc: Detect number of iATU windows")
> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@....com>
> 
> This patch causes exynos-pcie to hang during the initialization. It 
> looks that some resources are not enabled yet, so calling 
> dw_pcie_iatu_detect() much earlier causes a hang. When I have some time, 
> I will try to identify what is needed to call it properly.

Thanks, I dropped it for now.  We can add it back after we figure out
what the exynos issue is.

For reference, here's the patch I dropped (I had made some minor
corrections to the commit log):

commit fd4162f05194 ("PCI: dwc: Move iATU detection earlier")
Author: Hou Zhiqiang <Zhiqiang.Hou@....com>
Date:   Mon Jan 25 12:48:03 2021 +0800

    PCI: dwc: Move iATU detection earlier
    
    dw_pcie_ep_init() depends on the detected iATU region numbers to allocate
    the in/outbound window management bitmap.  It fails after 281f1f99cf3a
    ("PCI: dwc: Detect number of iATU windows").
    
    Move the iATU region detection into a new function, move the detection to
    the very beginning of dw_pcie_host_init() and dw_pcie_ep_init().  Also
    remove it from the dw_pcie_setup(), since it's more like a software
    initialization step than hardware setup.
    
    Fixes: 281f1f99cf3a ("PCI: dwc: Detect number of iATU windows")
    Link: https://lore.kernel.org/r/20210125044803.4310-1-Zhiqiang.Hou@nxp.com
    Tested-by: Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>
    Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@....com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
    Reviewed-by: Rob Herring <robh@...nel.org>
    Cc: stable@...r.kernel.org	# v5.11+

diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
index 1c25d8337151..8d028a88b375 100644
--- a/drivers/pci/controller/dwc/pcie-designware-ep.c
+++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
@@ -705,6 +705,8 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
 		}
 	}
 
+	dw_pcie_iatu_detect(pci);
+
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "addr_space");
 	if (!res)
 		return -EINVAL;
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 7e55b2b66182..52f6887179cd 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -319,6 +319,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
 			return PTR_ERR(pci->dbi_base);
 	}
 
+	dw_pcie_iatu_detect(pci);
+
 	bridge = devm_pci_alloc_host_bridge(dev, 0);
 	if (!bridge)
 		return -ENOMEM;
diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index 004cb860e266..a945f0c0e73d 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -660,11 +660,9 @@ static void dw_pcie_iatu_detect_regions(struct dw_pcie *pci)
 	pci->num_ob_windows = ob;
 }
 
-void dw_pcie_setup(struct dw_pcie *pci)
+void dw_pcie_iatu_detect(struct dw_pcie *pci)
 {
-	u32 val;
 	struct device *dev = pci->dev;
-	struct device_node *np = dev->of_node;
 	struct platform_device *pdev = to_platform_device(dev);
 
 	if (pci->version >= 0x480A || (!pci->version &&
@@ -693,6 +691,13 @@ void dw_pcie_setup(struct dw_pcie *pci)
 
 	dev_info(pci->dev, "Detected iATU regions: %u outbound, %u inbound",
 		 pci->num_ob_windows, pci->num_ib_windows);
+}
+
+void dw_pcie_setup(struct dw_pcie *pci)
+{
+	u32 val;
+	struct device *dev = pci->dev;
+	struct device_node *np = dev->of_node;
 
 	if (pci->link_gen > 0)
 		dw_pcie_link_set_max_speed(pci, pci->link_gen);
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index 7247c8b01f04..7d6e9b7576be 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -306,6 +306,7 @@ int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, u8 func_no, int index,
 void dw_pcie_disable_atu(struct dw_pcie *pci, int index,
 			 enum dw_pcie_region_type type);
 void dw_pcie_setup(struct dw_pcie *pci);
+void dw_pcie_iatu_detect(struct dw_pcie *pci);
 
 static inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val)
 {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ