Skip to content

Commit 1fd6e5c

Browse files
matnymansmb49
authored andcommitted
xhci: always resume roothubs if xHC was reset during resume
BugLink: https://bugs.launchpad.net/bugs/2078289 commit 79989bd upstream. Usb device connect may not be detected after runtime resume if xHC is reset during resume. In runtime resume cases xhci_resume() will only resume roothubs if there are pending port events. If the xHC host is reset during runtime resume due to a Save/Restore Error (SRE) then these pending port events won't be detected as PORTSC change bits are not immediately set by host after reset. Unconditionally resume roothubs if xHC is reset during resume to ensure device connections are detected. Also return early with error code if starting xHC fails after reset. Issue was debugged and a similar solution suggested by Remi Pommarel. Using this instead as it simplifies future refactoring. Reported-by: Remi Pommarel <repk@triplefau.lt> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218987 Suggested-by: Remi Pommarel <repk@triplefau.lt> Tested-by: Remi Pommarel <repk@triplefau.lt> Cc: stable@vger.kernel.org Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20240627145523.1453155-2-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Portia Stephens <portia.stephens@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 67bc008 commit 1fd6e5c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

drivers/usb/host/xhci.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,10 +1126,20 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
11261126
xhci_dbg(xhci, "Start the secondary HCD\n");
11271127
retval = xhci_run(xhci->shared_hcd);
11281128
}
1129-
1129+
if (retval)
1130+
return retval;
1131+
/*
1132+
* Resume roothubs unconditionally as PORTSC change bits are not
1133+
* immediately visible after xHC reset
1134+
*/
11301135
hcd->state = HC_STATE_SUSPENDED;
1131-
if (xhci->shared_hcd)
1136+
1137+
if (xhci->shared_hcd) {
11321138
xhci->shared_hcd->state = HC_STATE_SUSPENDED;
1139+
usb_hcd_resume_root_hub(xhci->shared_hcd);
1140+
}
1141+
usb_hcd_resume_root_hub(hcd);
1142+
11331143
goto done;
11341144
}
11351145

@@ -1153,7 +1163,6 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
11531163

11541164
xhci_dbc_resume(xhci);
11551165

1156-
done:
11571166
if (retval == 0) {
11581167
/*
11591168
* Resume roothubs only if there are pending events.
@@ -1179,6 +1188,7 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
11791188
usb_hcd_resume_root_hub(hcd);
11801189
}
11811190
}
1191+
done:
11821192
/*
11831193
* If system is subject to the Quirk, Compliance Mode Timer needs to
11841194
* be re-initialized Always after a system resume. Ports are subject

0 commit comments

Comments
 (0)