xhci fixes for usb-linus
Subsystems (3)
cover xhci fixes for usb-linus
Hi Greg
A few xhci fixes for usb-linus, fixing DbC issues and some vendor specific quirks.
The "usb: xhci: quirk for data loss in ISOC transfers" Doesn't have a Fixes tag, but based on commit message it should go as far back as it can.
I'm planning on taking vacation next 3 weeks, but will take time to sort out issues with patches I currently have pending on the list.
Thanks
Mathias
Hongyu Xie (1):
xhci: Disable stream for xHC controller with XHCI_BROKEN_STREAMS
Mathias Nyman (1):
xhci: dbc: Flush queued requests before stopping dbc
Raju Rangoju (1):
usb: xhci: quirk for data loss in ISOC transfers
Łukasz Bartosik (1):
xhci: dbctty: disable ECHO flag by default
drivers/usb/host/xhci-dbgcap.c | 4 ++++ drivers/usb/host/xhci-dbgtty.c | 1 + drivers/usb/host/xhci-mem.c | 4 ++++ drivers/usb/host/xhci-pci.c | 25 +++++++++++++++++++++++++ drivers/usb/host/xhci-plat.c | 3 ++- drivers/usb/host/xhci.h | 1 + 6 files changed, 37 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0
PATCH 1/4 usb: xhci: quirk for data loss in ISOC transfers
From: Raju Rangoju <[email protected]>
During the High-Speed Isochronous Audio transfers, xHCI controller on certain AMD platforms experiences momentary data loss. This results in Missed Service Errors (MSE) being generated by the xHCI.
The root cause of the MSE is attributed to the ISOC OUT endpoint being omitted from scheduling. This can happen when an IN endpoint with a 64ms service interval either is pre-scheduled prior to the ISOC OUT endpoint or the interval of the ISOC OUT endpoint is shorter than that of the IN endpoint. Consequently, the OUT service is neglected when an IN endpoint with a service interval exceeding 32ms is scheduled concurrently (every 64ms in this scenario).
This issue is particularly seen on certain older AMD platforms. To mitigate this problem, it is recommended to adjust the service interval of the IN endpoint to not exceed 32ms (interval 8). This adjustment ensures that the OUT endpoint will not be bypassed, even if a smaller interval value is utilized.
--- drivers/usb/host/xhci-mem.c | 4 ++++ drivers/usb/host/xhci-pci.c | 25 +++++++++++++++++++++++++ drivers/usb/host/xhci.h | 1 + 3 files changed, 30 insertions(+)
drivers/usb/host/xhci-mem.c +4 -0
@@ -1449,6 +1449,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,/* Periodic endpoint bInterval limit quirk */ if (usb_endpoint_xfer_int (&ep->desc) ||usb_endpoint_xfer_isoc (&ep->desc)) { +if ((xhci->quirks &XHCI_LIMIT_ENDPOINT_INTERVAL_9 ) && + interval >=9 ) { + interval =8 ; + }if ((xhci->quirks &XHCI_LIMIT_ENDPOINT_INTERVAL_7 ) && udev->speed >=USB_SPEED_HIGH && interval >=7 ) {
drivers/usb/host/xhci-pci.c +25 -0
@@ -71,12 +71,22 @@#define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_XHCI 0x15ec#define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI 0x15f0 +#define PCI_DEVICE_ID_AMD_ARIEL_TYPEC_XHCI 0x13ed +#define PCI_DEVICE_ID_AMD_ARIEL_TYPEA_XHCI 0x13ee +#define PCI_DEVICE_ID_AMD_STARSHIP_XHCI 0x148c +#define PCI_DEVICE_ID_AMD_FIREFLIGHT_15D4_XHCI 0x15d4 +#define PCI_DEVICE_ID_AMD_FIREFLIGHT_15D5_XHCI 0x15d5 +#define PCI_DEVICE_ID_AMD_RAVEN_15E0_XHCI 0x15e0 +#define PCI_DEVICE_ID_AMD_RAVEN_15E1_XHCI 0x15e1 +#define PCI_DEVICE_ID_AMD_RAVEN2_XHCI 0x15e5#define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639#define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9#define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc +#define PCI_DEVICE_ID_ATI_NAVI10_7316_XHCI 0x7316 +#define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142#define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242
@@ -280,6 +290,21 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)if (pdev->vendor ==PCI_VENDOR_ID_NEC ) xhci->quirks |=XHCI_NEC_HOST ; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && + (pdev->device ==PCI_DEVICE_ID_AMD_ARIEL_TYPEC_XHCI || + pdev->device ==PCI_DEVICE_ID_AMD_ARIEL_TYPEA_XHCI || + pdev->device ==PCI_DEVICE_ID_AMD_STARSHIP_XHCI || + pdev->device ==PCI_DEVICE_ID_AMD_FIREFLIGHT_15D4_XHCI || + pdev->device ==PCI_DEVICE_ID_AMD_FIREFLIGHT_15D5_XHCI || + pdev->device ==PCI_DEVICE_ID_AMD_RAVEN_15E0_XHCI || + pdev->device ==PCI_DEVICE_ID_AMD_RAVEN_15E1_XHCI || + pdev->device ==PCI_DEVICE_ID_AMD_RAVEN2_XHCI )) + xhci->quirks |=XHCI_LIMIT_ENDPOINT_INTERVAL_9 ; + +if (pdev->vendor ==PCI_VENDOR_ID_ATI && + pdev->device ==PCI_DEVICE_ID_ATI_NAVI10_7316_XHCI ) + xhci->quirks |=XHCI_LIMIT_ENDPOINT_INTERVAL_9 ; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && xhci->hci_version ==0x96 ) xhci->quirks |= XHCI_AMD_0x96_HOST;
drivers/usb/host/xhci.h +1 -0
@@ -1643,6 +1643,7 @@ struct xhci_hcd {#define XHCI_WRITE_64_HI_LO BIT_ULL(47)#define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48)#define XHCI_ETRON_HOST BIT_ULL(49) +#define XHCI_LIMIT_ENDPOINT_INTERVAL_9 BIT_ULL(50)unsigned int num_active_eps;unsigned int limit_active_eps;
Signature · 1 line
2.43.0
PATCH 2/4 xhci: Disable stream for xHC controller with XHCI_BROKEN_STREAMS
In reply to Mathias NymanFrom: Hongyu Xie <[email protected]>
Disable stream for platform xHC controller with broken stream.
--- drivers/usb/host/xhci-plat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +2 -1
@@ -328,7 +328,8 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s } usb3_hcd =xhci_get_usb3_hcd (xhci); -if (usb3_hcd &&HCC_MAX_PSA (xhci->hcc_params) >=4 ) +if (usb3_hcd &&HCC_MAX_PSA (xhci->hcc_params) >=4 && + !(xhci->quirks &XHCI_BROKEN_STREAMS )) usb3_hcd->can_do_streams =1 ;if (xhci->shared_hcd) {
Signature · 1 line
2.43.0
PATCH 3/4 xhci: dbctty: disable ECHO flag by default
In reply to Mathias NymanFrom: Łukasz Bartosik <[email protected]>
When /dev/ttyDBC0 device is created then by default ECHO flag is set for the terminal device. However if data arrives from a peer before application using /dev/ttyDBC0 applies its set of terminal flags then the arriving data will be echoed which might not be desired behavior.
--- drivers/usb/host/xhci-dbgtty.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/xhci-dbgtty.c +1 -0
@@ -617,6 +617,7 @@ int dbc_tty_init(void) dbc_tty_driver->type =TTY_DRIVER_TYPE_SERIAL ; dbc_tty_driver->subtype =SERIAL_TYPE_NORMAL ; dbc_tty_driver->init_termios = tty_std_termios; + dbc_tty_driver->init_termios.c_lflag &= ~ECHO ; dbc_tty_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; dbc_tty_driver->init_termios.c_ispeed =9600 ;
Signature · 1 line
2.43.0
PATCH 4/4 xhci: dbc: Flush queued requests before stopping dbc
In reply to Mathias NymanFlush dbc requests when dbc is stopped and transfer rings are freed. Failure to flush them lead to leaking memory and dbc completing odd requests after resuming from suspend, leading to error messages such as:
[ 95.344392] xhci_hcd 0000:00:0d.0: no matched request
--- drivers/usb/host/xhci-dbgcap.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/host/xhci-dbgcap.c +4 -0
@@ -652,6 +652,10 @@ static void xhci_dbc_stop(struct xhci_dbc *dbc)case DS_DISABLED :return ;case DS_CONFIGURED : +spin_lock (&dbc->lock); +xhci_dbc_flush_requests (dbc); +spin_unlock (&dbc->lock); +if (dbc->driver->disconnect) dbc->driver->disconnect (dbc);break ;
Signature · 1 line
2.43.0