From: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
To: manivannan.sadhasivam@oss.qualcomm.com,
"Jingoo Han" <jingoohan1@gmail.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
vincent.guittot@linaro.org, zhangsenchuan@eswincomputing.com
Subject: Re: [PATCH v2 2/2] PCI: dwc: Do not return failure if link is in Detect.Quiet/Active states
Date: Thu, 18 Dec 2025 17:57:30 +0530 [thread overview]
Message-ID: <237606b2-783a-4e11-854b-fed787e2903d@oss.qualcomm.com> (raw)
In-Reply-To: <20251218-pci-dwc-suspend-rework-v2-2-5a7778c6094a@oss.qualcomm.com>
On 12/18/2025 5:34 PM, Manivannan Sadhasivam via B4 Relay wrote:
> From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
>
> dw_pcie_wait_for_link() API waits for the link to be up and returns failure
> if the link is not up within the 1 second interval. But if there was no
> device connected to the bus, then the link up failure would be expected.
> In that case, the callers might want to skip the failure in a hope that the
> link will be up later when a device gets connected.
>
> One of the callers, dw_pcie_host_init() is currently skipping the failure
> irrespective of the link state, in an assumption that the link may come up
> later. But this assumption is wrong, since LTSSM states other than
> Detect.Quiet and Detect.Active during link training phase are considered to
> be fatal and the link needs to be retrained.
>
> So to avoid callers making wrong assumptions, skip returning failure from
> dw_pcie_wait_for_link() only if the link is in Detect.Quiet or
> Detect.Active states after timeout and also check the return value of the
> API in dw_pcie_host_init().
>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 8 +++++---
> drivers/pci/controller/dwc/pcie-designware.c | 12 +++++++++++-
> 2 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 43d091128ef7..ef6d9ae6eddb 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -670,9 +670,11 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
> * If there is no Link Up IRQ, we should not bypass the delay
> * because that would require users to manually rescan for devices.
> */
> - if (!pp->use_linkup_irq)
> - /* Ignore errors, the link may come up later */
> - dw_pcie_wait_for_link(pci);
> + if (!pp->use_linkup_irq) {
> + ret = dw_pcie_wait_for_link(pci);
> + if (ret)
> + goto err_stop_link;
> + }
>
> ret = pci_host_probe(bridge);
> if (ret)
> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> index 75fc8b767fcc..b58baf26ce58 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.c
> +++ b/drivers/pci/controller/dwc/pcie-designware.c
> @@ -641,7 +641,7 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, u32 dir, int index)
>
> int dw_pcie_wait_for_link(struct dw_pcie *pci)
> {
> - u32 offset, val;
> + u32 offset, val, ltssm;
> int retries;
>
> /* Check if the link is up or not */
> @@ -653,6 +653,16 @@ int dw_pcie_wait_for_link(struct dw_pcie *pci)
> }
>
> if (retries >= PCIE_LINK_WAIT_MAX_RETRIES) {
> + /*
> + * If the link is in Detect.Quiet or Detect.Active state, it
> + * indicates that no device is detected. So return success to
> + * allow the device to show up later.
> + */
> + ltssm = dw_pcie_get_ltssm(pci);
> + if (ltssm == DW_PCIE_LTSSM_DETECT_QUIET ||
> + ltssm == DW_PCIE_LTSSM_DETECT_ACT)
> + return 0;
> +
> dev_info(pci->dev, "Phy link never came up\n");
Can you move this print above, as this print is useful for the user to
know that, link is not up yet.
- Krishna Chaitanya.
> return -ETIMEDOUT;
> }
>
next prev parent reply other threads:[~2025-12-18 12:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 12:04 [PATCH v2 0/2] PCI: dwc: Suspend/resume rework Manivannan Sadhasivam via B4 Relay
2025-12-18 12:04 ` [PATCH v2 1/2] PCI: dwc: Skip PME_Turn_Off broadcast and L2/L3 transition during suspend if link is not up Manivannan Sadhasivam via B4 Relay
2025-12-18 12:04 ` [PATCH v2 2/2] PCI: dwc: Do not return failure if link is in Detect.Quiet/Active states Manivannan Sadhasivam via B4 Relay
2025-12-18 12:27 ` Krishna Chaitanya Chundru [this message]
2025-12-18 12:46 ` Manivannan Sadhasivam
2025-12-18 12:56 ` Krishna Chaitanya Chundru
2025-12-18 13:00 ` Manivannan Sadhasivam
2025-12-18 13:28 ` Krishna Chaitanya Chundru
2025-12-18 12:45 ` Shawn Lin
2025-12-18 12:55 ` Manivannan Sadhasivam
2025-12-18 13:09 ` (subset) [PATCH v2 0/2] PCI: dwc: Suspend/resume rework Manivannan Sadhasivam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=237606b2-783a-4e11-854b-fed787e2903d@oss.qualcomm.com \
--to=krishna.chundru@oss.qualcomm.com \
--cc=bhelgaas@google.com \
--cc=jingoohan1@gmail.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=manivannan.sadhasivam@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=zhangsenchuan@eswincomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox