From patchwork Tue Nov 21 13:59:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashanth K X-Patchwork-Id: 167773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp638952vqb; Tue, 21 Nov 2023 06:01:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHS8JWNqBEccwKWc2oSnc0BnnGen80gqUpsWXF3O4PPAm/978H+ttfEQf6hyzPDFwY/n/Fl X-Received: by 2002:a9d:65d9:0:b0:6c4:d08c:6a2 with SMTP id z25-20020a9d65d9000000b006c4d08c06a2mr12859097oth.9.1700575266123; Tue, 21 Nov 2023 06:01:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700575266; cv=none; d=google.com; s=arc-20160816; b=o+O98G/1CaBnDgp/MM30yvcHA7eIUm3IbVXK4Xy1cN+EO9mpxF2Z4M0Vnxw8P/iiZV TYghrkRiJ0LoljBeHWqK85/ffr/OdcdSzgqqAlsBc8QkAXo8IgKl8bVnQ92WiAGcl4gw 9OZ+G84kdfIFRb2uR14HkjdN2hpkA2UFe+Q8X0mtrxpEDzToXpYAm/E8Ibu26Pgo5T+n 5gaS6hwFNV+NZlVBJKwL/vi31FNP67yUON7cXMKT0KbAJ7ed733J+eKvwure+3FqfOZc Ik/+5bnNCsKSkHvIH10NdVBc1+Fk1xfB/h6CwTKf9PBQFAsa80ELyuk93gCpLAgqdKWw 84Aw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=wZWK4HHl5K/RbV8IOMstnMkJHrhsT6sum4v536nDEYU=; fh=L71sb5Z6qM0iPk3qdo8fpByzjgYjrge7uAn0FxGMNYE=; b=uGKhIHZ2xvbkxwINbIAosPwSfp5gJuc/bi07lv53uL6n3FPHGuNHK+5Ihv7vksi11Z H8dAyqRqJbsysrSzOEfA766A75A8WOxB1xyxXTw6ArxCLxkQcKpiwdUL51HDRSkF0URq agzLDPNv4ML5ifuOtoQHBXmeD0UnHxf8ch/QdRoe+3yf9ewkjNhP5embvqfAUkY/fxFM 2ZhMqKLnhJ8xSeR0lDebuiG9qim4kfzh/iw8JsC2z2BvafmBsPUE7wHLdVC0z8xcwrxU W5P/V3GhjH27rvV079qinLyy+/jT62dxjnXu/AiQaA83XzY29M7ygFPlQAWXDouFCRFA fAdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fyJMavU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id h8-20020a9d6f88000000b006bcff359f28si3467583otq.362.2023.11.21.06.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 06:01:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fyJMavU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id C3FFD8027976; Tue, 21 Nov 2023 06:00:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234002AbjKUOAo (ORCPT + 99 others); Tue, 21 Nov 2023 09:00:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233964AbjKUOAl (ORCPT ); Tue, 21 Nov 2023 09:00:41 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B535B9A; Tue, 21 Nov 2023 06:00:37 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ALDxTvE003796; Tue, 21 Nov 2023 14:00:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=wZWK4HHl5K/RbV8IOMstnMkJHrhsT6sum4v536nDEYU=; b=fyJMavU9twOxBV4sdflsw2E8E9Q2xF59UztXG6wYT6UiKsUxWJ8T7kGbV+/K24ATHWxS UmhNs/w6jegKsIEVJnwVE9u9LKglBeKgLkjB8u1Pws5/DHz3pah8sgjZyW9doTFEIC4T x44Z3tXsmAMBlSX59slcwaqaz7NXMmQnEc2q+yDobRgHQfTJoL0V8hnAYAPp1mNu5xlq 0CGzqmfI0iUsS2tzuN6/UVkjtfUVa+clZWzdT0/4rbv370qquN6J6TxK6pjoB+TOzCtB ZS+riP0SF6xsoj8tyEuL9IpxAeoV0zm4j8DGvHvFpWrL0rUtZmH5Sd61lQyenOaO07XF wQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ugk9p9vk0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Nov 2023 14:00:32 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3ALE0VxX010666 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Nov 2023 14:00:31 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, 21 Nov 2023 06:00:28 -0800 From: Prashanth K To: Thinh Nguyen , Greg Kroah-Hartman CC: Mathias Nyman , , , Prashanth K , Subject: [PATCH] usb: dwc3: core: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK Date: Tue, 21 Nov 2023 19:29:36 +0530 Message-ID: <20231121135936.1669167-1-quic_prashk@quicinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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: Z9ZWNIVSetwzOy6-QSt1Qc2bcTsw0Vu8 X-Proofpoint-ORIG-GUID: Z9ZWNIVSetwzOy6-QSt1Qc2bcTsw0Vu8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-21_05,2023-11-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=1011 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311210109 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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 21 Nov 2023 06:00:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783182410292633339 X-GMAIL-MSGID: 1783182410292633339 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_priv_data 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 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/ Cc: # 5.11 Fixes: bac1ec551434 ("usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK") Signed-off-by: Prashanth K --- drivers/usb/dwc3/host.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index 61f57fe5bb78..ee3b667a88b2 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -11,6 +11,7 @@ #include #include +#include "../host/xhci-plat.h" #include "core.h" static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc, @@ -63,6 +64,7 @@ int dwc3_host_init(struct dwc3 *dwc) { struct property_entry props[4]; struct platform_device *xhci; + struct xhci_plat_priv dwc3_xhci_plat_priv; int ret, irq; int prop_idx = 0; @@ -87,6 +89,14 @@ int dwc3_host_init(struct dwc3 *dwc) goto err; } + memset(&dwc3_xhci_plat_priv, 0, sizeof(struct xhci_plat_priv)); + + dwc3_xhci_plat_priv.quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK; + ret = platform_device_add_data(xhci, &dwc3_xhci_plat_priv, + sizeof(dwc3_xhci_plat_priv)); + if (ret) + goto err; + memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); if (dwc->usb3_lpm_capable)