diff mbox series

[v1,2/2] PCI: dwc: Wait for link up only if link is started

Message ID 20240124092533.1267836-3-ajayagarwal@google.com (mailing list archive)
State Rejected
Headers show
Series PCI: dwc: Remove the delay from PCIe probe path | expand

Commit Message

Ajay Agarwal Jan. 24, 2024, 9:25 a.m. UTC
In dw_pcie_host_init(), regardless of whether the link has been
started or not, the code waits for the link to come up. Even in
cases where .start_link() is not defined the code ends up
spinning in a loop for one second. Since in some systems
dw_pcie_host_init() gets called during probe, this one second
loop for each PCIe interface instance ends up extending the boot
time.

Signed-off-by: Ajay Agarwal <ajayagarwal@google.com>
---
This is actually patch v6 for [1] which I have made a part of the
patch series.

v4 [2] was applied, but then reverted [3]. The reason being v4 added
a regression on some products which expect the link to not come
up as a part of the probe. Since v4 returned error from
dw_pcie_wait_for_link check, the probe function of these products
started to fail.

[1] https://lore.kernel.org/all/20240112093006.2832105-1-ajayagarwal@google.com/
[2] https://lore.kernel.org/all/20230412093425.3659088-1-ajayagarwal@google.com/
[3] https://lore.kernel.org/all/20230706082610.26584-1-johan+linaro@kernel.org/

 drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Manivannan Sadhasivam Jan. 29, 2024, 6:26 a.m. UTC | #1
On Wed, Jan 24, 2024 at 02:55:33PM +0530, Ajay Agarwal wrote:
> In dw_pcie_host_init(), regardless of whether the link has been
> started or not, the code waits for the link to come up. Even in
> cases where .start_link() is not defined the code ends up
> spinning in a loop for one second. Since in some systems
> dw_pcie_host_init() gets called during probe, this one second
> loop for each PCIe interface instance ends up extending the boot
> time.
> 
> Signed-off-by: Ajay Agarwal <ajayagarwal@google.com>
> ---
> This is actually patch v6 for [1] which I have made a part of the
> patch series.
> 
> v4 [2] was applied, but then reverted [3]. The reason being v4 added
> a regression on some products which expect the link to not come
> up as a part of the probe. Since v4 returned error from
> dw_pcie_wait_for_link check, the probe function of these products
> started to fail.
> 

What happened to the previous thread [1]? You did not resolve my comment there
and posted a new series. You are not going to make progress if you skip
responding to review comments, sorry.

- Mani

[1] https://lore.kernel.org/linux-pci/20240120143434.GA5405@thinkpad/

> [1] https://lore.kernel.org/all/20240112093006.2832105-1-ajayagarwal@google.com/
> [2] https://lore.kernel.org/all/20230412093425.3659088-1-ajayagarwal@google.com/
> [3] https://lore.kernel.org/all/20230706082610.26584-1-johan+linaro@kernel.org/
> 
>  drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 7991f0e179b2..e53132663d1d 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -487,14 +487,18 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
>  	if (ret)
>  		goto err_remove_edma;
>  
> -	if (!dw_pcie_link_up(pci)) {
> +	if (dw_pcie_link_up(pci)) {
> +		dw_pcie_print_link_status(pci);
> +	} else {
>  		ret = dw_pcie_start_link(pci);
>  		if (ret)
>  			goto err_remove_edma;
> -	}
>  
> -	/* Ignore errors, the link may come up later */
> -	dw_pcie_wait_for_link(pci);
> +		if (pci->ops && pci->ops->start_link) {
> +			/* Ignore errors, the link may come up later */
> +			dw_pcie_wait_for_link(pci);
> +		}
> +	}
>  
>  	bridge->sysdata = pp;
>  
> -- 
> 2.43.0.429.g432eaa2c6b-goog
>
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 7991f0e179b2..e53132663d1d 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -487,14 +487,18 @@  int dw_pcie_host_init(struct dw_pcie_rp *pp)
 	if (ret)
 		goto err_remove_edma;
 
-	if (!dw_pcie_link_up(pci)) {
+	if (dw_pcie_link_up(pci)) {
+		dw_pcie_print_link_status(pci);
+	} else {
 		ret = dw_pcie_start_link(pci);
 		if (ret)
 			goto err_remove_edma;
-	}
 
-	/* Ignore errors, the link may come up later */
-	dw_pcie_wait_for_link(pci);
+		if (pci->ops && pci->ops->start_link) {
+			/* Ignore errors, the link may come up later */
+			dw_pcie_wait_for_link(pci);
+		}
+	}
 
 	bridge->sysdata = pp;