Thread (1 message) 1 message, 1 author, 2021-11-18

Re: [PATCH 5.10 211/290] xhci: Fix repeated xhci wake after suspend due to uncleared internal wake state

From: Pavan Kondeti <hidden>
Date: 2021-11-18 10:06:17

+linux-usb

On Thu, Nov 18, 2021 at 03:21:54PM +0530, Rohith Kollalsi wrote:
quoted hunk
Hi Mathias,

This mail is regarding your upstream change in xhci file. There is a
potential issue with your change which can cause noc error due to unclocked
access.

Consider a case where a headset is connected to device and nothing is
playing. As nothing is playing, usb bus wouldn't be active which leads to
run time suspend ( i think this feature is not present upstream) as a part
of which xhci_suspend will be called. Now all the clocks are also switched
off. Now again when pm_suspend occurs due to disconnect, then again
xhci_suspend occurs, but now registers can be accessed with clocks off
leading to unclocked access. Can you please consider below change to prevent
unclocked access.

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c

index 2728027..aaf212d 100644

--- a/drivers/usb/host/xhci.c

+++ b/drivers/usb/host/xhci.c
@@ -1013,13 +1013,13 @@ int xhci_suspend(struct xhci_hcd *xhci, bool
do_wakeup)

xhci->shared_hcd->state != HC_STATE_SUSPENDED)

                return -EINVAL;

+       if (!HCD_HW_ACCESSIBLE(hcd)) ---> this will prevent unclocked access
when xhci_suspend occurs during second time during pm_suspend

+ return 0;

+

        /* Clear root port wake on bits if wakeup not allowed. */

        xhci_disable_hub_port_wake(xhci, &xhci->usb3_rhub, do_wakeup);

        xhci_disable_hub_port_wake(xhci, &xhci->usb2_rhub, do_wakeup);

-       if (!HCD_HW_ACCESSIBLE(hcd))

-               return 0;

-

        xhci_dbc_suspend(xhci);


Thanks,

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