Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp500561rdg; Thu, 12 Oct 2023 11:39:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1v11VLg/nEjUY8LAM/zMoXaix7slbsLavYTg5NcgfQ/cuwa7y8iPrv5dFLwtpV8gfFFZz X-Received: by 2002:a17:903:32cb:b0:1c5:ea60:85c5 with SMTP id i11-20020a17090332cb00b001c5ea6085c5mr25802172plr.2.1697135975980; Thu, 12 Oct 2023 11:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697135975; cv=none; d=google.com; s=arc-20160816; b=cKeWeR7TWFPFCm4wpNWDgRnKippuhuxV/l0yh56N3XCoAU4ziV/n1VFRetuf2VwKeC 5KW3uH+S+RRHFXNP2aVR2X7C/F+6iye2BzUT/os0Jo1Xb4wBXxC3x4ZJpeNkrT0Ze/A1 r+gqG2V07KW49ziVeZSE9LBC2WwKvnlhxldlI/wLm846Vp7nS8fZzkK1GsXMrE43wjoC tYvc7iULxXao+rKYokchtHh493LVZStgijaNJb3DPOh+Pz3BZKzac5Sf3GNrbXb1hAz0 Y9rFpnaVsG/wg8zZ/CaFeIGmnnKVi5W/FJNOxhXghbMNp31S1UZ4CziR8EJgeMnb3Lff P6AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=NsV0kpoOR7sCQ7NjSt84rdLl5aq1qP8KMvA+Lq6Vzew=; fh=VYMZjSK9DwgngYgSi2GvOjUgd//kkO6g5QcqkqFYRwk=; b=f7IF503N8jtFzkEYi3KGZQpyYH/mYwRTe4ucNWLvShZmAzHCnxIzJy1SqbHZSMi9nH B1xT31PqZ7tGGjTmcyUXj69Ukh0qJt1utUM9hwpI+TYbJofdoF1VVja5vb7RETlrTpDc 6hDJX6X7K2QoGdTUcYGR/6gRQwbNnbaZiNllx1T7J4spzC/SX21q9/oplwMTkL/FItnn ffNGwXu44xqewHEVraR8gXDZ54caiyf26f0qRd8gS8W6DdW7RpeGX3q+ybLODQHt05G4 UTtl57GvbNhPYkefBcpA4PWNIacUtumqDzTr8iPTNJe17Rahp976y3M1TMs22qp1ZB9y 4D1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HFJj1V8T; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id w2-20020a170902e88200b001bc17ab8d6esi2957071plg.530.2023.10.12.11.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 11:39:35 -0700 (PDT) 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=HFJj1V8T; 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 31F108217074; Thu, 12 Oct 2023 11:39:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441980AbjJLSja (ORCPT + 99 others); Thu, 12 Oct 2023 14:39:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379690AbjJLSj2 (ORCPT ); Thu, 12 Oct 2023 14:39:28 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3206EBE; Thu, 12 Oct 2023 11:39:26 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39CDTPVQ013404; Thu, 12 Oct 2023 18:39:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=NsV0kpoOR7sCQ7NjSt84rdLl5aq1qP8KMvA+Lq6Vzew=; b=HFJj1V8TPQJ8Q1zPNYt0ECMeuDvf+EhClLxLLro+1VPCryyd7a/nmJJCQ4fahD0pSbfL AzeI+IcwrcxdRZ6beNweq8mMWXroocfIBqVv3lH09mBwu0NP2BmanEctYc7TSL9WrisW btr5DAsyrZPgm4UMNtCQ8U3TVaHHTyDbYAdnLu2RZTFWonPfF7CFXjekX4zAsdBTLJHa f5tqJoCRkslkq3UlaO9lNYAdus3AuaE90xQKmTBYRfAX4Ih99+a3+orHEBMGTbn6OOwO 4yR2aU1eeS2yfj+0bHJhXd8UVJF7y3WB2EhbO+GR+4EB/Nvv7EhyR0jt1UzmdSI09kaQ wg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tpfa6149m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 18:39:20 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39CIdCh2019442 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 18:39:12 GMT Received: from [10.216.46.114] (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.36; Thu, 12 Oct 2023 11:39:08 -0700 Message-ID: Date: Fri, 13 Oct 2023 00:09:04 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC] usb: dwc3: core: Fix RAM interface getting stuck during enumeration To: Thinh Nguyen CC: Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "quic_ppratap@quicinc.com" , "quic_wcheng@quicinc.com" , "quic_jackp@quicinc.com" , "quic_ugoswami@quicinc.com" References: <20231011100214.25720-1-quic_kriskura@quicinc.com> <20231012175912.umc3ugzk4iqwtcp3@synopsys.com> Content-Language: en-US From: Krishna Kurapati PSSNV In-Reply-To: <20231012175912.umc3ugzk4iqwtcp3@synopsys.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit 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-ORIG-GUID: POs1EbSOCYM0bZDIORmB48KYVnEyhtT0 X-Proofpoint-GUID: POs1EbSOCYM0bZDIORmB48KYVnEyhtT0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-12_11,2023-10-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 mlxlogscore=848 impostorscore=0 bulkscore=0 mlxscore=0 priorityscore=1501 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310120155 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 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: 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]); Thu, 12 Oct 2023 11:39:35 -0700 (PDT) On 10/12/2023 11:29 PM, Thinh Nguyen wrote: >> -static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc) >> +int dwc3_gadget_soft_disconnect(struct dwc3 *dwc) >> { >> unsigned long flags; >> int ret; >> @@ -2701,7 +2701,7 @@ static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc) >> return ret; >> } >> >> -static int dwc3_gadget_soft_connect(struct dwc3 *dwc) >> +int dwc3_gadget_soft_connect(struct dwc3 *dwc) >> { >> int ret; >> >> @@ -3963,6 +3963,7 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc) >> dwc3_gadget_dctl_write_safe(dwc, reg); >> >> dwc->connected = false; >> + dwc->cable_disconnected = true; >> >> dwc3_disconnect_gadget(dwc); >> >> @@ -4038,6 +4039,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) >> */ >> dwc3_stop_active_transfers(dwc); >> dwc->connected = true; >> + dwc->cable_disconnected = false; >> >> reg = dwc3_readl(dwc->regs, DWC3_DCTL); >> reg &= ~DWC3_DCTL_TSTCTRL_MASK; >> -- >> 2.42.0 >> > > We can just reset the controller when there's End Transfer command > timeout as a failure recovery. No need to do what you're doing here. > Hi Thinh, That was what I initially wanted to do, but there were couple of reasons I wanted to take this approach: 1. We can't just reset the controller in midst of gadget_interrupt. We need to process it completely and then take action. 2. The above log was seen on QRD variant of SM8550/SM8650 easily. But on other platforms of same targets, the issue comes up at some other instances of code, at a point where no IRQ is running. In such cases its not possible to accurately find out code portions and reset the controller. The way I confirmed that both platforms are having the same issue is: a. During cable disconnect, I am not receiving disconnect interrupt b. The reg dump is exactly same in both cases (BMU as well) So I felt it was better to fix it during cable disconnect because even if we remove cable, we are still in device mode only and in this case we can unblock suspend and also bring back controller to a known state. Let me know your thoughts on the above. Regards, Krishna,