Patch "usb: host: xhci: Avoid XHCI resume delay if SSUSB device is not present" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    usb: host: xhci: Avoid XHCI resume delay if SSUSB device is not present

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-host-xhci-avoid-xhci-resume-delay-if-ssusb-devic.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 27ae33818f227fdc53a57d0db24aa0e5602e4cc0
Author: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>
Date:   Thu Oct 19 13:29:24 2023 +0300

    usb: host: xhci: Avoid XHCI resume delay if SSUSB device is not present
    
    [ Upstream commit 6add6dd345cb754ce18ff992c7264cabf31e59f6 ]
    
    There is a 120ms delay implemented for allowing the XHCI host controller to
    detect a U3 wakeup pulse.  The intention is to wait for the device to retry
    the wakeup event if the USB3 PORTSC doesn't reflect the RESUME link status
    by the time it is checked.  As per the USB3 specification:
    
      tU3WakeupRetryDelay ("Table 7-12. LTSSM State Transition Timeouts")
    
    This would allow the XHCI resume sequence to determine if the root hub
    needs to be also resumed.  However, in case there is no device connected,
    or if there is only a HSUSB device connected, this delay would still affect
    the overall resume timing.
    
    Since this delay is solely for detecting U3 wake events (USB3 specific)
    then ignore this delay for the disconnected case and the HSUSB connected
    only case.
    
    [skip helper function, rename usb3_connected variable -Mathias ]
    
    Signed-off-by: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>
    Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231019102924.2797346-20-mathias.nyman@xxxxxxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index fae994f679d45..82aab2f9adbb8 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -968,6 +968,7 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
 	int			retval = 0;
 	bool			comp_timer_running = false;
 	bool			pending_portevent = false;
+	bool			suspended_usb3_devs = false;
 	bool			reinit_xhc = false;
 
 	if (!hcd->state)
@@ -1115,10 +1116,17 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
 		/*
 		 * Resume roothubs only if there are pending events.
 		 * USB 3 devices resend U3 LFPS wake after a 100ms delay if
-		 * the first wake signalling failed, give it that chance.
+		 * the first wake signalling failed, give it that chance if
+		 * there are suspended USB 3 devices.
 		 */
+		if (xhci->usb3_rhub.bus_state.suspended_ports ||
+		    xhci->usb3_rhub.bus_state.bus_suspended)
+			suspended_usb3_devs = true;
+
 		pending_portevent = xhci_pending_portevent(xhci);
-		if (!pending_portevent && msg.event == PM_EVENT_AUTO_RESUME) {
+
+		if (suspended_usb3_devs && !pending_portevent &&
+		    msg.event == PM_EVENT_AUTO_RESUME) {
 			msleep(120);
 			pending_portevent = xhci_pending_portevent(xhci);
 		}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux