Thread (10 messages) 10 messages, 3 authors, 2021-12-29

Re: [PATCH] xhci: re-initialize the HC during resume if HCE was set

From: Puma Hsu <hidden>
Date: 2021-12-29 05:53:43
Also in: lkml

This commit is not used to fix a specific commit. We find a condition
that when XHCI runs the resume process but the HCE flag is set, then
the Run/Stop bit of USBCMD cannot be set so that HC would not be
enabled. In fact, HC may already meet a problem at this moment.
Besides, in xHCI requirements specification revision 1.2, Table 5-21
BIT(12) claims that Software should re-initialize the xHC when HCE is
set. Therefore, I think this commit could be the error handling for
HCE.

Thanks in advance.


Thanks in advance.




  •  Puma Hsu 許誌宏
  •  Software Engineer, Pixel Phone
  •  Tel: +886 2 8729 0870
  •  pumahsu@google.com





On Tue, Dec 28, 2021 at 4:26 PM Greg KH [off-list ref] wrote:
On Tue, Dec 28, 2021 at 02:02:46PM +0800, Puma Hsu wrote:
quoted
When HCE(Host Controller Error) is set, it means an internal
error condition has been detected. It needs to re-initialize
the HC too.

Signed-off-by: Puma Hsu <redacted>
---
 drivers/usb/host/xhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index dc357cabb265..c546d9533410 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1146,8 +1146,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
              temp = readl(&xhci->op_regs->status);
      }

-     /* If restore operation fails, re-initialize the HC during resume */
-     if ((temp & STS_SRE) || hibernated) {
+     /* If restore operation fails or HC error is detected, re-initialize the HC during resume */
+     if ((temp & STS_SRE) || (temp & STS_HCE) || hibernated) {

              if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
                              !(xhci_all_ports_seen_u0(xhci))) {
--
2.34.1.448.ga2b2bfdf31-goog
What commit does this fix?  Does it need to be backported to older
kernels as well?

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help