public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: manivannan.sadhasivam@oss.qualcomm.com
Cc: "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>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	vincent.guittot@linaro.org, zhangsenchuan@eswincomputing.com,
	"Shawn Lin" <shawn.lin@rock-chips.com>,
	dlemoal@kernel.org
Subject: Re: [PATCH v3 0/4] PCI: dwc: Rework the error handling of dw_pcie_wait_for_link() API
Date: Fri, 2 Jan 2026 13:01:02 +0100	[thread overview]
Message-ID: <aVezfq-8bTKczYkp@ryzen> (raw)
In-Reply-To: <20251230-pci-dwc-suspend-rework-v3-0-40cd485714f5@oss.qualcomm.com>

On Tue, Dec 30, 2025 at 08:37:31PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> Hi,
>
> This series reworks the dw_pcie_wait_for_link() API to allow the callers to
> detect the absence of the device on the bus and skip the failure.
>
> Compared to v2, I've reworked the patch 2 to improve the API further and
> dropped the patch 1 that got applied (hence changed the subject). I've also
> modified the error code based on the feedback in v2 to return -ENODEV if device
> is not detected on the bus and -ETIMEDOUT otherwise. This allows the callers to
> skip the failure if device is not detected and handle error for other failure.
>
> Testing
> =======
>
> Tested this series on Rb3Gen2 board without powering on the PCIe switch. Now the
> dw_pcie_wait_for_link() API prints:
>
>	qcom-pcie 1c08000.pcie: Device not found
>
> Instead of the previous log:
>
>	qcom-pcie 1c08000.pcie: Phy link never came up

Hello Mani,

I really like this series.

However when testing my usual setup with 2 Rock 5B:s, one in EP mode, one
in RC mode, where I usually power on both boards at the same time, but only
after both boards are booted, do I do the configfs write to enable the link
training on EP, and then do a rescan on the RC.

Even with this series, this workflow still works in 8 out of 10 boots.


However, in 2 out of 10 boots I instead got:
[    2.285827] rockchip-dw-pcie a40000000.pcie: Link failed to come up. LTSSM: POLL_COMPLIANCE
[    2.286584] rockchip-dw-pcie a40000000.pcie: probe with driver rockchip-dw-pcie failed with error -110

In both cases LTSSM was in POLL_COMPLIANCE.


Considering that things work in 8 out of 10 boots, means that the LTSSM state
was in Detect.Quiet or Detect.Active.

I did comment out goto err_stop_link if dw_pcie_wait_for_link(), so I can dump
LTSSM afterwards, when this happens.

[    2.293785] rockchip-dw-pcie a40000000.pcie: Link failed to come up. LTSSM: POLL_COMPLIANCE

Then I do:

# cat /sys/kernel/debug/dwc_pcie_a40000000.pcie/ltssm_status 
POLL_COMPLIANCE (0x03)

So LTSSM is still in Poll.Compliance.

However, as soon as I do the configfs writes on the EP board:


# cat /sys/kernel/debug/dwc_pcie_a40000000.pcie/ltssm_status 
L0 (0x11)
# cat /sys/kernel/debug/dwc_pcie_a40000000.pcie/ltssm_status 
L0 (0x11)

LTSSM transitions out of compliance, and rescan will find my device:

# echo 1 > /sys/bus/pci/devices/0000:00:00.0/rescan 
[  246.777867] pci 0000:01:00.0: [1d87:3588] type 00 class 0xff0000 PCIe Endpoint
[  246.778627] pci 0000:01:00.0: BAR 0 [mem 0x00000000-0x000fffff]
[  246.779151] pci 0000:01:00.0: BAR 1 [mem 0x00000000-0x000fffff]
[  246.779672] pci 0000:01:00.0: BAR 2 [mem 0x00000000-0x000fffff]
[  246.780192] pci 0000:01:00.0: BAR 3 [mem 0x00000000-0x000fffff]
[  246.780716] pci 0000:01:00.0: BAR 5 [mem 0x00000000-0x000fffff]
[  246.781236] pci 0000:01:00.0: ROM [mem 0x00000000-0x0000ffff pref]



I understand that in most normal situations, the endpoint is powered on
before powering on the host side (or there is no EP connected at all).
But somehow, for us PCIe endpoint developers, it would be nice if we
could keep the behavior of being able to rescan the bus, even when the EP
is not powered on before the host side.

Perhaps a Kconfig or module param? Suggestions?


Kind regards,
Niklas

  parent reply	other threads:[~2026-01-02 12:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30 15:07 [PATCH v3 0/4] PCI: dwc: Rework the error handling of dw_pcie_wait_for_link() API Manivannan Sadhasivam via B4 Relay
2025-12-30 15:07 ` [PATCH v3 1/4] PCI: dwc: Return -ENODEV from dw_pcie_wait_for_link() if device is not found Manivannan Sadhasivam via B4 Relay
2025-12-30 15:07 ` [PATCH v3 2/4] PCI: dwc: Rename and move ltssm_status_string() to pcie-designware.c Manivannan Sadhasivam via B4 Relay
2025-12-30 15:07 ` [PATCH v3 3/4] PCI: dwc: Rework the error print of dw_pcie_wait_for_link() Manivannan Sadhasivam via B4 Relay
2025-12-30 15:07 ` [PATCH v3 4/4] PCI: dwc: Only skip the dw_pcie_wait_for_link() failure if it returns -ENODEV Manivannan Sadhasivam via B4 Relay
2026-01-02 12:01 ` Niklas Cassel [this message]
2026-01-05 11:41   ` [PATCH v3 0/4] PCI: dwc: Rework the error handling of dw_pcie_wait_for_link() API Manivannan Sadhasivam
2026-01-07 12:52     ` Niklas Cassel
2026-01-09 16:21       ` Niklas Cassel
2026-01-16  8:57         ` Manivannan Sadhasivam
2026-01-20 14:35           ` Niklas Cassel
2026-01-21 12:45   ` Shawn Lin
2026-01-21 13:22     ` Niklas Cassel
2026-01-21 15:47       ` Manivannan Sadhasivam
2026-01-22  3:37       ` Shawn Lin
2026-01-05 10:04 ` Vincent Guittot
2026-01-05 11:52   ` 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=aVezfq-8bTKczYkp@ryzen \
    --to=cassel@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=dlemoal@kernel.org \
    --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=shawn.lin@rock-chips.com \
    --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