Message ID | 20231212112521.3774610-2-quic_prashk@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7654936vqy; Tue, 12 Dec 2023 03:26:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNKrahEQTfCvkrTEcWAvRuNxbKNsDgXhXVkgAhrF6iIgugNaSjAnSHtt/39hPEsIL2nJZU X-Received: by 2002:a05:6a00:1acc:b0:6ce:4a30:853 with SMTP id f12-20020a056a001acc00b006ce4a300853mr7184248pfv.29.1702380390620; Tue, 12 Dec 2023 03:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702380390; cv=none; d=google.com; s=arc-20160816; b=VU7t0xq/4o+3dABt6NKyyNaNb/mFBJBmwR+o19LQ8mnPOC59fzcoYxRMFW+9uH+ngG 8qe9u3xEugvHtGULywxDYgRAW05cPGouHmrg6gQ0RUeyb/wb3A2E+QIXF1AHhWNUMgr3 fwoQJ9G+DK8iPoKzxNZ7stTP08Dfncnq4fPuiwQC1k4uWJ/OBVNPwNewpTo75x0DhEYc kUXRuPBhrM21PPc7JXqzmSikf64gIEEI07LAmQn64G2NNR9rTejWOAhEBRmwOzjfSISW B//OyQYTyA4ALrhpjASNpHMPCr3DF9uN/iKaVMBUbvOYKz2ijFNC6/dQb/hl0ChhxtU4 CHKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Tk9BFd+I+EOifDPCLIH0OJzyrz4a1iub/Ug3yC9KN6s=; fh=yEbRHvXlwON3ITiUSimoebICmEEJZ+XX+9u+xfm7GcU=; b=I2kma0rcz3T9QKKhQSBs1MOjtpoIrvgJL9yWUd4CjauPbsKzQRqPQO0lmh6v3l5a1b J9TWswS0CYb6GmZ/ASmZbSpisXMJs0lElB6yAVLYgQGMyJlOjkgheCwdnYfNtynhe3SR 2Y5Hs1gqUNSYQK60zECsvEzEZju6lNDJSnDElM+NIFEM37dqfcM6PlAdIGI9raIL/Ut1 OlvwWgZGXiCdwexSqYZg7u5nktCuwmGtjjNvTmU38kstwqESTRYtjcWcdGLQZyU7jWDd qh4M7Kblu5nfFaNHHFq1gogqQRr1fdt6I4732aKQ8HdeQbqQvfX2tvOmzzBLLfqoYOFr +0nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZnUV8rOS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id s15-20020a63214f000000b005c66af62bacsi7634102pgm.174.2023.12.12.03.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 03:26:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZnUV8rOS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 5B7608021581; Tue, 12 Dec 2023 03:26:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346547AbjLLL0J (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 12 Dec 2023 06:26:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346389AbjLLLZh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Dec 2023 06:25:37 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C541ED2; Tue, 12 Dec 2023 03:25:42 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BC748BS031926; Tue, 12 Dec 2023 11:25:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=Tk9BFd+I+EOifDPCLIH0OJzyrz4a1iub/Ug3yC9KN6s=; b=Zn UV8rOSqjovd3qJzbmC+1jEYtYyT35JOToN9o4gxOsEsM2R9jEZkP7Ep6ZlDkXqR/ X9P4wdtHVwzoJQh/GwOxxLnFcb/v/Dts2kFryKM9WxwPNnM55G725JG3G0U3rOT+ VdLTPy30lHvAmR8n7DwK1iNfVwocgDFWVRpQ2xysvT6Xzu12TNbBB8l+io59ZtT1 lRayOI2l5sJFX9lmE3qapfoRoZjSoBQKG1yeYod5quR/jd/LxK3sfSxZgRQKQprZ opdNHBc3CQR/yewwWFR37es0LCnnokrd7LdlVouwtdvZFewrs6xIpuRHUCZOjdrX FomLl3xP/d5aF/4Gz5yQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uxgbb0vwr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Dec 2023 11:25:38 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BCBPbmM009987 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Dec 2023 11:25:37 GMT Received: from hu-prashk-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 12 Dec 2023 03:25:34 -0800 From: Prashanth K <quic_prashk@quicinc.com> To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>, Mathias Nyman <mathias.nyman@intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> CC: <linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>, Prashanth K <quic_prashk@quicinc.com>, <stable@vger.kernel.org> Subject: [PATCH v2 1/2] usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK Date: Tue, 12 Dec 2023 16:55:20 +0530 Message-ID: <20231212112521.3774610-2-quic_prashk@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231212112521.3774610-1-quic_prashk@quicinc.com> References: <20231212112521.3774610-1-quic_prashk@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: R0YQiPCZdxS7xT1dzQPEitH6XfAmaUT9 X-Proofpoint-ORIG-GUID: R0YQiPCZdxS7xT1dzQPEitH6XfAmaUT9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 clxscore=1015 spamscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312120091 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 03:26:25 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785075220449734940 X-GMAIL-MSGID: 1785075220449734940 |
Series |
Set XHCI_SG_TRB_CACHE_SIZE_QUIRK for DWC3 devices
|
|
Commit Message
Prashanth K
Dec. 12, 2023, 11:25 a.m. UTC
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>
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
---
drivers/usb/dwc3/host.c | 2 ++
1 file changed, 2 insertions(+)
Comments
On Tue, Dec 12, 2023 at 04:55:20PM +0530, 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> > Signed-off-by: Prashanth K <quic_prashk@quicinc.com> What commit id does this fix? > --- > drivers/usb/dwc3/host.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c > index 61f57fe5bb78..31a496233d87 100644 > --- a/drivers/usb/dwc3/host.c > +++ b/drivers/usb/dwc3/host.c > @@ -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"); And this is ok if the entry is not present? thanks, greg k-h
On 15-12-23 06:12 pm, Greg Kroah-Hartman wrote: > On Tue, Dec 12, 2023 at 04:55:20PM +0530, 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> >> Signed-off-by: Prashanth K <quic_prashk@quicinc.com> > > What commit id does this fix? > This doesn't fix any commit as such, but adds the support for XHCI_SG_TRB_CACHE_SIZE_QUIRK (which is present in XHCI layer) to DWC3 layer. I have CC'ed stable kernel for this to be back-ported to older kernels (#5.11). > >> --- >> drivers/usb/dwc3/host.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c >> index 61f57fe5bb78..31a496233d87 100644 >> --- a/drivers/usb/dwc3/host.c >> +++ b/drivers/usb/dwc3/host.c >> @@ -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"); > > And this is ok if the entry is not present? > We are intending to use this quirk for all the dwc3 based devices since the DWC3 XHC needs it. If the entry is not present then we will hit stall if certain conditions aren't met (have mentioned the condition in commit text). Thanks, Prashanth K
On Fri, Dec 22, 2023 at 11:29:01AM +0530, Prashanth K wrote: > On 15-12-23 06:12 pm, Greg Kroah-Hartman wrote: > > On Tue, Dec 12, 2023 at 04:55:20PM +0530, 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> > > > Signed-off-by: Prashanth K <quic_prashk@quicinc.com> > > > > What commit id does this fix? > > > This doesn't fix any commit as such, but adds the support for > XHCI_SG_TRB_CACHE_SIZE_QUIRK (which is present in XHCI layer) to DWC3 layer. So this is a new feature? How does this fit into the stable kernel rules? > I have CC'ed stable kernel for this to be back-ported to older kernels > (#5.11). Why that specific kernel version and newer? Why not list it as documented? > > > > > --- > > > drivers/usb/dwc3/host.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c > > > index 61f57fe5bb78..31a496233d87 100644 > > > --- a/drivers/usb/dwc3/host.c > > > +++ b/drivers/usb/dwc3/host.c > > > @@ -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"); > > > > And this is ok if the entry is not present? > > > We are intending to use this quirk for all the dwc3 based devices since the > DWC3 XHC needs it. So you do not have this quirk yet in the kernel tree? We can't take code without any in-tree users. > If the entry is not present then we will hit stall if > certain conditions aren't met (have mentioned the condition in commit text). When will the quirk be added? To what platforms? thanks, greg k-h
On 22-12-23 11:40 am, Greg Kroah-Hartman wrote: > On Fri, Dec 22, 2023 at 11:29:01AM +0530, Prashanth K wrote: >> On 15-12-23 06:12 pm, Greg Kroah-Hartman wrote: >>> On Tue, Dec 12, 2023 at 04:55:20PM +0530, 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> >>>> Signed-off-by: Prashanth K <quic_prashk@quicinc.com> >>> >>> What commit id does this fix? >>> >> This doesn't fix any commit as such, but adds the support for >> XHCI_SG_TRB_CACHE_SIZE_QUIRK (which is present in XHCI layer) to DWC3 layer. > > So this is a new feature? > > How does this fit into the stable kernel rules? This isn't a new feature. To give some background, upstream commit bac1ec551434 ("usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK") added a XHCI quirk which converts SG lists to CMA buffers/URBS if certain conditions aren't met. But they never enabled this xhci quirk since no issues were hit at that time. So, the support for the above mentioned quirk is added from 5.11 kernel onwards, but was never enabled anywhere. From commit bac1ec551434 : "We discovered this issue with devices on other platforms but have not yet come across any device that triggers this on Linux. But it could be a real problem now or in the future. All it takes is N number of small chained TRBs. And other instances of the Synopsys IP may have smaller values for the TRB_CACHE_SIZE which would exacerbate the problem." For more info: https://lore.kernel.org/all/20201208092912.1773650-3-mathias.nyman@linux.intel.com/ > >> I have CC'ed stable kernel for this to be back-ported to older kernels >> (#5.11). > > Why that specific kernel version and newer? Why not list it as > documented? I mentioned 5.11 because commit bac1ec551434 ("usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK") is present from 5.11. > >>> >>>> --- >>>> drivers/usb/dwc3/host.c | 2 ++ >>>> 1 file changed, 2 insertions(+) >>>> >>>> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c >>>> index 61f57fe5bb78..31a496233d87 100644 >>>> --- a/drivers/usb/dwc3/host.c >>>> +++ b/drivers/usb/dwc3/host.c >>>> @@ -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"); >>> >>> And this is ok if the entry is not present? >>> >> We are intending to use this quirk for all the dwc3 based devices since the >> DWC3 XHC needs it. > > So you do not have this quirk yet in the kernel tree? We can't take > code without any in-tree users. This is a 2 patch series, patch 1/2 sets a property from dwc3 layer. And patch 2 enables XHCI quirk based on the property set from DWC3. > >> If the entry is not present then we will hit stall if >> certain conditions aren't met (have mentioned the condition in commit text). > > When will the quirk be added? To what platforms? I guess there is some sort of confusion here, sorry for that. Earlier Tejas Joglekar from synopsys pushed a patch in XHCI layer which converts certain SG lists to CMA buffers if some pre-requisites aren't met. And this operation is done if an xhci->quirk is set (XHCI_SG_TRB_CACHE_SIZE_QUIRK - BIT39) - https://lore.kernel.org/all/20201208092912.1773650-2-mathias.nyman@linux.intel.com/ - https://lore.kernel.org/all/20201208092912.1773650-3-mathias.nyman@linux.intel.com/ But here the option to enable this quirk was done using XHCI priv data diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index aa2d35f98200..4d34f6005381 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -333,6 +333,9 @@ static int xhci_plat_probe(struct platform_device *pdev) if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT)) hcd->skip_phy_initialization = 1; + if (priv && (priv->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK)) + xhci->quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK; + ret = usb_add_hcd(hcd, irq, IRQF_SHARED); if (ret) goto disable_usb_phy; And this XHCI quirk (XHCI_SG_TRB_CACHE_SIZE_QUIRK) needs to be enabled for DWC3 controllers. There are 2 ways to do it. One way is by directly accessing XHCI private data from DWC3 layer (dwc3/host.c) which is not cleaner approach. So I'm reusing the device_create_managed_software_node() which is present in dwc3/host.c to add a quirk to XHCI node, and enable XHCI_SG_TRB_CACHE_SIZE_QUIRK based on property set from DWC3 layer. Thanks, Prashanth K
On 26.12.2023 7.24, Prashanth K wrote: > > > On 22-12-23 11:40 am, Greg Kroah-Hartman wrote: >> On Fri, Dec 22, 2023 at 11:29:01AM +0530, Prashanth K wrote: >>> On 15-12-23 06:12 pm, Greg Kroah-Hartman wrote: >>>> On Tue, Dec 12, 2023 at 04:55:20PM +0530, 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> >>>>> Signed-off-by: Prashanth K <quic_prashk@quicinc.com> >>>> >>>> What commit id does this fix? >>>> >>> This doesn't fix any commit as such, but adds the support for >>> XHCI_SG_TRB_CACHE_SIZE_QUIRK (which is present in XHCI layer) to DWC3 layer. >> >> So this is a new feature? >> >> How does this fit into the stable kernel rules? > > This isn't a new feature. To give some background, upstream commit bac1ec551434 ("usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK") > added a XHCI quirk which converts SG lists to CMA buffers/URBS if certain conditions aren't met. But they never enabled this xhci quirk > since no issues were hit at that time. So, the support for the above mentioned quirk is added from 5.11 kernel onwards, but was never enabled anywhere. I remember this now. Original series had three patches, two adding the feature to xhci, and one for dwc3 enabling it. The xhci patches were fine and got in. https://marc.info/?l=linux-usb&m=160570849625065&w=2 The last dwc3 patch had issues and never apparently got in https://marc.info/?l=linux-usb&m=161008968009766&w=2 As this feature hasn't been enabled and code not widely run I think it would be better to skip stable for now. Stable can be added later once this has been successfully running in upstream for a while. Thanks Mathias
On 02-01-24 06:02 pm, Mathias Nyman wrote: > > I remember this now. > > Original series had three patches, two adding the feature to xhci, and > one for dwc3 enabling it. > The xhci patches were fine and got in. > > https://marc.info/?l=linux-usb&m=160570849625065&w=2 > > The last dwc3 patch had issues and never apparently got in > > https://marc.info/?l=linux-usb&m=161008968009766&w=2 > > As this feature hasn't been enabled and code not widely run I think it > would beĀ better > to skip stable for now. Stable can be added later once this has been > successfully running > in upstream for a while. > > Thanks > Mathias > Thanks Mathias, do you want me to send the patch again without the stable tag? Regards, Prashanth K
Hi, On 12/12/23 12:25, 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> > Signed-off-by: Prashanth K <quic_prashk@quicinc.com> > --- > drivers/usb/dwc3/host.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c > index 61f57fe5bb78..31a496233d87 100644 > --- a/drivers/usb/dwc3/host.c > +++ b/drivers/usb/dwc3/host.c > @@ -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 you do this you also need to make the props array 1 entry bigger (increase it from 4 to 5 entries). Before this patch there are max 3 properties added and there needs to be an empty terminating property at the end (which is what the memset is for). So before this patch props[] needs to have 4 entries (which it does) and thus after this patch props[] needs to have 5 entire.s Regards, Hans
On 11-01-24 03:46 pm, Hans de Goede wrote: >> --- >> drivers/usb/dwc3/host.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c >> index 61f57fe5bb78..31a496233d87 100644 >> --- a/drivers/usb/dwc3/host.c >> +++ b/drivers/usb/dwc3/host.c >> @@ -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 you do this you also need to make the props array 1 entry bigger (increase > it from 4 to 5 entries). Before this patch there are max 3 properties added > and there needs to be an empty terminating property at the end (which > is what the memset is for). So before this patch props[] needs to have > 4 entries (which it does) and thus after this patch props[] needs to > have 5 entire.s > > Regards, > > Hans > Thanks for pointing this out Hans! Didn't change it from 4->5 since we had only 4 properties, wasn't aware of the terminating property. Will update the patch. Thanks again Prashanth K
diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index 61f57fe5bb78..31a496233d87 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -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");