Re: [RFT PATCH] xhci: track port suspend state correctly in unsuccessful resume cases

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

 



Hi Mathias,

On 9/14/2023 2:27 AM, Mathias Nyman wrote:
xhci-hub.c tracks suspended ports in a suspended_port bitfield.
This is checked when responding to a Get_Status(PORT) request to see if a
port in running U0 state was recently resumed, and adds the required
USB_PORT_STAT_C_SUSPEND change bit in those cases.

The suspended_port bit was left uncleared if a device is disconnected
during suspend. The bit remained set even when a new device was connected
and enumerated. The set bit resulted in a incorrect Get_Status(PORT)
response with a bogus USB_PORT_STAT_C_SUSPEND change
bit set once the new device reached U0 link state.

USB_PORT_STAT_C_SUSPEND change bit is only used for USB2 ports, but
xhci-hub keeps track of both USB2 and USB3 suspended ports.


Thanks for looking at this change. Tested it on my environment and it looks good to me:

//Disconnect while bus is suspended (before get status)
msm-dwc3 a600000.ssusb: DWC3 exited from low power mode
xhci_resume: usb3 suspended_ports = 0, bus_suspended = 0
xhci_resume: usb2 suspended_ports = 1, bus_suspended = 0
usb 1-1: USB disconnect, device number 2
msm-dwc3 a600000.ssusb: could not transition HS PHY to L2
msm-dwc3 a600000.ssusb: DWC3 in low power mode

//Plug in after disconnect
msm-dwc3 a600000.ssusb: DWC3 exited from low power mode
xhci_resume: usb3 suspended_ports = 0, bus_suspended = 0
xhci_resume: usb2 suspended_ports = 0, bus_suspended = 0
usb 1-1: new full-speed USB device number 3 using xhci-hcd
...
msm-dwc3 a600000.ssusb: could not transition HS PHY to L2
msm-dwc3 a600000.ssusb: DWC3 in low power mode

//Remote wakeup
msm-dwc3 a600000.ssusb: DWC3 exited from low power mode
xhci_resume: usb3 suspended_ports = 0, bus_suspended = 0
xhci_resume: usb2 suspended_ports = 1, bus_suspended = 0
plantronics 0003:047F:C025.0002: intr, xhci-hcd.2.auto-1/input3, status -2
msm-dwc3 a600000.ssusb: could not transition HS PHY to L2
msm-dwc3 a600000.ssusb: DWC3 in low power mode

Will update my change ([1]) to include testing for the suspended_ports for if a device is connected (and suspended) while running xhci_resume()

Thanks
Wesley Cheng

[1] https://lore.kernel.org/linux-usb/20230901001518.25403-1-quic_wcheng@xxxxxxxxxxx/




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux