From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: "mathias.nyman@intel.com" <mathias.nyman@intel.com>,
Roy Luo <royluo@google.com>
Cc: "quic_ugoswami@quicinc.com" <quic_ugoswami@quicinc.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"michal.pecio@gmail.com" <michal.pecio@gmail.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] usb: xhci: Skip xhci_reset in xhci_resume if xhci is being removed
Date: Fri, 23 May 2025 23:06:36 +0000 [thread overview]
Message-ID: <20250523230633.u46zpptaoob5jcdk@synopsys.com> (raw)
In-Reply-To: <20250522190912.457583-2-royluo@google.com>
Hi Mathias, Roy,
On Thu, May 22, 2025, Roy Luo wrote:
> xhci_reset() currently returns -ENODEV if XHCI_STATE_REMOVING is
> set, without completing the xhci handshake, unless the reset completes
> exceptionally quickly. This behavior causes a regression on Synopsys
> DWC3 USB controllers with dual-role capabilities.
>
> Specifically, when a DWC3 controller exits host mode and removes xhci
> while a reset is still in progress, and then attempts to configure its
> hardware for device mode, the ongoing, incomplete reset leads to
> critical register access issues. All register reads return zero, not
> just within the xHCI register space (which might be expected during a
> reset), but across the entire DWC3 IP block.
>
> This patch addresses the issue by preventing xhci_reset() from being
> called in xhci_resume() and bailing out early in the reinit flow when
> XHCI_STATE_REMOVING is set.
>
> Cc: stable@vger.kernel.org
> Fixes: 6ccb83d6c497 ("usb: xhci: Implement xhci_handshake_check_state() helper")
> Suggested-by: Mathias Nyman <mathias.nyman@intel.com>
> Signed-off-by: Roy Luo <royluo@google.com>
> ---
> drivers/usb/host/xhci.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 90eb491267b5..244b12eafd95 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -1084,7 +1084,10 @@ int xhci_resume(struct xhci_hcd *xhci, bool power_lost, bool is_auto_resume)
> xhci_dbg(xhci, "Stop HCD\n");
> xhci_halt(xhci);
> xhci_zero_64b_regs(xhci);
> - retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC);
> + if (xhci->xhc_state & XHCI_STATE_REMOVING)
> + retval = -ENODEV;
> + else
> + retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC);
How can this prevent the xhc_state from changing while in reset? There's
no locking in xhci-plat.
I would suggest to simply revert the commit 6ccb83d6c497 that causes
regression first. We can investigate and look into a solution to the
specific Qcom issue afterward.
Note that this commit may impact role-switching flow for all DRD dwc3
(and perhaps others), which may also impact other Qcom DRD platforms.
Thanks,
Thinh
> spin_unlock_irq(&xhci->lock);
> if (retval)
> return retval;
> --
> 2.49.0.1204.g71687c7c1d-goog
>
next prev parent reply other threads:[~2025-05-23 23:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 19:09 [PATCH v1 0/2] Revert commit 6ccb83d6c497 to fix DWC3 dual-role regression Roy Luo
2025-05-22 19:09 ` [PATCH v1 1/2] usb: xhci: Skip xhci_reset in xhci_resume if xhci is being removed Roy Luo
2025-05-23 23:06 ` Thinh Nguyen [this message]
2025-05-26 7:39 ` Mathias Nyman
2025-05-29 1:17 ` Thinh Nguyen
2025-06-04 14:17 ` Mathias Nyman
2025-06-05 0:18 ` Thinh Nguyen
2025-06-18 17:04 ` Roy Luo
2025-06-19 12:44 ` Mathias Nyman
2025-06-19 13:07 ` gregkh
2025-05-22 19:09 ` [PATCH v1 2/2] Revert "usb: xhci: Implement xhci_handshake_check_state() helper" Roy Luo
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=20250523230633.u46zpptaoob5jcdk@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=michal.pecio@gmail.com \
--cc=quic_ugoswami@quicinc.com \
--cc=royluo@google.com \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®