* [RFC PATCH] usb: dwc3: core: resume xHCI child on runtime resume in host mode
@ 2026-08-11 9:08 Junzhong Pan
2026-08-12 0:16 ` Greg Kroah-Hartman
2026-08-27 2:11 ` Thinh Nguyen
0 siblings, 2 replies; 6+ messages in thread
From: Junzhong Pan @ 2026-08-11 9:08 UTC (permalink / raw)
To: Thinh Nguyen, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, troy.mitchell, peixin.xie
USB controller runtime suspend halts the controller on disconnection.
It relies on platforms with custom connection notification to start
the controller again.
The host branch of dwc3_runtime_resume() does nothing currently. There
are two paths that can trigger a runtime resume of the dwc3 core in
host mode:
(a) Wake lands on the xHCI child (DT platforms, e.g. Qualcomm, i.MX8MP)
A platform wakeup IRQ fires and the glue handler calls
pm_runtime_resume(&xhci->dev). Runtime PM walks upward, resumes
the dwc3 parent first, then resumes xHCI. Both wake correctly.
(b) Wake lands on the dwc3 parent (ACPI platforms)
When an ACPI Notify(ACPI_NOTIFY_DEVICE_WAKE) targets the dwc3
parent device -- for example via a Generic Event Device on a
hardware-reduced platform where dwc3 is enumerated as an ACPI
device without a glue driver -- the ACPI core turns this into
pm_request_resume(dwc3_dev). Runtime PM does not propagate resume
downward, so the xHCI child stays suspended. Root hub polling is
never re-armed, and a device plugged in while suspended is silently
dropped.
This patch fills in the host branch to cover case (b) by requesting an
async resume of the xHCI child so xhci_resume() can restore the port
state machine and re-arm root hub polling. Async is required to avoid
deadlocking on the parent's own rpm_resume() re-entry.
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
base-commit: d58772d8520c7ef247c4b95c9bd76d3a25da9ff5
drivers/usb/dwc3/core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index ceb49f2f8004..bce56765ad90 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -2668,6 +2668,18 @@ int dwc3_runtime_resume(struct dwc3 *dwc)
}
break;
case DWC3_GCTL_PRTCAP_HOST:
+ /*
+ * Only the xHCI child's resume re-arms root hub polling, which
+ * is what rediscovers a device plugged in while suspended.
+ * Runtime PM never resumes children on its own, so request it
+ * here. This has to be asynchronous: resuming the child
+ * synchronously would deadlock because rpm_resume() tries to
+ * resume the parent before the child, and here the parent's
+ * own callback has not returned yet.
+ */
+ if (dwc->xhci)
+ pm_request_resume(&dwc->xhci->dev);
+ break;
default:
/* do nothing */
break;
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] usb: dwc3: core: resume xHCI child on runtime resume in host mode
2026-08-11 9:08 [RFC PATCH] usb: dwc3: core: resume xHCI child on runtime resume in host mode Junzhong Pan
@ 2026-08-12 0:16 ` Greg Kroah-Hartman
2026-08-12 1:51 ` Junzhong Pan
2026-08-27 2:11 ` Thinh Nguyen
1 sibling, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-08-12 0:16 UTC (permalink / raw)
To: Junzhong Pan
Cc: Thinh Nguyen, linux-usb, linux-kernel, troy.mitchell, peixin.xie
On Tue, Aug 11, 2026 at 05:08:17PM +0800, Junzhong Pan wrote:
> USB controller runtime suspend halts the controller on disconnection.
> It relies on platforms with custom connection notification to start
> the controller again.
>
> The host branch of dwc3_runtime_resume() does nothing currently. There
> are two paths that can trigger a runtime resume of the dwc3 core in
> host mode:
>
> (a) Wake lands on the xHCI child (DT platforms, e.g. Qualcomm, i.MX8MP)
> A platform wakeup IRQ fires and the glue handler calls
> pm_runtime_resume(&xhci->dev). Runtime PM walks upward, resumes
> the dwc3 parent first, then resumes xHCI. Both wake correctly.
>
> (b) Wake lands on the dwc3 parent (ACPI platforms)
> When an ACPI Notify(ACPI_NOTIFY_DEVICE_WAKE) targets the dwc3
> parent device -- for example via a Generic Event Device on a
> hardware-reduced platform where dwc3 is enumerated as an ACPI
> device without a glue driver -- the ACPI core turns this into
> pm_request_resume(dwc3_dev). Runtime PM does not propagate resume
> downward, so the xHCI child stays suspended. Root hub polling is
> never re-armed, and a device plugged in while suspended is silently
> dropped.
>
> This patch fills in the host branch to cover case (b) by requesting an
> async resume of the xHCI child so xhci_resume() can restore the port
> state machine and re-arm root hub polling. Async is required to avoid
> deadlocking on the parent's own rpm_resume() re-entry.
>
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
> ---
> base-commit: d58772d8520c7ef247c4b95c9bd76d3a25da9ff5
> drivers/usb/dwc3/core.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
Did you get LLM help with creating this patch?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] usb: dwc3: core: resume xHCI child on runtime resume in host mode
2026-08-12 0:16 ` Greg Kroah-Hartman
@ 2026-08-12 1:51 ` Junzhong Pan
0 siblings, 0 replies; 6+ messages in thread
From: Junzhong Pan @ 2026-08-12 1:51 UTC (permalink / raw)
To: gregkh
Cc: Thinh.Nguyen, linux-kernel, linux-usb, panjunzhong, peixin.xie,
troy.mitchell
Hi Greg,
> Did you get LLM help with creating this patch?
YES and I missed the documentation [1] that work with LLM.
I'll add the tag in the next version.
Since this is an RFC patch, I would appreciate any comments
you may have on the approach of handling runtime resume for
ACPI dwc3 host.
[1] https://docs.kernel.org/process/coding-assistants.html
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] usb: dwc3: core: resume xHCI child on runtime resume in host mode
2026-08-11 9:08 [RFC PATCH] usb: dwc3: core: resume xHCI child on runtime resume in host mode Junzhong Pan
2026-08-12 0:16 ` Greg Kroah-Hartman
@ 2026-08-27 2:11 ` Thinh Nguyen
2026-08-27 9:52 ` Junzhong Pan
1 sibling, 1 reply; 6+ messages in thread
From: Thinh Nguyen @ 2026-08-27 2:11 UTC (permalink / raw)
To: Junzhong Pan
Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb, linux-kernel,
troy.mitchell, peixin.xie
Hi,
On Tue, Aug 11, 2026, Junzhong Pan wrote:
> USB controller runtime suspend halts the controller on disconnection.
> It relies on platforms with custom connection notification to start
> the controller again.
>
> The host branch of dwc3_runtime_resume() does nothing currently. There
> are two paths that can trigger a runtime resume of the dwc3 core in
> host mode:
>
> (a) Wake lands on the xHCI child (DT platforms, e.g. Qualcomm, i.MX8MP)
> A platform wakeup IRQ fires and the glue handler calls
> pm_runtime_resume(&xhci->dev). Runtime PM walks upward, resumes
> the dwc3 parent first, then resumes xHCI. Both wake correctly.
>
> (b) Wake lands on the dwc3 parent (ACPI platforms)
> When an ACPI Notify(ACPI_NOTIFY_DEVICE_WAKE) targets the dwc3
> parent device -- for example via a Generic Event Device on a
> hardware-reduced platform where dwc3 is enumerated as an ACPI
> device without a glue driver -- the ACPI core turns this into
> pm_request_resume(dwc3_dev). Runtime PM does not propagate resume
> downward, so the xHCI child stays suspended. Root hub polling is
> never re-armed, and a device plugged in while suspended is silently
> dropped.
Good catch.
>
> This patch fills in the host branch to cover case (b) by requesting an
> async resume of the xHCI child so xhci_resume() can restore the port
> state machine and re-arm root hub polling. Async is required to avoid
> deadlocking on the parent's own rpm_resume() re-entry.
>
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
> ---
> base-commit: d58772d8520c7ef247c4b95c9bd76d3a25da9ff5
> drivers/usb/dwc3/core.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index ceb49f2f8004..bce56765ad90 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -2668,6 +2668,18 @@ int dwc3_runtime_resume(struct dwc3 *dwc)
> }
> break;
> case DWC3_GCTL_PRTCAP_HOST:
> + /*
> + * Only the xHCI child's resume re-arms root hub polling, which
> + * is what rediscovers a device plugged in while suspended.
> + * Runtime PM never resumes children on its own, so request it
> + * here. This has to be asynchronous: resuming the child
> + * synchronously would deadlock because rpm_resume() tries to
> + * resume the parent before the child, and here the parent's
> + * own callback has not returned yet.
> + */
This note sounds as if this is needed to all cases, but you're only
describing only case b) here. Can you also mention for case a) that
there maybe an extra resume work call.
Would be nice for it to be cleaner without the extra call, but I think
it should be fine.
> + if (dwc->xhci)
> + pm_request_resume(&dwc->xhci->dev);
> + break;
> default:
> /* do nothing */
> break;
> --
> 2.25.1
>
Thanks for the patch, can you resubmit with the proper assisted-by tag
and remove the RFC?
After the change:
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Thanks,
Thinh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] usb: dwc3: core: resume xHCI child on runtime resume in host mode
2026-08-27 2:11 ` Thinh Nguyen
@ 2026-08-27 9:52 ` Junzhong Pan
2026-08-27 23:42 ` Thinh Nguyen
0 siblings, 1 reply; 6+ messages in thread
From: Junzhong Pan @ 2026-08-27 9:52 UTC (permalink / raw)
To: Thinh Nguyen
Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, troy.mitchell, peixin.xie
On 8/27/2026 10:11 AM, Thinh Nguyen wrote:
> Hi,
>
> On Tue, Aug 11, 2026, Junzhong Pan wrote:
>> USB controller runtime suspend halts the controller on disconnection.
>> It relies on platforms with custom connection notification to start
>> the controller again.
>>
>> The host branch of dwc3_runtime_resume() does nothing currently. There
>> are two paths that can trigger a runtime resume of the dwc3 core in
>> host mode:
>>
>> (a) Wake lands on the xHCI child (DT platforms, e.g. Qualcomm, i.MX8MP)
>> A platform wakeup IRQ fires and the glue handler calls
>> pm_runtime_resume(&xhci->dev). Runtime PM walks upward, resumes
>> the dwc3 parent first, then resumes xHCI. Both wake correctly.
>>
>> (b) Wake lands on the dwc3 parent (ACPI platforms)
>> When an ACPI Notify(ACPI_NOTIFY_DEVICE_WAKE) targets the dwc3
>> parent device -- for example via a Generic Event Device on a
>> hardware-reduced platform where dwc3 is enumerated as an ACPI
>> device without a glue driver -- the ACPI core turns this into
>> pm_request_resume(dwc3_dev). Runtime PM does not propagate resume
>> downward, so the xHCI child stays suspended. Root hub polling is
>> never re-armed, and a device plugged in while suspended is silently
>> dropped.
>
> Good catch.
>
>>
>> This patch fills in the host branch to cover case (b) by requesting an
>> async resume of the xHCI child so xhci_resume() can restore the port
>> state machine and re-arm root hub polling. Async is required to avoid
>> deadlocking on the parent's own rpm_resume() re-entry.
>>
>> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
>> ---
>> base-commit: d58772d8520c7ef247c4b95c9bd76d3a25da9ff5
>> drivers/usb/dwc3/core.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index ceb49f2f8004..bce56765ad90 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -2668,6 +2668,18 @@ int dwc3_runtime_resume(struct dwc3 *dwc)
>> }
>> break;
>> case DWC3_GCTL_PRTCAP_HOST:
>> + /*
>> + * Only the xHCI child's resume re-arms root hub polling, which
>> + * is what rediscovers a device plugged in while suspended.
>> + * Runtime PM never resumes children on its own, so request it
>> + * here. This has to be asynchronous: resuming the child
>> + * synchronously would deadlock because rpm_resume() tries to
>> + * resume the parent before the child, and here the parent's
>> + * own callback has not returned yet.
>> + */
>
> This note sounds as if this is needed to all cases, but you're only
> describing only case b) here. Can you also mention for case a) that
> there maybe an extra resume work call.
Will do.
>
> Would be nice for it to be cleaner without the extra call, but I think
> it should be fine.
I guess we could do this: after this merged, we patch those platform
drivers(case a) to drop their existing workaround hack, dwc3 will
take over it's child xhci in this wakeup resume path, they just wake
dwc3. That makes things consistent. What do you think?
>
>> + if (dwc->xhci)
>> + pm_request_resume(&dwc->xhci->dev);
>> + break;
>> default:
>> /* do nothing */
>> break;
>> --
>> 2.25.1
>>
>
> Thanks for the patch, can you resubmit with the proper assisted-by tag
> and remove the RFC?
Will do, thanks.
>
> After the change:
>
> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
>
> Thanks,
> Thinh
Best regards.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] usb: dwc3: core: resume xHCI child on runtime resume in host mode
2026-08-27 9:52 ` Junzhong Pan
@ 2026-08-27 23:42 ` Thinh Nguyen
0 siblings, 0 replies; 6+ messages in thread
From: Thinh Nguyen @ 2026-08-27 23:42 UTC (permalink / raw)
To: Junzhong Pan
Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb, linux-kernel,
troy.mitchell, peixin.xie
On Thu, Aug 27, 2026, Junzhong Pan wrote:
>
> On 8/27/2026 10:11 AM, Thinh Nguyen wrote:
> > Hi,
> >
> > On Tue, Aug 11, 2026, Junzhong Pan wrote:
> >> USB controller runtime suspend halts the controller on disconnection.
> >> It relies on platforms with custom connection notification to start
> >> the controller again.
> >>
> >> The host branch of dwc3_runtime_resume() does nothing currently. There
> >> are two paths that can trigger a runtime resume of the dwc3 core in
> >> host mode:
> >>
> >> (a) Wake lands on the xHCI child (DT platforms, e.g. Qualcomm, i.MX8MP)
> >> A platform wakeup IRQ fires and the glue handler calls
> >> pm_runtime_resume(&xhci->dev). Runtime PM walks upward, resumes
> >> the dwc3 parent first, then resumes xHCI. Both wake correctly.
> >>
> >> (b) Wake lands on the dwc3 parent (ACPI platforms)
> >> When an ACPI Notify(ACPI_NOTIFY_DEVICE_WAKE) targets the dwc3
> >> parent device -- for example via a Generic Event Device on a
> >> hardware-reduced platform where dwc3 is enumerated as an ACPI
> >> device without a glue driver -- the ACPI core turns this into
> >> pm_request_resume(dwc3_dev). Runtime PM does not propagate resume
> >> downward, so the xHCI child stays suspended. Root hub polling is
> >> never re-armed, and a device plugged in while suspended is silently
> >> dropped.
> >
> > Good catch.
> >
> >>
> >> This patch fills in the host branch to cover case (b) by requesting an
> >> async resume of the xHCI child so xhci_resume() can restore the port
> >> state machine and re-arm root hub polling. Async is required to avoid
> >> deadlocking on the parent's own rpm_resume() re-entry.
> >>
> >> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
> >> ---
> >> base-commit: d58772d8520c7ef247c4b95c9bd76d3a25da9ff5
> >> drivers/usb/dwc3/core.c | 12 ++++++++++++
> >> 1 file changed, 12 insertions(+)
> >>
> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> >> index ceb49f2f8004..bce56765ad90 100644
> >> --- a/drivers/usb/dwc3/core.c
> >> +++ b/drivers/usb/dwc3/core.c
> >> @@ -2668,6 +2668,18 @@ int dwc3_runtime_resume(struct dwc3 *dwc)
> >> }
> >> break;
> >> case DWC3_GCTL_PRTCAP_HOST:
> >> + /*
> >> + * Only the xHCI child's resume re-arms root hub polling, which
> >> + * is what rediscovers a device plugged in while suspended.
> >> + * Runtime PM never resumes children on its own, so request it
> >> + * here. This has to be asynchronous: resuming the child
> >> + * synchronously would deadlock because rpm_resume() tries to
> >> + * resume the parent before the child, and here the parent's
> >> + * own callback has not returned yet.
> >> + */
> >
> > This note sounds as if this is needed to all cases, but you're only
> > describing only case b) here. Can you also mention for case a) that
> > there maybe an extra resume work call.
>
> Will do.
>
> >
> > Would be nice for it to be cleaner without the extra call, but I think
> > it should be fine.
>
> I guess we could do this: after this merged, we patch those platform
> drivers(case a) to drop their existing workaround hack, dwc3 will
> take over it's child xhci in this wakeup resume path, they just wake
> dwc3. That makes things consistent. What do you think?
>
That would need to be validated on a case-by-case basis. Also, regarding
testing, I assume this change has been tested on real hardware. If so,
which platform(s) were tested?
BR,
Thinh
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-27 23:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-11 9:08 [RFC PATCH] usb: dwc3: core: resume xHCI child on runtime resume in host mode Junzhong Pan
2026-08-12 0:16 ` Greg Kroah-Hartman
2026-08-12 1:51 ` Junzhong Pan
2026-08-27 2:11 ` Thinh Nguyen
2026-08-27 9:52 ` Junzhong Pan
2026-08-27 23:42 ` Thinh Nguyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®