From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
There are cases where the PCIe device would be physically connected to the
bus, but the device firmware might not be active. So the LTSSM will
get stuck in POLL.{Active/Compliance} states.
This behavior is common with endpoint devices controlled by the PCI
Endpoint framework, where the device will wait for the user to start its
operation through configfs.
For those cases, print the relevant log and return -EIO to indicate that
the device is present, but not active. This will allow the callers to skip
the failure as the device might become active in the future.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/pci/controller/dwc/pcie-designware.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index 55c1c60f7f8f..aca5bbeade03 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -696,8 +696,9 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, u32 dir, int index)
* dw_pcie_wait_for_link - Wait for the PCIe link to be up
* @pci: DWC instance
*
- * Returns: 0 if link is up, -ENODEV if device is not found, -ETIMEDOUT if the
- * link fails to come up for other reasons.
+ * Returns: 0 if link is up, -ENODEV if device is not found, -EIO if the device
+ * is found but not active and -ETIMEDOUT if the link fails to come up for other
+ * reasons.
*/
int dw_pcie_wait_for_link(struct dw_pcie *pci)
{
@@ -722,6 +723,16 @@ int dw_pcie_wait_for_link(struct dw_pcie *pci)
ltssm == DW_PCIE_LTSSM_DETECT_ACT) {
dev_info(pci->dev, "Device not found\n");
return -ENODEV;
+
+ /*
+ * If the link is in POLL.{Active/Compliance} state, then the
+ * device is found to be connected to the bus, but it is not
+ * active i.e., the device firmware might not yet initialized.
+ */
+ } else if (ltssm == DW_PCIE_LTSSM_POLL_ACTIVE ||
+ ltssm == DW_PCIE_LTSSM_POLL_COMPLIANCE) {
+ dev_info(pci->dev, "Device found, but not active\n");
+ return -EIO;
}
dev_info(pci->dev, "Phy link never came up\n");
--
2.51.0
On Tue, Jan 20, 2026 at 11:17:41PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
>
> There are cases where the PCIe device would be physically connected to the
> bus, but the device firmware might not be active. So the LTSSM will
> get stuck in POLL.{Active/Compliance} states.
>
> This behavior is common with endpoint devices controlled by the PCI
> Endpoint framework, where the device will wait for the user to start its
> operation through configfs.
>
> For those cases, print the relevant log and return -EIO to indicate that
> the device is present, but not active. This will allow the callers to skip
> the failure as the device might become active in the future.
>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> ---
> drivers/pci/controller/dwc/pcie-designware.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> index 55c1c60f7f8f..aca5bbeade03 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.c
> +++ b/drivers/pci/controller/dwc/pcie-designware.c
> @@ -696,8 +696,9 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, u32 dir, int index)
> * dw_pcie_wait_for_link - Wait for the PCIe link to be up
> * @pci: DWC instance
> *
> - * Returns: 0 if link is up, -ENODEV if device is not found, -ETIMEDOUT if the
> - * link fails to come up for other reasons.
> + * Returns: 0 if link is up, -ENODEV if device is not found, -EIO if the device
> + * is found but not active and -ETIMEDOUT if the link fails to come up for other
> + * reasons.
> */
> int dw_pcie_wait_for_link(struct dw_pcie *pci)
> {
> @@ -722,6 +723,16 @@ int dw_pcie_wait_for_link(struct dw_pcie *pci)
> ltssm == DW_PCIE_LTSSM_DETECT_ACT) {
> dev_info(pci->dev, "Device not found\n");
> return -ENODEV;
> +
> + /*
> + * If the link is in POLL.{Active/Compliance} state, then the
> + * device is found to be connected to the bus, but it is not
> + * active i.e., the device firmware might not yet initialized.
> + */
> + } else if (ltssm == DW_PCIE_LTSSM_POLL_ACTIVE ||
> + ltssm == DW_PCIE_LTSSM_POLL_COMPLIANCE) {
> + dev_info(pci->dev, "Device found, but not active\n");
> + return -EIO;
> }
>
> dev_info(pci->dev, "Phy link never came up\n");
This should probably be squashed with the previous patch.
Regardless:
Reviewed-by: Niklas Cassel <cassel@kernel.org>
On Wed, Jan 21, 2026 at 09:23:22AM +0100, Niklas Cassel wrote:
> On Tue, Jan 20, 2026 at 11:17:41PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> > From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> >
> > There are cases where the PCIe device would be physically connected to the
> > bus, but the device firmware might not be active. So the LTSSM will
> > get stuck in POLL.{Active/Compliance} states.
> >
> > This behavior is common with endpoint devices controlled by the PCI
> > Endpoint framework, where the device will wait for the user to start its
> > operation through configfs.
> >
> > For those cases, print the relevant log and return -EIO to indicate that
> > the device is present, but not active. This will allow the callers to skip
> > the failure as the device might become active in the future.
> >
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
> > ---
> > drivers/pci/controller/dwc/pcie-designware.c | 15 +++++++++++++--
> > 1 file changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> > index 55c1c60f7f8f..aca5bbeade03 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware.c
> > +++ b/drivers/pci/controller/dwc/pcie-designware.c
> > @@ -696,8 +696,9 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, u32 dir, int index)
> > * dw_pcie_wait_for_link - Wait for the PCIe link to be up
> > * @pci: DWC instance
> > *
> > - * Returns: 0 if link is up, -ENODEV if device is not found, -ETIMEDOUT if the
> > - * link fails to come up for other reasons.
> > + * Returns: 0 if link is up, -ENODEV if device is not found, -EIO if the device
> > + * is found but not active and -ETIMEDOUT if the link fails to come up for other
> > + * reasons.
> > */
> > int dw_pcie_wait_for_link(struct dw_pcie *pci)
> > {
> > @@ -722,6 +723,16 @@ int dw_pcie_wait_for_link(struct dw_pcie *pci)
> > ltssm == DW_PCIE_LTSSM_DETECT_ACT) {
> > dev_info(pci->dev, "Device not found\n");
> > return -ENODEV;
> > +
> > + /*
> > + * If the link is in POLL.{Active/Compliance} state, then the
> > + * device is found to be connected to the bus, but it is not
> > + * active i.e., the device firmware might not yet initialized.
> > + */
> > + } else if (ltssm == DW_PCIE_LTSSM_POLL_ACTIVE ||
> > + ltssm == DW_PCIE_LTSSM_POLL_COMPLIANCE) {
> > + dev_info(pci->dev, "Device found, but not active\n");
> > + return -EIO;
> > }
> >
> > dev_info(pci->dev, "Phy link never came up\n");
>
> This should probably be squashed with the previous patch.
>
No. I'd like to keep it as a separate patch because I think this deserves its
own justification.
- Mani
--
மணிவண்ணன் சதாசிவம்
© 2016 - 2026 Red Hat, Inc.