linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <linux-usb@vger.kernel.org>, <stern@rowland.harvard.edu>
Cc: evgreen@google.com, shobhit.srivastava@intel.com,
	Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [RFC PATCH 0/1] hibernate and roothub port power
Date: Tue,  7 Jun 2022 16:58:35 +0300	[thread overview]
Message-ID: <20220607135836.627711-1-mathias.nyman@linux.intel.com> (raw)

Hi

Looking for comments on an issue where a self-powered usb device can
survive in suspended U3 state even if the host system is restarted.

This causes additional boot delay as boot firmware is not designed
to handle usb devices in U3.
Boot firmware waits for a usb state change in vain until it times out.

In shutdown (S5), with xHCI as host, this can be solved fairly easily
by turning off roothub port power in the .shutdown path.

This is discussed in xhci spec 4.19.4 for driver unload:
"Before the xHC driver is unloaded, the driver should clear the
Port Power (PP) flag of all Root Hub ports to place them into
the Disabled state and reduce port power consumption."

But for S4 hibernate things get more complicated.
We can't just turn off port power, especially if the usb device can
generate remote wake, and host should resume the system from S4.

But I can't come up with a better solution, so this RFC patch
does exactly that. It turns off port power for xHC roothub ports
in the hibernate poweroff_late stage, but only if the host isn't set
to wake up the system from S4.

This RFC workaround is specific to PCI xHC hosts, but if this solution
makes sense at all, shuold it be turned into a more generic solution?
Maybe calling hc_driver hcd->port_power(hcd, i, false) for each roothub
port in dev_pm_ops usb_hcd_pci_pm_ops .poweroff or .poweroff_late
callbacks?

Mathias Nyman (1):
  xhci: pci: power off roothub ports in hibernate poweroff_late stage

 drivers/usb/host/xhci-hub.c |  4 ++--
 drivers/usb/host/xhci-pci.c | 32 +++++++++++++++++++++++++++++++-
 drivers/usb/host/xhci.h     |  2 ++
 3 files changed, 35 insertions(+), 3 deletions(-)

-- 
2.25.1


             reply	other threads:[~2022-06-07 13:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 13:58 Mathias Nyman [this message]
2022-06-07 13:58 ` [RFC PATCH 1/1] xhci: pci: power off roothub ports in hibernate poweroff_late stage Mathias Nyman
2022-06-08  8:19 ` [RFC PATCH 0/1] hibernate and roothub port power Oliver Neukum
2022-06-08 11:47   ` Mathias Nyman
2022-06-08 13:43     ` Alan Stern
2022-06-09  7:59       ` Mathias Nyman
2022-06-09 13:48         ` Alan Stern
2022-06-10 10:30           ` Mathias Nyman
2022-06-09 15:08         ` Evan Green
2022-06-14 10:07           ` Mathias Nyman
2022-07-20 21:53             ` Evan Green
2022-08-09 13:49               ` Mathias Nyman
2022-08-15 19:01                 ` Evan Green

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=20220607135836.627711-1-mathias.nyman@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=evgreen@google.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=shobhit.srivastava@intel.com \
    --cc=stern@rowland.harvard.edu \
    /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).