From: Bjorn Helgaas <helgaas@kernel.org>
To: Daniel Drake <drake@endlessm.com>
Cc: linux-pci@vger.kernel.org, rafael.j.wysocki@intel.com,
linux@endlessm.com, linux-pm@vger.kernel.org,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] PCI: increase D3 delay for AMD Ryzen5/7 XHCI controllers
Date: Thu, 21 Nov 2019 12:15:00 -0600 [thread overview]
Message-ID: <20191121181500.GA55996@google.com> (raw)
In-Reply-To: <20191120002836.GA247344@google.com>
On Tue, Nov 19, 2019 at 06:28:36PM -0600, Bjorn Helgaas wrote:
> On Mon, Oct 14, 2019 at 02:13:55PM +0800, Daniel Drake wrote:
> > On Asus laptops with AMD Ryzen7 3700U and AMD Ryzen5 3500U,
>
> Can you include specific models here in case we revisit this or find a
> generic solution that needs to be tested to make sure we don't regress
> these platforms?
>
> Maybe a bugzilla with complete "lspci -vvnn" and dmesg logs?
>
> > the XHCI controller fails to resume from runtime suspend or s2idle,
> > and USB becomes unusable from that point.
> >
> > xhci_hcd 0000:03:00.4: Refused to change power state, currently in D3
> > xhci_hcd 0000:03:00.4: enabling device (0000 -> 0002)
> > xhci_hcd 0000:03:00.4: WARN: xHC restore state timeout
> > xhci_hcd 0000:03:00.4: PCI post-resume error -110!
> > xhci_hcd 0000:03:00.4: HC died; cleaning up
> >
> > The D3-to-D0 transition is successful if the D3 delay is increased
> > to 20ms. Add an appropriate quirk for the affected hardware.
>
> IIUC, we're doing a D3cold-to-D0 transition in this path:
>
> pci_pm_default_resume_early
> pci_power_up
> platform_pci_set_power_state(PCI_D0) # turn on via ACPI
> pci_raw_set_power_state(PCI_D0)
> pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr)
> # pmcsr says device is in D3hot
> pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr)
> # sets to D0
> pci_dev_d3_sleep # <-- need more time here
>
> I would sort of expect that ACPI would be putting the device in D0,
> not leaving it in D3hot, but maybe that's just my ignorance.
I definitely was not understanding this correctly. There is no path
for a D3cold -> D3hot transition. Per spec (PCIe r5.0, sec 5.8), the
only legal exit from D3cold is to D0uninitialized.
I know you tried a debug patch to call pci_dev_wait(), and it didn't
work, but I'm not sure exactly where it was called. I have these
patches on my pci/pm branch for v5.5:
bae26849372b ("PCI/PM: Move pci_dev_wait() definition earlier")
395f121e6199 ("PCI/PM: Wait for device to become ready after power-on")
The latter adds the wait just before we call
pci_raw_set_power_state(). If the device is responding with CRS
status, that should be the point where we'd see it. If you have a
chance to try it, I'd be interested in the results. Here's the
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?h=pci/pm&id=395f121e61994bc135bb669eb35325d5457d669d
next prev parent reply other threads:[~2019-11-21 18:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 6:13 [PATCH] PCI: increase D3 delay for AMD Ryzen5/7 XHCI controllers Daniel Drake
2019-10-14 15:43 ` Bjorn Helgaas
2019-10-15 5:31 ` Daniel Drake
2019-10-15 17:52 ` Rafael J. Wysocki
2019-10-16 6:14 ` Daniel Drake
2019-10-21 11:33 ` Mika Westerberg
2019-10-22 2:40 ` Daniel Drake
2019-10-22 9:33 ` Mika Westerberg
2019-10-23 22:40 ` Bjorn Helgaas
2019-10-24 3:28 ` Daniel Drake
2019-10-24 17:00 ` Bjorn Helgaas
2019-10-25 7:11 ` Daniel Drake
2019-10-25 16:28 ` Bjorn Helgaas
2019-10-28 6:32 ` Daniel Drake
2019-11-18 8:52 ` Daniel Drake
2019-11-20 0:28 ` Bjorn Helgaas
2019-11-21 18:15 ` Bjorn Helgaas [this message]
2019-11-22 3:00 ` Daniel Drake
2019-11-22 11:15 ` Rafael J. Wysocki
2019-11-25 3:45 ` Daniel Drake
2019-11-25 13:37 ` Rafael J. Wysocki
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=20191121181500.GA55996@google.com \
--to=helgaas@kernel.org \
--cc=drake@endlessm.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@endlessm.com \
--cc=rafael.j.wysocki@intel.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).