Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp65555imm; Fri, 7 Sep 2018 16:30:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaJiytRVvyvs7NTjRKKTIaTK+U7zkdhkkMFRQmh4J0S/s7QoexsQF5zNglDD3WriAoh57Q/ X-Received: by 2002:a63:fd06:: with SMTP id d6-v6mr10494998pgh.348.1536363059611; Fri, 07 Sep 2018 16:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536363059; cv=none; d=google.com; s=arc-20160816; b=uqVWBFwxWq+bK5O/LGxX8BuzcQZW9KvECJkuCyVCZqbYHhDnw56D6ERlB2CZ2baELF 4uJS8G7nHmV0k5lR4nxSoNnpNxbmD97fqSOkEIVo6BxrjOSSzVebNYbWfP4FTxthKImA 96oi4ECOEEqpqOEI2Vsxu6oRoBCOizx7/3RZItP7fFI0jJc8+DLySEwOFGwmZTwb5iqE oVnGjaB0VVUxpQmnDCTHY6zhaesAlXHgYoJ7MHv9DfhSPIYBBkFzRMNpwbAp/h2Qaep8 8wYC2umyqj17Qib56FmaXWMajHxSgXIfs+hJS/OtBJNS9Ia6XUid46ec7TfxjS4N9nPP 8+Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=DMG1QegIgYu/B9Nf2BtzKcbMQtf9biSSfOZ+j3PZbew=; b=W6IQPUD3LdpOD/PHux0bpw2AJAqsOVxx1miKh/bGSaKUEGMCrw4VWKZ0QR5l+vbpIN 8HFR60qUvJIezfrFUvxuoT6IxF2cetUe6phFxWlrcxCkWHpXJyBr+Y9qud3P12UYHYhA rnv11Ro0rGjZ45ORcNcF/egXf3TT1fPSjanJ+SgzwG5iq/4R6su++Emv66+cf1SrHiiR q2V2oc/hwmsgZMvTD8YCNDyjs13VN7YprwzgV6Umgm7JSgAIACkk3uVARX42/mvOFGev Btg+afZTGaJJDG+BvCExVrEGtdlT1ImAnWbtpY73fs4dwhlJh/BCW04WbLD9nhdAkY1y SFSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=cmnTk1lg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t127-v6si10073816pfc.118.2018.09.07.16.30.43; Fri, 07 Sep 2018 16:30:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=cmnTk1lg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726534AbeIHEMQ (ORCPT + 99 others); Sat, 8 Sep 2018 00:12:16 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:39160 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725732AbeIHEMQ (ORCPT ); Sat, 8 Sep 2018 00:12:16 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 7496F24E0691; Fri, 7 Sep 2018 16:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1536362938; bh=ygyKDWROYWcWby6xQGVRG1weRKfXOseAZi6aTlbMYRg=; h=From:To:CC:Subject:Date:References:From; b=cmnTk1lgcmblW0UO/GmN8q1kAQEYF227njcpppADG9kIrJzDDQoIzy8rfvWP9vfLi +f6Z7q0F918XtomOiXj6THRPfwwmgFPMl1GBDsmB4Gj3Di+OBDGyHVznxbfe0jh6wa gWLxlJqoZvynQ9b+RItRT2Oblu4BX/DnbpOEzBQVyJPrghCjugg7ITfNqvJ20dNMek hQV5d5n3dOk4dsszK56Jp5d1AR5Ym6q1Eq8a8+8LeQnMaS1U8nO3kBFwXXG3Qnc6m1 tXjfyRIQGToKxoEChbjXfS8whDsH6WwTldo9JnT9udqMzOKJGhmcrmKlBW2Mf1/qiK 3wXrgTMzi/AJg== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id 5C01A38C6; Fri, 7 Sep 2018 16:28:58 -0700 (PDT) Received: from us01wembx1.internal.synopsys.com ([169.254.1.253]) by US01WEHTC2.internal.synopsys.com ([10.12.239.237]) with mapi id 14.03.0361.001; Fri, 7 Sep 2018 16:28:58 -0700 From: Thinh Nguyen To: Anurag Kumar Vulisha , "balbi@kernel.org" , "gregkh@linuxfoundation.org" CC: "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Thinh.Nguyen@synopsys.com" , "v.anuragkumar@gmail.com" Subject: Re: [PATCH v3 1/8] usb: dwc3: Correct the logic for checking TRB full in __dwc3_prepare_one_trb() Thread-Topic: [PATCH v3 1/8] usb: dwc3: Correct the logic for checking TRB full in __dwc3_prepare_one_trb() Thread-Index: AQHURqy3eaJ+tpig0kSKsepPhxN7aQ== Date: Fri, 7 Sep 2018 23:28:57 +0000 Message-ID: <30102591E157244384E984126FC3CB4F544AD8B3@us01wembx1.internal.synopsys.com> References: <1536326029-16327-1-git-send-email-anurag.kumar.vulisha@xilinx.com> <1536326029-16327-2-git-send-email-anurag.kumar.vulisha@xilinx.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.184.20] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anurag,=0A= =0A= On 9/7/2018 6:14 AM, Anurag Kumar Vulisha wrote:=0A= > Availability of TRB's are calculated using dwc3_calc_trbs_left(), which= =0A= > determines available TRB's based on the HWO bit set in a TRB.=0A= >=0A= > __dwc3_prepare_one_trb() is called with a TRB which needs to be prepared= =0A= > for transfer. This __dwc3_prepare_one_trb() calls dwc3_calc_trbs_left()= =0A= > to determine total available TRBs and set IOC bit if the total available= =0A= > TRBs are zero. Since the present working TRB(which is passed as an=0A= > argument to __dwc3_prepare_one_trb() ) doesn't have HWO bit already set,= =0A= > there are chances where dwc3_calc_trbs_left() wrongly calculates this=0A= > present working TRB as free(since the HWO bit is not yet set). This could= =0A= > be a problem. This patch correct this issue by setting HWO bit before=0A= > calling dwc3_calc_trbs_left()=0A= =0A= Please revise your commit message to reflect your new change.=0A= =0A= >=0A= > Signed-off-by: Anurag Kumar Vulisha =0A= > Reviewed-by: Thinh Nguyen =0A= > ---=0A= > Changes in v3:=0A= > 1. Corrected the logic for setting HWO bit as suggested by "Thinh Nguyen= "=0A= >=0A= > Changes in v2:=0A= > 1. Changed the commit message=0A= > ---=0A= > drivers/usb/dwc3/gadget.c | 6 +++---=0A= > 1 file changed, 3 insertions(+), 3 deletions(-)=0A= >=0A= > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c=0A= > index 032ea7d..8a1622b 100644=0A= > --- a/drivers/usb/dwc3/gadget.c=0A= > +++ b/drivers/usb/dwc3/gadget.c=0A= > @@ -911,8 +911,6 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *de= p, struct dwc3_trb *trb,=0A= > struct usb_gadget *gadget =3D &dwc->gadget;=0A= > enum usb_device_speed speed =3D gadget->speed;=0A= > =0A= > - dwc3_ep_inc_enq(dep);=0A= > -=0A= > trb->size =3D DWC3_TRB_SIZE_LENGTH(length);=0A= > trb->bpl =3D lower_32_bits(dma);=0A= > trb->bph =3D upper_32_bits(dma);=0A= > @@ -991,7 +989,7 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *de= p, struct dwc3_trb *trb,=0A= > }=0A= > =0A= > if ((!no_interrupt && !chain) ||=0A= > - (dwc3_calc_trbs_left(dep) =3D=3D 0))=0A= > + (dwc3_calc_trbs_left(dep) =3D=3D 1))=0A= > trb->ctrl |=3D DWC3_TRB_CTRL_IOC;=0A= > =0A= > if (chain)=0A= > @@ -1002,6 +1000,8 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *= dep, struct dwc3_trb *trb,=0A= > =0A= > trb->ctrl |=3D DWC3_TRB_CTRL_HWO;=0A= > =0A= > + dwc3_ep_inc_enq(dep);=0A= > +=0A= > trace_dwc3_prepare_trb(dep, trb);=0A= > }=0A= > =0A= =0A= BR,=0A= Thinh=0A=