linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Daniel Drake <drake@endlessm.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Mathias Nyman <mathias.nyman@linux.intel.com>,
	Linux USB Mailing List <linux-usb@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Endless Linux Upstreaming Team <linux@endlessm.com>
Subject: Re: Ryzen7 3700U xhci fails on resume from sleep
Date: Wed, 28 Aug 2019 10:43:29 +0200	[thread overview]
Message-ID: <CAJZ5v0j=x4HHOsJ6fCX-xOr29-4BMRzjR5H5UaoWW9v-Ci8ODQ@mail.gmail.com> (raw)
In-Reply-To: <CAD8Lp47oNJb5N5i4oUQfN5b=xCtUc1Lt852pnXxhNq0vyWj=yg@mail.gmail.com>

On Wed, Aug 28, 2019 at 10:34 AM Daniel Drake <drake@endlessm.com> wrote:
>
> On Tue, Aug 27, 2019 at 3:48 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > That depends on what exactly happens when you try to do the D0-D3-D0
> > with setpci.  If the device becomes unreachable (or worse) after that,
> > it indicates a platform issue.  It should not do any harm at the
> > least.
> >
> > However, in principle D0-D3-D0 at the PCI level alone may not be
> > sufficient, because ACPI may need to be involved.
>
> After using setpci to do D0-D3-D0 transitions, the xhci module fails to probe.
>
>   xhci_hcd 0000:03:00.3: WARN: xHC restore state timeout
>   xhci_hcd 0000:03:00.3: PCI post-resume error -110!
>
> But maybe it's not a great test; as you say I'm not involving ACPI,
> and also if Linux has a reason for not runtime suspending PCI devices
> without drivers present then maybe I should also not be doing this.
>
> > I think that PM-runtime should suspend XHCI controllers without
> > anything on the bus under them, so I wonder what happens if
> > ".../power/control" is set to "on" and then to "auto" for that device,
> > with the driver loaded.
>
> Good hint.
>
> # echo on > /sys/bus/pci/devices/0000\:03\:00.3/power/control
> # echo auto > /sys/bus/pci/devices/0000\:03\:00.3/power/control
> # echo 1 > /sys/bus/usb/devices/1-4/remove
> # cat /sys/bus/pci/devices/0000\:03\:00.3/power/runtime_status
> suspended
> # echo on > /sys/bus/pci/devices/0000\:03\:00.3/power/control
>
> The final command there triggers these messages (including a printk I
> added in pci_raw_set_power_state):
>  xhci_hcd 0000:03:00.3: pci_raw_set_power_state from 3 to 0
>  xhci_hcd 0000:03:00.3: Refused to change power state, currently in D3
>  xhci_hcd 0000:03:00.3: pci_raw_set_power_state from 3 to 0
>  xhci_hcd 0000:03:00.3: enabling device (0000 -> 0002)
>  xhci_hcd 0000:03:00.3: WARN: xHC restore state timeout
>  xhci_hcd 0000:03:00.3: PCI post-resume error -110!
>  xhci_hcd 0000:03:00.3: HC died; cleaning up
>
> So we just reproduced the same issue using runtime PM, without having
> to go through the whole suspend path.
>
> I guess that points towards a platform issue, although the weird thing
> is that Windows presumably does the D3-D0-D3 transition during
> suspend/resume and that appears to work fine.

It looks like the platform expects the OS to do something that our
generic XHCI driver and the PCI/ACPI layer don't do.

A quirk or similar may be needed to address that.

> I'll report it to the vendor,

Yes, please.  At least try to get the information on what the exact
platform expectations with respect to the OS are.  Quite evidently,
they aren't just "do the usual thing".

> but if you have any other debug ideas they would be much appreciated.

With the git branch mentioned previously merged in, you can enable
dynamic debug in device_pm.c, repeat the PM-runtime test and collect
the log.  There should be some additional messages from the ACPI layer
in it.


>
> Daniel

  reply	other threads:[~2019-08-28  8:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26  9:10 Ryzen7 3700U xhci fails on resume from sleep Daniel Drake
2019-08-26  9:29 ` Rafael J. Wysocki
2019-08-26 13:34   ` Mathias Nyman
2019-08-27  2:49     ` Daniel Drake
2019-08-27  7:48       ` Rafael J. Wysocki
2019-08-28  8:34         ` Daniel Drake
2019-08-28  8:43           ` Rafael J. Wysocki [this message]
2019-08-29  7:33             ` Daniel Drake
2019-09-23  9:10             ` Daniel Drake
2019-09-25  5:36               ` Daniel Drake
2019-10-08  5:42                 ` Daniel Drake

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='CAJZ5v0j=x4HHOsJ6fCX-xOr29-4BMRzjR5H5UaoWW9v-Ci8ODQ@mail.gmail.com' \
    --to=rafael@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=mathias.nyman@linux.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).