Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp818578rwd; Tue, 16 May 2023 08:05:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Vcip+ttOoMmx053Ak7di/jYd1WyiKdJCor9S9Qy4V4RXKBRRFJzjCnJHCUeZTb6OesKXd X-Received: by 2002:a17:902:c213:b0:1ae:4248:c7f with SMTP id 19-20020a170902c21300b001ae42480c7fmr1477317pll.48.1684249555913; Tue, 16 May 2023 08:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684249555; cv=none; d=google.com; s=arc-20160816; b=kYUH+RBEqvViqrZ1bTdsQq6eYD2qxtWB7G7l34p1AXdoyYP2Gn8iBKagVRUYuF7cCn egLjFJ2d1AgSp9eN49TTX2DSBNLZTV0Ox7cvgQEntnngzc0PkeIJe5PszllYcHSBIJTh UAKpcI/9kGJ3mQkX5dJDZXspdjXDuCCY0qh1GZPtnjPXjiRMi1OCHRZPmnHjX1LboAYh 78sZ5RhYZvXiQpYRdcGwzXUgohgw2QvezU0K4N7+s6kZicsj0NEmQcBxCshMLvZ/zz3O aWaEBOZhCMnGh2FdjQfVctWUBSMXddmSpzDrgAtzoAOJ0Zjihggq/rHJQUd7RvC+V/K8 ZjZg== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=RMFXA7ZudVjHyZ4kH0k4IsYmxdb+amxND9ev4TL+PJg=; b=TVFmGtAh5WtfXMDGMUAFVJe+yam1lZNGP7gp1ULNXSt1X4nt1PrXkf0kOKuXsO3JYV TY0jiP8R2443KHrkYXH4UEWb8N6be7zXg6VvmmOwxySmuYgYToN0FIQkG2Kvd3brmh7l eN9au+GeJGjRaq1UkAlDWgSpWhCwby4H6vugWnaydjn0KEeb/kcYtevRhZm3FqLBO3ei eAbWrwXS5LgbiQPnD7pcQ0XzNOA1Bu6H3O8+ryqzzR7ORBek60pDRAXqoV63nXmvA+XZ Z08wPqtdWy4/4X00JcZQGvR+8gDsvPDdNZqBmiiy5yl/rBZgp3Gb9LM70ETRbRNpBu2/ 9iow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="i/5efG5o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y21-20020a1709027c9500b001a1b776489dsi18020406pll.300.2023.05.16.08.05.36; Tue, 16 May 2023 08:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="i/5efG5o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233237AbjEPO2n (ORCPT + 99 others); Tue, 16 May 2023 10:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233913AbjEPO2h (ORCPT ); Tue, 16 May 2023 10:28:37 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4A861BC6; Tue, 16 May 2023 07:28:34 -0700 (PDT) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34GCAecw004449; Tue, 16 May 2023 14:28:23 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=RMFXA7ZudVjHyZ4kH0k4IsYmxdb+amxND9ev4TL+PJg=; b=i/5efG5oQ5S2n9dcGNFeOm50w+dd95BVSdWs0r2Rtt0DZE1wBsIXyA3+CBQQLoEa/2/S Vw0TlhR4RHyjdzJ3HIK/5SIWg0+NyXvG9CjoCpE8sqvjKK9A8BwNIRe04llJ4P0+/uea 2Hdql0k7wyPUwOVqSCrLHoIJwSdAdnX3hv6vdWUtUa3bWd7YhKXuwmLKqzm/MxU5wkuy lMsyXvkUlaHdnHmMXoLiuw4iPqd2j2JORBwsLa5rSBvwkcVRio51LQdCXtvy2i/UB+e3 w7VV4qY4c1t22DOv0szZ6PfHXTXqIFqrcFml2evPj8cF8NqLSSUcygoCHRoby15jLm8K dw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qm1x096x7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 May 2023 14:28:23 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 34GESL02026238 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 May 2023 14:28:22 GMT Received: from [10.216.35.75] (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.986.42; Tue, 16 May 2023 07:28:14 -0700 Message-ID: <52b5c1ac-ac69-2ca7-1bf4-01b1f53b1634@quicinc.com> Date: Tue, 16 May 2023 19:58:10 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v8 4/9] usb: dwc3: core: Skip setting event buffers for host only controllers Content-Language: en-US To: Johan Hovold CC: Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , "Andy Gross" , Bjorn Andersson , "Konrad Dybcio" , Rob Herring , Krzysztof Kozlowski , Felipe Balbi , , , , , , , , , , References: <20230514054917.21318-1-quic_kriskura@quicinc.com> <20230514054917.21318-5-quic_kriskura@quicinc.com> From: Krishna Kurapati PSSNV In-Reply-To: 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: THSS0IZNn5baN6Z7Bij_d4pFBAaLOwkV X-Proofpoint-GUID: THSS0IZNn5baN6Z7Bij_d4pFBAaLOwkV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-16_07,2023-05-16_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 impostorscore=0 spamscore=0 adultscore=0 phishscore=0 clxscore=1015 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305160121 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 5/16/2023 5:47 PM, Johan Hovold wrote: > On Sun, May 14, 2023 at 11:19:12AM +0530, Krishna Kurapati wrote: >> On some SoC's like SA8295P where the tertiary controller is host-only >> capable, GEVTADDRHI/LO, GEVTSIZ, GEVTCOUNT registers are not accessible. >> Trying to setup them up during core_init leads to a crash. >> >> For DRD/Peripheral supported controllers, event buffer setup is done >> again in gadget_pullup. Skip setup or cleanup of event buffers if >> controller is host-only capable. >> >> Signed-off-by: Krishna Kurapati >> --- >> drivers/usb/dwc3/core.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c >> index e983aef1fb93..46192d08d1b6 100644 >> --- a/drivers/usb/dwc3/core.c >> +++ b/drivers/usb/dwc3/core.c >> @@ -505,6 +505,11 @@ static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned int length) >> int dwc3_event_buffers_setup(struct dwc3 *dwc) >> { >> struct dwc3_event_buffer *evt; >> + unsigned int hw_mode; >> + >> + hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); >> + if (hw_mode == DWC3_GHWPARAMS0_MODE_HOST) >> + return 0; >> >> evt = dwc->ev_buf; > > How about adding this check to dwc3_alloc_event_buffers() instead as > there should be no need to allocate buffer that you never use? > > Then you can just check dwc->ev_buf here and elsewhere. > Thanks for this idea. We can save 4096 bytes from being allocated this way. Will get this in next version. Regards, Krishna,