From: Brian Norris <briannorris@chromium.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: "Bartosz Golaszewski" <brgl@bgdev.pl>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Jingoo Han" <jingoohan1@gmail.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Krishna Chaitanya Chundru" <krishna.chundru@oss.qualcomm.com>,
"Rob Herring" <robh@kernel.org>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, dmitry.baryshkov@linaro.org,
"Tsai Sung-Fu" <danielsftsai@google.com>
Subject: Re: [RFC] PCI: pwrctrl and link-up dependencies
Date: Wed, 16 Apr 2025 10:14:53 -0700 [thread overview]
Message-ID: <Z__ljc6WaK8u5kff@google.com> (raw)
In-Reply-To: <eix65qdwtk5ocd7lj6sw2lslidivauzyn6h5cc4mc2nnci52im@qfmbmwy2zjbe>
Hi Manivannan,
On Wed, Apr 16, 2025 at 11:29:32AM +0530, Manivannan Sadhasivam wrote:
> On Tue, Apr 15, 2025 at 11:24:39AM -0700, Brian Norris wrote:
> > We might be talking past each other. Per above, I think we can do better
> > with (1)-(3). But you're bringing up (4). Problem (3) exists for all
> > drivers, although it's more acute with DWC, and I happen to be using it.
> > I also think it's indicative of larger design and ordering problems in
> > pwrctrl.
> >
>
> Now I get what you are saying.
Great! I probably didn't include all my thoughts in the first place, but
then, my first email was already long enough :)
> > As an example less-cute way of doing pwrctrl: expose a wrapped version
> > of pci_pwrctrl_create_device() such that drivers can call it earlier. If
> > there is a pwrctrl device created, that means a driver should not yet
> > wait for link-up -- it should defer that until the relevant pwrctrl is
> > marked "ready". (There are likely other problems to solve in here too,
> > but this is just an initial sketch. And to be clear, I suspect this
> > doesn't fit your notion of "generic", because it requires each driver to
> > adapt to it.)
> >
>
> This is what I initially had in my mind, but then I opted for a solution which
> allowed the pwrctrl devices to be created in the PCI core itself without any
> modifications in the controller drivers.
>
> But I totally agree with you that now we don't have any control over PERST# and
> that should be fixed.
Yeah, if we have to handle PERST# and its timing, then we have to touch
essentially every driver anyway, I think. So it's definitely a chance to
go a (slightly) different direction.
(Side note: I think this is potentially a chance to solve the odd I2C
pwrctrl problem I linked in my original post with the same set of hooks.
If a controller driver can know when pwrctrl is finished, then it can
also defer its LTSSM until after that point.
I doubt this will be the last set of "odd" HW where additional
platform-specific dependencies need to be inserted between pwrctrl and
PCI enumeration.)
> > IOW, the pwrctl sequence should be something like:
> >
> > (1) power up the slot
> > (1)(a) delay, per spec
> > (1)(b) deassert PERST#
> > (1)(c) wait for link up
> > (2) rescan bus
> >
> > Currently, we skip all of (1)(a)-(c). We're probably lucky that (1)(b)'s
> > ordering doesn't matter all the time, as long as we did it earlier. And
> > we're lucky that there are natural delays in software such that lack of
> > (1)(a) and (1)(c) aren't significant.
> >
>
> Let me go back to the drawing board and come up with a proposal. There are
> atleast a couple of ways to fix this issue and I need to pick a less intrusive
> one.
That's kind of you. Let me know if I can help at all. Or at least CC me
on any updates you have.
> Thanks for reporting it, appreciated!
Thanks for walking through it with me!
Brian
prev parent reply other threads:[~2025-04-16 17:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 19:59 [RFC] PCI: pwrctrl and link-up dependencies Brian Norris
2025-04-08 21:26 ` Brian Norris
2025-04-14 11:07 ` Manivannan Sadhasivam
2025-04-14 23:16 ` Brian Norris
2025-04-15 18:12 ` Jim Quinlan
2025-04-10 9:59 ` Niklas Cassel
2025-04-14 10:57 ` Manivannan Sadhasivam
2025-04-14 23:24 ` Brian Norris
2025-04-15 5:32 ` Manivannan Sadhasivam
2025-04-15 18:24 ` Brian Norris
2025-04-16 5:59 ` Manivannan Sadhasivam
2025-04-16 17:14 ` Brian Norris [this message]
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=Z__ljc6WaK8u5kff@google.com \
--to=briannorris@chromium.org \
--cc=bhelgaas@google.com \
--cc=brgl@bgdev.pl \
--cc=danielsftsai@google.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=jingoohan1@gmail.com \
--cc=krishna.chundru@oss.qualcomm.com \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=robh@kernel.org \
/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).