public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Set XHCI_SG_TRB_CACHE_SIZE_QUIRK for DWC3 devices
@ 2024-01-16  5:58 Prashanth K
  2024-01-16  5:58 ` [PATCH v3 1/2] usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK Prashanth K
  2024-01-16  5:58 ` [PATCH v3 2/2] usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK Prashanth K
  0 siblings, 2 replies; 6+ messages in thread
From: Prashanth K @ 2024-01-16  5:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen, Mathias Nyman
  Cc: Hans de Goede, linux-kernel, linux-usb, Prashanth K

XHCI_SG_TRB_CACHE_SIZE_QUIRK was introduced in XHCI to resolve
XHC timeout while using SG buffers, which was seen Synopsys XHCs.
The support for this isn't present in DWC3 layer, this series
enables XHCI_SG_TRB_CACHE_SIZE_QUIRK since this is needed for
DWC3 controller.

In Synopsys DWC3 databook,
Table 9-3: xHCI Debug Capability Limitations
Chained TRBs greater than TRB cache size: The debug capability
driver must not create a multi-TRB TD that describes smaller
than a 1K packet that spreads across 8 or more TRBs on either
the IN TR or the OUT TR.

More information about this XHCI quirk is mentioned on the
following thread.
https://lore.kernel.org/all/20201208092912.1773650-3-mathias.nyman@linux.intel.com/

Changes in v3:
Updated the props[] array size from 4 to 5 in dwc3/host.c

Changes in v2:
Changed implementation using device property instead of priv_data
Split the single patch into 2 patch series, v1 is mentioned below
https://lore.kernel.org/all/20231121135936.1669167-1-quic_prashk@quicinc.com/

Prashanth K (2):
  usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK
  usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK

 drivers/usb/dwc3/host.c      | 4 +++-
 drivers/usb/host/xhci-plat.c | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

-- 
2.25.1


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

* [PATCH v3 1/2] usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK
  2024-01-16  5:58 [PATCH v3 0/2] Set XHCI_SG_TRB_CACHE_SIZE_QUIRK for DWC3 devices Prashanth K
@ 2024-01-16  5:58 ` Prashanth K
  2024-01-17  0:38   ` Thinh Nguyen
  2024-01-16  5:58 ` [PATCH v3 2/2] usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK Prashanth K
  1 sibling, 1 reply; 6+ messages in thread
From: Prashanth K @ 2024-01-16  5:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen, Mathias Nyman
  Cc: Hans de Goede, linux-kernel, linux-usb, Prashanth K, stable

Upstream commit bac1ec551434 ("usb: xhci: Set quirk for
XHCI_SG_TRB_CACHE_SIZE_QUIRK") introduced a new quirk in XHCI
which fixes XHC timeout, which was seen on synopsys XHCs while
using SG buffers. But the support for this quirk isn't present
in the DWC3 layer.

We will encounter this XHCI timeout/hung issue if we run iperf
loopback tests using RTL8156 ethernet adaptor on DWC3 targets
with scatter-gather enabled. This gets resolved after enabling
the XHCI_SG_TRB_CACHE_SIZE_QUIRK. This patch enables it using
the xhci device property since its needed for DWC3 controller.

In Synopsys DWC3 databook,
Table 9-3: xHCI Debug Capability Limitations
Chained TRBs greater than TRB cache size: The debug capability
driver must not create a multi-TRB TD that describes smaller
than a 1K packet that spreads across 8 or more TRBs on either
the IN TR or the OUT TR.

Cc: <stable@vger.kernel.org> #5.11
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
---
 drivers/usb/dwc3/host.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index 61f57fe5bb78..43230915323c 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -61,7 +61,7 @@ static int dwc3_host_get_irq(struct dwc3 *dwc)
 
 int dwc3_host_init(struct dwc3 *dwc)
 {
-	struct property_entry	props[4];
+	struct property_entry	props[5];
 	struct platform_device	*xhci;
 	int			ret, irq;
 	int			prop_idx = 0;
@@ -89,6 +89,8 @@ int dwc3_host_init(struct dwc3 *dwc)
 
 	memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
 
+	props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-sg-trb-cache-size-quirk");
+
 	if (dwc->usb3_lpm_capable)
 		props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb3-lpm-capable");
 
-- 
2.25.1


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

* [PATCH v3 2/2] usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK
  2024-01-16  5:58 [PATCH v3 0/2] Set XHCI_SG_TRB_CACHE_SIZE_QUIRK for DWC3 devices Prashanth K
  2024-01-16  5:58 ` [PATCH v3 1/2] usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK Prashanth K
@ 2024-01-16  5:58 ` Prashanth K
  2024-01-16  7:53   ` Sergey Shtylyov
  1 sibling, 1 reply; 6+ messages in thread
From: Prashanth K @ 2024-01-16  5:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen, Mathias Nyman
  Cc: Hans de Goede, linux-kernel, linux-usb, Prashanth K, stable

Upstream commit bac1ec551434 ("usb: xhci: Set quirk for
XHCI_SG_TRB_CACHE_SIZE_QUIRK") introduced a new quirk in XHCI
which fixes XHC timeout, which was seen on synopsys XHCs while
using SG buffers. Currently this quirk can only be set using
xhci private data. But there are some drivers like dwc3/host.c
which adds adds quirks using software node for xhci device.
Hence set this xhci quirk by iterating over device properties.

Cc: <stable@vger.kernel.org> # 5.11
Fixes: bac1ec551434 ("usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK")
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
---
 drivers/usb/host/xhci-plat.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index f04fde19f551..3d071b875308 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -253,6 +253,9 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
 		if (device_property_read_bool(tmpdev, "quirk-broken-port-ped"))
 			xhci->quirks |= XHCI_BROKEN_PORT_PED;
 
+		if (device_property_read_bool(tmpdev, "xhci-sg-trb-cache-size-quirk"))
+			xhci->quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK;
+
 		device_property_read_u32(tmpdev, "imod-interval-ns",
 					 &xhci->imod_interval);
 	}
-- 
2.25.1


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

* Re: [PATCH v3 2/2] usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK
  2024-01-16  5:58 ` [PATCH v3 2/2] usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK Prashanth K
@ 2024-01-16  7:53   ` Sergey Shtylyov
  2024-01-16  8:02     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Sergey Shtylyov @ 2024-01-16  7:53 UTC (permalink / raw)
  To: Prashanth K, Greg Kroah-Hartman, Thinh Nguyen, Mathias Nyman
  Cc: Hans de Goede, linux-kernel, linux-usb, stable

On 1/16/24 8:58 AM, Prashanth K wrote:

> Upstream commit bac1ec551434 ("usb: xhci: Set quirk for
> XHCI_SG_TRB_CACHE_SIZE_QUIRK") introduced a new quirk in XHCI

   It's xHCI. :-)

> which fixes XHC timeout, which was seen on synopsys XHCs while

   xHC.

> using SG buffers. Currently this quirk can only be set using
> xhci private data. But there are some drivers like dwc3/host.c
> which adds adds quirks using software node for xhci device.

   Double "adds".

> Hence set this xhci quirk by iterating over device properties.
> 
> Cc: <stable@vger.kernel.org> # 5.11
> Fixes: bac1ec551434 ("usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK")
> Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
[...]

MBR, Sergey

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

* Re: [PATCH v3 2/2] usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK
  2024-01-16  7:53   ` Sergey Shtylyov
@ 2024-01-16  8:02     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-16  8:02 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: Prashanth K, Thinh Nguyen, Mathias Nyman, Hans de Goede,
	linux-kernel, linux-usb, stable

On Tue, Jan 16, 2024 at 10:53:11AM +0300, Sergey Shtylyov wrote:
> On 1/16/24 8:58 AM, Prashanth K wrote:
> 
> > Upstream commit bac1ec551434 ("usb: xhci: Set quirk for
> > XHCI_SG_TRB_CACHE_SIZE_QUIRK") introduced a new quirk in XHCI
> 
>    It's xHCI. :-)
> 
> > which fixes XHC timeout, which was seen on synopsys XHCs while
> 
>    xHC.
> 
> > using SG buffers. Currently this quirk can only be set using
> > xhci private data. But there are some drivers like dwc3/host.c
> > which adds adds quirks using software node for xhci device.
> 
>    Double "adds".

I know I have said this before, but please don't be so pedantic at
times, it's just not helpful at all.  All of these are just fine to
ignore.

thanks,

greg k-h

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

* Re: [PATCH v3 1/2] usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK
  2024-01-16  5:58 ` [PATCH v3 1/2] usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK Prashanth K
@ 2024-01-17  0:38   ` Thinh Nguyen
  0 siblings, 0 replies; 6+ messages in thread
From: Thinh Nguyen @ 2024-01-17  0:38 UTC (permalink / raw)
  To: Prashanth K
  Cc: Greg Kroah-Hartman, Thinh Nguyen, Mathias Nyman, Hans de Goede,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	stable@vger.kernel.org

On Tue, Jan 16, 2024, Prashanth K wrote:
> Upstream commit bac1ec551434 ("usb: xhci: Set quirk for
> XHCI_SG_TRB_CACHE_SIZE_QUIRK") introduced a new quirk in XHCI
> which fixes XHC timeout, which was seen on synopsys XHCs while
> using SG buffers. But the support for this quirk isn't present
> in the DWC3 layer.
> 
> We will encounter this XHCI timeout/hung issue if we run iperf
> loopback tests using RTL8156 ethernet adaptor on DWC3 targets
> with scatter-gather enabled. This gets resolved after enabling
> the XHCI_SG_TRB_CACHE_SIZE_QUIRK. This patch enables it using
> the xhci device property since its needed for DWC3 controller.
> 
> In Synopsys DWC3 databook,
> Table 9-3: xHCI Debug Capability Limitations
> Chained TRBs greater than TRB cache size: The debug capability
> driver must not create a multi-TRB TD that describes smaller
> than a 1K packet that spreads across 8 or more TRBs on either
> the IN TR or the OUT TR.
> 
> Cc: <stable@vger.kernel.org> #5.11
> Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
> ---
>  drivers/usb/dwc3/host.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index 61f57fe5bb78..43230915323c 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -61,7 +61,7 @@ static int dwc3_host_get_irq(struct dwc3 *dwc)
>  
>  int dwc3_host_init(struct dwc3 *dwc)
>  {
> -	struct property_entry	props[4];
> +	struct property_entry	props[5];
>  	struct platform_device	*xhci;
>  	int			ret, irq;
>  	int			prop_idx = 0;
> @@ -89,6 +89,8 @@ int dwc3_host_init(struct dwc3 *dwc)
>  
>  	memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
>  
> +	props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-sg-trb-cache-size-quirk");
> +
>  	if (dwc->usb3_lpm_capable)
>  		props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb3-lpm-capable");
>  
> -- 
> 2.25.1
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

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

end of thread, other threads:[~2024-01-17  0:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-16  5:58 [PATCH v3 0/2] Set XHCI_SG_TRB_CACHE_SIZE_QUIRK for DWC3 devices Prashanth K
2024-01-16  5:58 ` [PATCH v3 1/2] usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK Prashanth K
2024-01-17  0:38   ` Thinh Nguyen
2024-01-16  5:58 ` [PATCH v3 2/2] usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK Prashanth K
2024-01-16  7:53   ` Sergey Shtylyov
2024-01-16  8:02     ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox