From: "Neronin, Niklas" <niklas.neronin@linux.intel.com>
To: raoxu <raoxu@uniontech.com>
Cc: Thinh.Nguyen@synopsys.com, linux-usb@vger.kernel.org,
mathias.nyman@linux.intel.com
Subject: Re: [RFC PATCH 09/12] usb: xhci: optimize resuming from S4 (suspend-to-RAM)
Date: Fri, 6 Mar 2026 12:16:51 +0200 [thread overview]
Message-ID: <3fe5589c-2f0e-430f-8206-4d67f5a1a650@linux.intel.com> (raw)
In-Reply-To: <1E638E645F8271BF+20260306065246.2393516-1-raoxu@uniontech.com>
On 06/03/2026 8.52, raoxu wrote:
> On 2026-03-05 14:48 Niklas Neronin wrote:
>
>> - if (power_lost) {
>> + if (reset_registers) {
>> if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
>> !(xhci_all_ports_seen_u0(xhci))) {
>> timer_delete_sync(&xhci->comp_mode_recovery_timer);
>> @@ -1165,28 +1168,27 @@ int xhci_resume(struct xhci_hcd *xhci, bool power_lost, bool is_auto_resume)
>> if (retval)
>> return retval;
>>
>> - xhci_dbg(xhci, "// Disabling event ring interrupts\n");
>> - writel(STS_EINT, &xhci->op_regs->status);
>> - xhci_disable_interrupter(xhci, xhci->interrupters[0]);
>> + /* Clear data which is re-initilized during runtime */
>> + xhci_for_each_ring_seg(xhci->interrupters[0]->event_ring->first_seg, seg)
>> + memset(seg->trbs, 0, sizeof(union xhci_trb) * TRBS_PER_SEGMENT);
>
> If the driver is moving toward multiple operational
> interrupters, the current reset logic seems to only
> reset interrupter 0 explicitly. Should the secondary
> operational interrupters be reset here as well? If so,
> that would likely require additional
> xhci_for_each_ring_seg() handling and may make the
> resume/reset path more complex.
Yes, I tried to keep my patches as strictly preparatory work for secondary
interrupters. Since this patch set does not actually add support for
secondary interrupters, I also did not introduce any interrupter‑loop logic.
That said, once secondary interrupters are added, something along these lines
will be required:
for (int i = 0; i < xhci->max_interrupters; i++) {
if (!xhci->interrupters[i])
continue;
xhci_for_each_ring_seg(xhci->interrupters[i]->event_ring->first_seg, seg)
memset(seg->trbs, 0, sizeof(union xhci_trb) * TRBS_PER_SEGMENT);
}
>
>> +
>> + for (int i = xhci->max_ports; i > 0; i--)
>> + xhci_free_virt_devices_depth_first(xhci, i);
>> +
>> + xhci->cmd_ring_reserved_trbs = 0;
>> + xhci_for_each_ring_seg(xhci->cmd_ring->first_seg, seg)
>> + memset(seg->trbs, 0, sizeof(union xhci_trb) * TRBS_PER_SEGMENT);
>>
>> - xhci_dbg(xhci, "cleaning up memory\n");
>> - xhci_mem_cleanup(xhci);
>> xhci_debugfs_exit(xhci);
>> - xhci_dbg(xhci, "xhci_stop completed - status = %x\n",
>> - readl(&xhci->op_regs->status));
>>
>
> xhci_mem_cleanup() also clears software-side runtime
> state, not just rings. Without equivalent cleanup,
> state such as the command queue, cmd_timer, cmd_list,
> and TT-related list state may remain across
> reset-resume, which could lead to unexpected issues on
> some hardware.
Good point, I'll clear them all in v2.
Best Regards,
Niklas
>
> Thanks,
>
> Xu Rao
next prev parent reply other threads:[~2026-03-06 10:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 14:48 [RFC PATCH 00/12] usb: xhci: groundwork for secondary interrupters Niklas Neronin
2026-03-05 14:48 ` [RFC PATCH 01/12] usb: xhci: simplify CMRT initialization logic Niklas Neronin
2026-03-05 14:48 ` [RFC PATCH 02/12] usb: xhci: relocate Restore/Controller error check Niklas Neronin
2026-03-05 14:48 ` [RFC PATCH 03/12] usb: xhci: simplify USBSTS register reset Niklas Neronin
2026-03-05 19:26 ` Michal Pecio
2026-03-05 14:48 ` [RFC PATCH 04/12] usb: xhci: move reserving command ring trb Niklas Neronin
2026-03-05 14:48 ` [RFC PATCH 05/12] usb: xhci: move ring initialization Niklas Neronin
2026-03-05 14:48 ` [RFC PATCH 06/12] usb: xhci: move initialization for lifetime objects Niklas Neronin
2026-03-05 22:14 ` Michal Pecio
2026-03-06 9:47 ` Neronin, Niklas
2026-03-05 14:48 ` [RFC PATCH 07/12] usb: xhci: split core allocation and initialization Niklas Neronin
2026-03-05 22:23 ` Michal Pecio
2026-03-05 14:48 ` [RFC PATCH 08/12] usb: xhci: improve debug messages during suspend Niklas Neronin
2026-03-05 14:48 ` [RFC PATCH 09/12] usb: xhci: optimize resuming from S4 (suspend-to-RAM) Niklas Neronin
2026-03-06 6:52 ` raoxu
2026-03-06 10:16 ` Neronin, Niklas [this message]
2026-03-06 7:05 ` Michal Pecio
2026-03-05 14:48 ` [RFC PATCH 10/12] usb: xhci: add interrupter type Niklas Neronin
2026-03-05 14:48 ` [RFC PATCH 11/12] usb: xhci: prepare for multiple interrupters Niklas Neronin
2026-03-05 14:48 ` [RFC PATCH 12/12] usb: xhci: prepare IRQ handler " Niklas Neronin
2026-03-06 6:53 ` raoxu
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=3fe5589c-2f0e-430f-8206-4d67f5a1a650@linux.intel.com \
--to=niklas.neronin@linux.intel.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=raoxu@uniontech.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