Message ID | 20231118055455.249088-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:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1007565vqn; Fri, 17 Nov 2023 21:55:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEODOqeu3pcu8uoaqnj0naAi7y9SFk7eVQ1WOjM3Hn8utH9Wp/VgmTWxf0tU7LAl2y5nH9 X-Received: by 2002:a17:902:d489:b0:1cc:644a:210a with SMTP id c9-20020a170902d48900b001cc644a210amr2030592plg.16.1700286950802; Fri, 17 Nov 2023 21:55:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700286950; cv=none; d=google.com; s=arc-20160816; b=I5RnbtX94vJkwMvRRfjpMzwhFOnN2zWb9KhtjfHHxEYDPv00TTRU1o8p0hfBfuod6R p+x6lTZBxHODLxk21TAivbnY3NlJviufJ+rtPWfwnR/mw2Z84EnJUEvFJjHuGPsFXhdM QxLagayD1ZhGvBM6THxPCGqqoCSqbjaCfGwrKASwwTDLgKMv4hLoswVhtk2d6t/NfmnW UghqcfMn/jHx9pJ0UDrzw8wq1AzVoBB/Zy+tJWVQxfoutBXNboUwDTdUR6Uv/8Ms3tVF vGnq//zJN0Fgk7fKyy9quFYyrQr7MtqvzMigYu8j7E/QM4knlBv+rBxXJY0tznQ/ivBh Cgzg== 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=FdcousxXEK2YX0DQ9FacyS/BELtwq6xvR7XtMp1Ohs4=; fh=Hv4HKCbRivDk4/75VrgkjLv7mwh0AD3ncrNwtpzgDfg=; b=VHQ0qLyGn0eZJ1t3mz0AB083HxeTnx0NttdzYpfZKFcWuiDwlLLtbUeKszBNux7s+8 1TAQvhjcYFH0dNvJftxDfmlfmRv/9HztMg3ofDEklxW+U1c/hMZlVwuLPqZQ4xW/JGR+ +fx4wrD72oPfkfqvbaks6mvpzG27m00+8/LB5AVJxsw5DAGW8takzj1rPU7aSv7eWG0v k96iSSppOGFTpr2v22ZDdvcoIl5lLSfx7sKs7Db6Cz0bIX/jTkkJ1V1LOeBlv1luXyff 015SjtapHtazvFDy1MIk4a/79LBO+fUXV8bUtdOhESGQdxnGPorHx+9bAR4+5UMr9Qft qeqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=euyEDQIO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ix19-20020a170902f81300b001c6189eaaebsi3415702plb.186.2023.11.17.21.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 21:55:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=euyEDQIO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id D44B082AAE81; Fri, 17 Nov 2023 21:55:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232139AbjKRFzi (ORCPT <rfc822;jaysivo@gmail.com> + 29 others); Sat, 18 Nov 2023 00:55:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231902AbjKRFzh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 18 Nov 2023 00:55:37 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D16CA6; Fri, 17 Nov 2023 21:55:33 -0800 (PST) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AI5pKdK009856; Sat, 18 Nov 2023 05:55:30 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=FdcousxXEK2YX0DQ9FacyS/BELtwq6xvR7XtMp1Ohs4=; b=euyEDQIOBVFXAWu8DPP4iAmxgQRi8/pJF6PktzYTBlwPgkkJJvVvPN5TJLRU4ZcjAyYu YlOLzTflFtXQ0enrJxmREFiVABAQHnr5VDByVhRSPvcVYtc3XboUeweJhnPQ7wg6SjkM KR6aZutRf9WhfNRlfX1mvOPVi7ZJ6soGVMr4KzYFWXRi9+Cab1LhmybAHk/WoVfq95lY e2P3r086UAQIqnUX7KPR/pglD2fqSAcTk0J5iknueGuXWmT2TlWy1nwdOejQiBOdPypQ 8Rl1gpZStQmlt3L345l2WcnGaI5C/aXNDIQDKeNLSjkVBeRKGqs77HnVjLaBjD73N1Qr Nw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uejymraqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 18 Nov 2023 05:55:29 +0000 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 3AI5tSE9016769 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 18 Nov 2023 05:55:28 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; Fri, 17 Nov 2023 21:55:25 -0800 From: Prashanth K <quic_prashk@quicinc.com> To: <stable@vger.kernel.org>, Thinh Nguyen <Thinh.Nguyen@synopsys.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org> CC: Mathias Nyman <mathias.nyman@intel.com>, Tejas Joglekar <joglekar@synopsys.com>, <linux-kernel@vger.kernel.org>, <linux-usbyy@vger.kernel.org>, Prashanth K <quic_prashk@quicinc.com> Subject: [PATCH 1/2] usb: dwc3: core: Add support for xhci-sg-trb-cache-size-quirk Date: Sat, 18 Nov 2023 11:24:54 +0530 Message-ID: <20231118055455.249088-2-quic_prashk@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231118055455.249088-1-quic_prashk@quicinc.com> References: <20231118055455.249088-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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: AVfXllujiIXt12qzfEIBvJy0WwogW_qx X-Proofpoint-ORIG-GUID: AVfXllujiIXt12qzfEIBvJy0WwogW_qx 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-18_04,2023-11-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311180041 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 21:55:49 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782880089826837422 X-GMAIL-MSGID: 1782880089826837422 |
Series |
Add support for xhci-sg-trb-cache-size-quirk
|
|
Commit Message
Prashanth K
Nov. 18, 2023, 5:54 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 while using SG buffers. Add a new quirk
in DWC3 layer to enable this XHCI quirk since this is needed
for DWC3 controller. Added xhci private data structure to pass
the quirk to XHCI.
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
Fixes: bac1ec551434 ("usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK")
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
---
drivers/usb/dwc3/core.c | 2 ++
drivers/usb/dwc3/core.h | 3 +++
drivers/usb/dwc3/host.c | 9 +++++++++
3 files changed, 14 insertions(+)
Comments
Hi Prashanth, kernel test robot noticed the following build warnings: [auto build test WARNING on usb/usb-testing] [also build test WARNING on usb/usb-next usb/usb-linus linus/master v6.7-rc1 next-20231117] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Prashanth-K/usb-dwc3-core-Add-support-for-xhci-sg-trb-cache-size-quirk/20231118-135837 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20231118055455.249088-2-quic_prashk%40quicinc.com patch subject: [PATCH 1/2] usb: dwc3: core: Add support for xhci-sg-trb-cache-size-quirk config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231118/202311181846.AjhQ7gvy-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231118/202311181846.AjhQ7gvy-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202311181846.AjhQ7gvy-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/usb/dwc3/host.c: In function 'dwc3_host_init': drivers/usb/dwc3/host.c:66:16: error: variable 'dwc3_xhci_plat_priv' has initializer but incomplete type 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^~~~~~~~~~~~~~ >> drivers/usb/dwc3/host.c:66:56: warning: excess elements in struct initializer 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^ drivers/usb/dwc3/host.c:66:56: note: (near initialization for 'dwc3_xhci_plat_priv') drivers/usb/dwc3/host.c:66:33: error: storage size of 'dwc3_xhci_plat_priv' isn't known 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^~~~~~~~~~~~~~~~~~~ drivers/usb/dwc3/host.c:92:47: error: 'XHCI_SG_TRB_CACHE_SIZE_QUIRK' undeclared (first use in this function) 92 | dwc3_xhci_plat_priv.quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/dwc3/host.c:92:47: note: each undeclared identifier is reported only once for each function it appears in >> drivers/usb/dwc3/host.c:66:33: warning: unused variable 'dwc3_xhci_plat_priv' [-Wunused-variable] 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^~~~~~~~~~~~~~~~~~~ vim +66 drivers/usb/dwc3/host.c 61 62 int dwc3_host_init(struct dwc3 *dwc) 63 { 64 struct property_entry props[4]; 65 struct platform_device *xhci; > 66 struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; 67 int ret, irq; 68 int prop_idx = 0; 69 70 irq = dwc3_host_get_irq(dwc); 71 if (irq < 0) 72 return irq; 73 74 xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO); 75 if (!xhci) { 76 dev_err(dwc->dev, "couldn't allocate xHCI device\n"); 77 return -ENOMEM; 78 } 79 80 xhci->dev.parent = dwc->dev; 81 82 dwc->xhci = xhci; 83 84 ret = platform_device_add_resources(xhci, dwc->xhci_resources, 85 DWC3_XHCI_RESOURCES_NUM); 86 if (ret) { 87 dev_err(dwc->dev, "couldn't add resources to xHCI device\n"); 88 goto err; 89 } 90 91 if (dwc->xhci_sg_trb_cache_size_quirk) 92 dwc3_xhci_plat_priv.quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK; 93 94 ret = platform_device_add_data(xhci, &dwc3_xhci_plat_priv, 95 sizeof(dwc3_xhci_plat_priv)); 96 if (ret) 97 goto err; 98 99 memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); 100 101 if (dwc->usb3_lpm_capable) 102 props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb3-lpm-capable"); 103 104 if (dwc->usb2_lpm_disable) 105 props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb2-lpm-disable"); 106 107 /** 108 * WORKAROUND: dwc3 revisions <=3.00a have a limitation 109 * where Port Disable command doesn't work. 110 * 111 * The suggested workaround is that we avoid Port Disable 112 * completely. 113 * 114 * This following flag tells XHCI to do just that. 115 */ 116 if (DWC3_VER_IS_WITHIN(DWC3, ANY, 300A)) 117 props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped"); 118 119 if (prop_idx) { 120 ret = device_create_managed_software_node(&xhci->dev, props, NULL); 121 if (ret) { 122 dev_err(dwc->dev, "failed to add properties to xHCI\n"); 123 goto err; 124 } 125 } 126 127 ret = platform_device_add(xhci); 128 if (ret) { 129 dev_err(dwc->dev, "failed to register xHCI device\n"); 130 goto err; 131 } 132 133 return 0; 134 err: 135 platform_device_put(xhci); 136 return ret; 137 } 138
Hi Prashanth, kernel test robot noticed the following build errors: [auto build test ERROR on usb/usb-testing] [also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.7-rc1 next-20231117] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Prashanth-K/usb-dwc3-core-Add-support-for-xhci-sg-trb-cache-size-quirk/20231118-135837 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20231118055455.249088-2-quic_prashk%40quicinc.com patch subject: [PATCH 1/2] usb: dwc3: core: Add support for xhci-sg-trb-cache-size-quirk config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231118/202311182124.Rhvs60sb-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231118/202311182124.Rhvs60sb-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202311182124.Rhvs60sb-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/usb/dwc3/host.c: In function 'dwc3_host_init': >> drivers/usb/dwc3/host.c:66:16: error: variable 'dwc3_xhci_plat_priv' has initializer but incomplete type 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^~~~~~~~~~~~~~ drivers/usb/dwc3/host.c:66:56: warning: excess elements in struct initializer 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^ drivers/usb/dwc3/host.c:66:56: note: (near initialization for 'dwc3_xhci_plat_priv') >> drivers/usb/dwc3/host.c:66:33: error: storage size of 'dwc3_xhci_plat_priv' isn't known 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^~~~~~~~~~~~~~~~~~~ >> drivers/usb/dwc3/host.c:92:47: error: 'XHCI_SG_TRB_CACHE_SIZE_QUIRK' undeclared (first use in this function) 92 | dwc3_xhci_plat_priv.quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/dwc3/host.c:92:47: note: each undeclared identifier is reported only once for each function it appears in drivers/usb/dwc3/host.c:66:33: warning: unused variable 'dwc3_xhci_plat_priv' [-Wunused-variable] 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^~~~~~~~~~~~~~~~~~~ vim +/dwc3_xhci_plat_priv +66 drivers/usb/dwc3/host.c 61 62 int dwc3_host_init(struct dwc3 *dwc) 63 { 64 struct property_entry props[4]; 65 struct platform_device *xhci; > 66 struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; 67 int ret, irq; 68 int prop_idx = 0; 69 70 irq = dwc3_host_get_irq(dwc); 71 if (irq < 0) 72 return irq; 73 74 xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO); 75 if (!xhci) { 76 dev_err(dwc->dev, "couldn't allocate xHCI device\n"); 77 return -ENOMEM; 78 } 79 80 xhci->dev.parent = dwc->dev; 81 82 dwc->xhci = xhci; 83 84 ret = platform_device_add_resources(xhci, dwc->xhci_resources, 85 DWC3_XHCI_RESOURCES_NUM); 86 if (ret) { 87 dev_err(dwc->dev, "couldn't add resources to xHCI device\n"); 88 goto err; 89 } 90 91 if (dwc->xhci_sg_trb_cache_size_quirk) > 92 dwc3_xhci_plat_priv.quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK; 93 94 ret = platform_device_add_data(xhci, &dwc3_xhci_plat_priv, 95 sizeof(dwc3_xhci_plat_priv)); 96 if (ret) 97 goto err; 98 99 memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); 100 101 if (dwc->usb3_lpm_capable) 102 props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb3-lpm-capable"); 103 104 if (dwc->usb2_lpm_disable) 105 props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb2-lpm-disable"); 106 107 /** 108 * WORKAROUND: dwc3 revisions <=3.00a have a limitation 109 * where Port Disable command doesn't work. 110 * 111 * The suggested workaround is that we avoid Port Disable 112 * completely. 113 * 114 * This following flag tells XHCI to do just that. 115 */ 116 if (DWC3_VER_IS_WITHIN(DWC3, ANY, 300A)) 117 props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped"); 118 119 if (prop_idx) { 120 ret = device_create_managed_software_node(&xhci->dev, props, NULL); 121 if (ret) { 122 dev_err(dwc->dev, "failed to add properties to xHCI\n"); 123 goto err; 124 } 125 } 126 127 ret = platform_device_add(xhci); 128 if (ret) { 129 dev_err(dwc->dev, "failed to register xHCI device\n"); 130 goto err; 131 } 132 133 return 0; 134 err: 135 platform_device_put(xhci); 136 return ret; 137 } 138
Hi Prashanth, kernel test robot noticed the following build errors: [auto build test ERROR on usb/usb-testing] [also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.7-rc1 next-20231117] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Prashanth-K/usb-dwc3-core-Add-support-for-xhci-sg-trb-cache-size-quirk/20231118-135837 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20231118055455.249088-2-quic_prashk%40quicinc.com patch subject: [PATCH 1/2] usb: dwc3: core: Add support for xhci-sg-trb-cache-size-quirk config: hexagon-randconfig-002-20231118 (https://download.01.org/0day-ci/archive/20231118/202311182312.lJrwZFwZ-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231118/202311182312.lJrwZFwZ-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202311182312.lJrwZFwZ-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from drivers/usb/dwc3/host.c:10: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:337: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 547 | val = __raw_readb(PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' 37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) | ^ In file included from drivers/usb/dwc3/host.c:10: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:337: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' 35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) | ^ In file included from drivers/usb/dwc3/host.c:10: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:337: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 584 | __raw_writeb(value, PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ >> drivers/usb/dwc3/host.c:66:26: error: variable has incomplete type 'struct xhci_plat_priv' 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^ drivers/usb/dwc3/host.c:66:9: note: forward declaration of 'struct xhci_plat_priv' 66 | struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; | ^ >> drivers/usb/dwc3/host.c:92:33: error: use of undeclared identifier 'XHCI_SG_TRB_CACHE_SIZE_QUIRK' 92 | dwc3_xhci_plat_priv.quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK; | ^ 6 warnings and 2 errors generated. vim +66 drivers/usb/dwc3/host.c 61 62 int dwc3_host_init(struct dwc3 *dwc) 63 { 64 struct property_entry props[4]; 65 struct platform_device *xhci; > 66 struct xhci_plat_priv dwc3_xhci_plat_priv = {0}; 67 int ret, irq; 68 int prop_idx = 0; 69 70 irq = dwc3_host_get_irq(dwc); 71 if (irq < 0) 72 return irq; 73 74 xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO); 75 if (!xhci) { 76 dev_err(dwc->dev, "couldn't allocate xHCI device\n"); 77 return -ENOMEM; 78 } 79 80 xhci->dev.parent = dwc->dev; 81 82 dwc->xhci = xhci; 83 84 ret = platform_device_add_resources(xhci, dwc->xhci_resources, 85 DWC3_XHCI_RESOURCES_NUM); 86 if (ret) { 87 dev_err(dwc->dev, "couldn't add resources to xHCI device\n"); 88 goto err; 89 } 90 91 if (dwc->xhci_sg_trb_cache_size_quirk) > 92 dwc3_xhci_plat_priv.quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK; 93 94 ret = platform_device_add_data(xhci, &dwc3_xhci_plat_priv, 95 sizeof(dwc3_xhci_plat_priv)); 96 if (ret) 97 goto err; 98 99 memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); 100 101 if (dwc->usb3_lpm_capable) 102 props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb3-lpm-capable"); 103 104 if (dwc->usb2_lpm_disable) 105 props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb2-lpm-disable"); 106 107 /** 108 * WORKAROUND: dwc3 revisions <=3.00a have a limitation 109 * where Port Disable command doesn't work. 110 * 111 * The suggested workaround is that we avoid Port Disable 112 * completely. 113 * 114 * This following flag tells XHCI to do just that. 115 */ 116 if (DWC3_VER_IS_WITHIN(DWC3, ANY, 300A)) 117 props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped"); 118 119 if (prop_idx) { 120 ret = device_create_managed_software_node(&xhci->dev, props, NULL); 121 if (ret) { 122 dev_err(dwc->dev, "failed to add properties to xHCI\n"); 123 goto err; 124 } 125 } 126 127 ret = platform_device_add(xhci); 128 if (ret) { 129 dev_err(dwc->dev, "failed to register xHCI device\n"); 130 goto err; 131 } 132 133 return 0; 134 err: 135 platform_device_put(xhci); 136 return ret; 137 } 138
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 0328c86..c6b0ae9 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1633,6 +1633,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,parkmode-disable-hs-quirk"); dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev, "snps,gfladj-refclk-lpm-sel-quirk"); + dwc->xhci_sg_trb_cache_size_quirk = device_property_read_bool(dev, + "xhci-sg-trb-cache-size-quirk"); dwc->tx_de_emphasis_quirk = device_property_read_bool(dev, "snps,tx_de_emphasis_quirk"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index efe6caf..dde1447 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1119,6 +1119,8 @@ struct dwc3_scratchpad_array { * instances in park mode. * @gfladj_refclk_lpm_sel: set if we need to enable SOF/ITP counter * running based on ref_clk + * @xhci_sg_trb_cache_size_quirk: set to prevent XHC timeout when scatter-gather + * is enabled due to TRB_CACHE_SIZE. * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis @@ -1342,6 +1344,7 @@ struct dwc3 { unsigned parkmode_disable_ss_quirk:1; unsigned parkmode_disable_hs_quirk:1; unsigned gfladj_refclk_lpm_sel:1; + unsigned xhci_sg_trb_cache_size_quirk:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index 61f57fe..09f049b 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -63,6 +63,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 = {0}; int ret, irq; int prop_idx = 0; @@ -87,6 +88,14 @@ int dwc3_host_init(struct dwc3 *dwc) goto err; } + if (dwc->xhci_sg_trb_cache_size_quirk) + 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)