linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] usb: xhci: do not perform Soft Retry for some xHCI hosts
@ 2021-02-10  8:12 stf_xl
  2021-02-10 12:53 ` Mathias Nyman
  0 siblings, 1 reply; 2+ messages in thread
From: stf_xl @ 2021-02-10  8:12 UTC (permalink / raw)
  To: linux-usb; +Cc: Mathias Nyman, Bernhard, Michael, Greg KH

From: Stanislaw Gruszka <stf_xl@wp.pl>

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 <bernhard.gebetsberger@gmx.at>
Bisected-by: Bernhard <bernhard.gebetsberger@gmx.at>
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
---
v1 -> v2:
compared to previous patch:
https://lore.kernel.org/linux-usb/20210122104342.12451-1-stf_xl@wp.pl/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(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 84da8406d5b4..1f989a49c8c6 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -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");
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 5677b81c0915..12d2ff2550b2 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -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;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 25e57bc9c3cc..0ddfde2780c9 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -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;
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] usb: xhci: do not perform Soft Retry for some xHCI hosts
  2021-02-10  8:12 [PATCH v2] usb: xhci: do not perform Soft Retry for some xHCI hosts stf_xl
@ 2021-02-10 12:53 ` Mathias Nyman
  0 siblings, 0 replies; 2+ messages in thread
From: Mathias Nyman @ 2021-02-10 12:53 UTC (permalink / raw)
  To: stf_xl, linux-usb; +Cc: Mathias Nyman, Bernhard, Michael, Greg KH

On 10.2.2021 10.12, stf_xl@wp.pl wrote:
> From: Stanislaw Gruszka <stf_xl@wp.pl>
> 
> 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 <bernhard.gebetsberger@gmx.at>
> Bisected-by: Bernhard <bernhard.gebetsberger@gmx.at>
> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
> ---
> v1 -> v2:
> compared to previous patch:
> https://lore.kernel.org/linux-usb/20210122104342.12451-1-stf_xl@wp.pl/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(-)
> 


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-10 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10  8:12 [PATCH v2] usb: xhci: do not perform Soft Retry for some xHCI hosts stf_xl
2021-02-10 12:53 ` Mathias Nyman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).