Skip to contentSkip to conversation

usb: xhci: do not perform Soft Retry for some xHCI hosts

PATCH In review [email protected] 2 participants 2 messages Feb 10, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: xhci: do not perform Soft Retry for some xHCI hosts

From: Stanislaw Gruszka <[email protected]>

Since f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors") on some systems rt2800usb and mt7601u devices are unable to operate. Possible reason is that some xHCI hardware can not perform Soft Retry for those devices correctly.

To avoid the problem add xhci->quirks flag that restore pre f8f80be501aa xhci behaviour for affected xHCI controllers. Currently those are AMD_PROMONTORYA_4 and AMD_PROMONTORYA_2, since it was confirmed by the users: on those xHCI hosts issue happen and is gone after disabling Soft Retry.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202541

Fixes f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors")
Reported-and-tested-by Bernhard <[email protected]>

---
v1 -> v2:
compared to previous patch:
https://lore.kernel.org/linux-usb/[email protected]/t/#u
now we use xhci->quirks to disable Soft Retry (I also changed topic to reflect the change).

 drivers/usb/host/xhci-pci.c  | 5 +++++
 drivers/usb/host/xhci-ring.c | 3 ++-
 drivers/usb/host/xhci.h      | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +5 -0
index 84da8406d5b4..1f989a49c8c6 100644
@@ -295,6 +295,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	     pdev->device == 0x9026)
 		xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT;
 
+	if (pdev->vendor == PCI_VENDOR_ID_AMD &&
+	    (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2 ||
+	     pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4))
+		xhci->quirks |= XHCI_NO_SOFT_RETRY;
+
 	if (xhci->quirks & XHCI_RESET_ON_RESUME)
 		xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
 				"QUIRK: Resetting on resume");
drivers/usb/host/xhci-ring.c +2 -1
index 5677b81c0915..12d2ff2550b2 100644
@@ -2302,7 +2302,8 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
 		remaining	= 0;
 		break;
 	case COMP_USB_TRANSACTION_ERROR:
-		if ((ep_ring->err_count++ > MAX_SOFT_RETRY) ||
+		if (xhci->quirks & XHCI_NO_SOFT_RETRY ||
+		    (ep_ring->err_count++ > MAX_SOFT_RETRY) ||
 		    le32_to_cpu(slot_ctx->tt_info) & TT_SLOT)
 			break;
 		*status = 0;
drivers/usb/host/xhci.h +1 -0
index 25e57bc9c3cc..0ddfde2780c9 100644
@@ -1883,6 +1883,7 @@ struct xhci_hcd {
 #define XHCI_SKIP_PHY_INIT	BIT_ULL(37)
 #define XHCI_DISABLE_SPARSE	BIT_ULL(38)
 #define XHCI_SG_TRB_CACHE_SIZE_QUIRK	BIT_ULL(39)
+#define XHCI_NO_SOFT_RETRY	BIT_ULL(40)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
Signature · 1 line
2.25.4
#1 lore raw
Quoted 25 lines · On 10.2.2021 10.12, [email protected] wrote:

From: Stanislaw Gruszka <[email protected]>

Since f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors") on some systems rt2800usb and mt7601u devices are unable to operate. Possible reason is that some xHCI hardware can not perform Soft Retry for those devices correctly.

To avoid the problem add xhci->quirks flag that restore pre f8f80be501aa xhci behaviour for affected xHCI controllers. Currently those are AMD_PROMONTORYA_4 and AMD_PROMONTORYA_2, since it was confirmed by the users: on those xHCI hosts issue happen and is gone after disabling Soft Retry.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202541

Fixes f8f80be501aa ("xhci: Use soft retry to recover faster from transaction errors")
Reported-and-tested-by Bernhard <[email protected]>

---
v1 -> v2:
compared to previous patch:
https://lore.kernel.org/linux-usb/[email protected]/t/#u
now we use xhci->quirks to disable Soft Retry (I also changed topic to reflect the change).

Quoted 5 lines
 drivers/usb/host/xhci-pci.c  | 5 +++++
 drivers/usb/host/xhci-ring.c | 3 ++-
 drivers/usb/host/xhci.h      | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

Thanks.

Checkpatch complains about some minor things, I'll fix those while applying. Will send forward after 5.12-rc1 is out, and add stable tag.

-Mathias