From: Niklas Cassel <cassel@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: "Shawn Lin" <shawn.lin@rock-chips.com>,
"FUKAUMI Naoki" <naoki@radxa.com>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Anand Moon" <linux.amoon@gmail.com>,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
"Dragan Simic" <dsimic@manjaro.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Heiko Stuebner" <heiko@sntech.de>
Subject: Re: [RESEND] Re: [PATCH] PCI: dw-rockchip: Skip waiting for link up
Date: Mon, 10 Nov 2025 20:59:08 +0100 [thread overview]
Message-ID: <aRJEDEEJr9Ic-RKN@fedora> (raw)
In-Reply-To: <2n3wamm3txxc6xbmvf3nnrvaqpgsck3w4a6omxnhex3mqeujib@2tb4svn5d3z6>
On Mon, Nov 10, 2025 at 09:23:02PM +0530, Manivannan Sadhasivam wrote:
> >
> > Considering what Shawn says, that the switch gets enumerated properly
> > if we simply add a msleep() in ->start_link(), which will be called
> > by dw_pcie_host_init() before pci_host_probe() is called...
> >
>
> Yes, that delay probably gives enough time for the link up IRQ to kick in before
> the initial bus scan happens.
I think that the problem is that even for platforms with link up IRQ,
we will always do:
1) dw_pcie_start_link() (if (!dw_pcie_link_up()))
2) pci_host_probe() from dw_pcie_host_init(), this will enumerate the bus
3) pci_rescan_bus() from the Link Up IRQ handler
Thus, in 2, when enumerating the bus, without performing any of the delays
mandated by the PCIe spec, it still seems possible to detect a device (it
must have been really quick to initialize), and to communicate with that
device, however since we have not performed the delays mandated by the spec,
it appears that the device might not yet behave properly.
Hence my suggestion to never call pci_host_probe() in dw_pcie_host_init()
for platforms with Link Up IRQ.
At least for pcie-dw-rockchip.c, we only unmask the Link Up IRQ after
dw_pcie_host_init() has returned, so I think that your theory: that Shawn's
suggested delay causes the Link Up IRQ to kick in before the initial bus
scan, is incorrect. (Since the IRQ should not be able to trigger until
dw_pcie_host_init() has returned.)
>
> > ...we already have a delay in the link up IRQ handler, before calling
> > pci_rescan_bus().
> >
>
> That delay won't help in this case.
Sure, I was just saying that even though Shawn's patch made things work,
it seems incorrect, as we do not want to add "the same delay" that we
already have in the Link Up IRQ. (The delay in the Link Up IRQ should be
the only one.)
> > I think a better solution would be something like:
(snip)
> This solution will work as long as the PCIe device is powered ON before
> start_link(). For CEM and M.2 Key M connectors, the host controller can power
> manage the components. But for other specifications/keys requiring custom power
> management, a separate driver would be needed.
>
> That's why I suggested using pwrctrl framework as it can satisfy both usecases.
> However, as I said, it needs a bit of rework and I'm close to submitting it.
>
> But until that gets merged, either we need to revert your link up IRQ change or
> have the below patch. IMO, the revert seems simple.
Using pwrctrl framework once it can handle this use case sounds good to me.
FUKAUMI, could you please send a revert of the two patches?
Kind regards,
Niklas
next prev parent reply other threads:[~2025-11-10 19:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 10:59 [PATCH] PCI: dw-rockchip: Skip waiting for link up Niklas Cassel
2025-01-13 19:27 ` Bjorn Helgaas
2025-01-13 21:14 ` Niklas Cassel
2025-01-13 20:22 ` Bjorn Helgaas
2025-10-21 4:26 ` FUKAUMI Naoki
2025-10-21 7:10 ` Shawn Lin
2025-11-08 12:34 ` Niklas Cassel
2025-11-08 13:27 ` Niklas Cassel
2025-11-08 14:21 ` Diederik de Haas
2025-11-09 4:42 ` FUKAUMI Naoki
2025-11-09 12:28 ` Niklas Cassel
2025-11-09 23:16 ` FUKAUMI Naoki
2025-11-09 23:26 ` [RESEND] " FUKAUMI Naoki
2025-11-10 2:30 ` Shawn Lin
2025-11-10 4:56 ` FUKAUMI Naoki
2025-11-10 7:12 ` Shawn Lin
2025-11-10 7:52 ` FUKAUMI Naoki
2025-11-10 10:15 ` Shawn Lin
2025-11-10 12:34 ` Niklas Cassel
2025-11-10 12:41 ` Niklas Cassel
2025-11-10 15:21 ` FUKAUMI Naoki
2025-11-10 15:37 ` Manivannan Sadhasivam
2025-11-10 15:53 ` Manivannan Sadhasivam
2025-11-10 19:59 ` Niklas Cassel [this message]
2025-11-10 22:14 ` FUKAUMI Naoki
2025-11-11 2:09 ` FUKAUMI Naoki
2025-11-11 3:17 ` Shawn Lin
2025-11-11 14:00 ` Niklas Cassel
2025-11-11 1:11 ` Shawn Lin
2025-11-10 11:24 ` 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=aRJEDEEJr9Ic-RKN@fedora \
--to=cassel@kernel.org \
--cc=bhelgaas@google.com \
--cc=dlemoal@kernel.org \
--cc=dsimic@manjaro.org \
--cc=heiko@sntech.de \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux.amoon@gmail.com \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=naoki@radxa.com \
--cc=robh@kernel.org \
--cc=shawn.lin@rock-chips.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;
as well as URLs for NNTP newsgroup(s).