From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Joonhoe Kim <26rote@gmail.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"xu.yang_2@oss.nxp.com" <xu.yang_2@oss.nxp.com>,
"aiyengar1990@gmail.com" <aiyengar1990@gmail.com>,
"mathias.nyman@intel.com" <mathias.nyman@intel.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] usb: dwc3: tell xHCI that it lost its state when the core is powered off
Date: Wed, 25 Nov 2026 02:37:38 +0000 [thread overview]
Message-ID: <awZHwRiICsPs-UyI@vbox> (raw)
In-Reply-To: <20261112141512.1840-1-26rote@gmail.com>
++ Xu Yang,
On Thu, Nov 12, 2026, Joonhoe Kim wrote:
> dwc3_suspend_common() powers the core off for system suspend
> (dwc3_core_exit()) in OTG mode (DWC3_GCTL_PRTCAP_OTG), and in host mode
> when the controller may not wake the system or needs a full re-init. The
> xHCI registers and the state saved with the Controller Save State
> command are gone then, but nothing tells xhci-plat: xhci_resume() takes
> the "state intact" path, writes the saved registers back and asks the
> controller to restore its state (CRS).
>
> xhci-plat has a flag for exactly this, power_lost (commit 668cc6bc1178
> ("usb: host: xhci-plat: allow upper layers to signal power loss"), used
> by cdns3), but dwc3 never sets it.
>
> On a Lenovo Y700 Gen 5 (TB323FU, SM8850; DWC3 + eUSB2 PHY) with a USB
> 2.0 hub, a USB 3 flash drive and a Billboard device attached, and USB
> wakeup disabled, s2idle then broke the host controller on resume: either
> the controller wrote to an address that was not mapped
>
> arm-smmu 15000000.iommu: Unhandled context fault: fsr=0x402,
> iova=0xd85e7c300, fsynr=0x3d0011, cbfrsynra=0x40, cb=13
> xhci-hcd xhci-hcd.2.auto: WARNING: Host System Error
> usb 1-1: hub failed to enable device, error -108
>
> or its command ring would not stop
>
> xhci-hcd xhci-hcd.2.auto: Abort failed to stop command ring: -110
> xhci-hcd xhci-hcd.2.auto: xHCI host controller not responding, assume dead
> xhci-hcd xhci-hcd.2.auto: HC died; cleaning up
> usb 1-1: PM: **** DPM device timeout ****
> Kernel panic - not syncing: usb 1-1: unrecoverable failure
>
> With wakeup enabled (the core stays powered) the same setup survived
> every cycle.
>
> Record that the core was powered off and pass this to xhci-plat as
> power_lost from a resume_quirk, so that xhci_resume() resets the
> controller and the devices are re-enumerated. Unlike a static
> XHCI_RESET_ON_RESUME this only applies to the resumes that follow a
> power-off; resumes with the core kept powered (host mode with wakeup
> enabled) and runtime resume keep the restore path. Clear the flag once
> xhci-plat has read it, so that a later system suspend that fails before
> the dwc3 core is suspended does not reset the controller.
>
> Fixes: c4a5153e87fd ("usb: dwc3: core: Power-off core/PHYs on system_suspend in host mode")
> Fixes: f09cc79b4b33 ("usb: dwc3: add dual role support using OTG block")
Can we also Cc stable?
> Signed-off-by: Joonhoe Kim <26rote@gmail.com>
> ---
> v2:
> - Also set the flag when the core is powered off in OTG mode with the
> host role active (Sashiko [1])
> - Clear the flag once xhci-plat has read it (Sashiko [1]), instead of in
> the host branch that keeps the core powered
> - Drop the comment above the resume quirk
> - Add a Fixes tag for the OTG branch
> - Rebased on next-20261111
>
> Testing, 30 s RTC s2idle with wakeup disabled on the setup above:
> without this change 1/1 cycles lost the controller; with this version
> 3/3 cycles reset the controller and re-enumerated all devices.
> OTG mode (DWC3_GCTL_PRTCAP_OTG) is not tested; this board switches
> roles through usb-role-switch and never uses it.
>
> host.c now includes xhci.h for hcd_to_xhci_priv().
>
This looks good to me.
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Hi Xu,
This may conflict with your "usb: dwc3: wait for the port to leave
RxDetect before xHCI reset" patch. Can you check if rebasing on this
patch work for you?
Thanks,
Thinh
next prev parent reply other threads:[~2026-11-25 2:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 14:15 [PATCH v2] usb: dwc3: tell xHCI that it lost its state when the core is powered off Joonhoe Kim
2026-11-12 14:26 ` sashiko-bot
2026-11-15 8:05 ` Arun Iyengar
2026-11-25 2:37 ` Thinh Nguyen [this message]
2026-11-25 4:44 ` Xu Yang
2026-11-25 18:11 ` Joonhoe Kim
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=awZHwRiICsPs-UyI@vbox \
--to=thinh.nguyen@synopsys.com \
--cc=26rote@gmail.com \
--cc=aiyengar1990@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=xu.yang_2@oss.nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.