Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6834161yba; Tue, 14 May 2019 14:42:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKU+MDRdqBL/i3qOGGhQqzjdwuBbrUnjckYgbvkYseqcnTeT5/K0PaYrrcvWHULvoI+Q8M X-Received: by 2002:a17:902:ab98:: with SMTP id f24mr39112348plr.223.1557870152487; Tue, 14 May 2019 14:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557870152; cv=none; d=google.com; s=arc-20160816; b=0sDUYfnMfh2WHgEp26p/cQIZJqJ678fwpywPEQC6J1+OjQH7mstnkvwH09xEvGod5Y NOr/JP/dHkfDTWuFCIaP4KpewnDmZGAE0Lg9a7UeGATto84Rh+q4GDK8yKR7OHxVllwl RPKMn3IjDOIOE8fUg2u/JAnNSQzbd0wwhAkpzhXIw32uxCDtrYRQLYsHjVJHKyZB065S uwJwuKQ7GJNyUQNIT1U6qfsRnQa329nvB8un154HOjOp/AwL5KZlbh5tFhiooU8AtOB9 04TlJWmjs72vTcpia8vCrT4EPOnaV2n+B5UFNmS4a10N1C/PL2hsMqzWEYdd3rHDwlp2 mxKA== 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=wLiDKzEv7zVi3rl00ExnQo63flmOHtFJpAJPPH6GA7s=; b=C+Wkt2Ej5YpzuFb77dr33smh0XrikDF2f4hKoUeu1RQwu0DQGqaccGv9gyrzdRuAWO LLv4eFIuOpJm6Fnznaj9L+cp9/R8Exg1OmF+/TG/o+euF1iO3432qZNMbbU564MGNMmC Oy6hCJs5UBQ/FJChgNAJ7H2/0SDkwfNuJOTt1Oqw8rIGls/aO6rjHE64nD+DfEwO9S0U 9h+xgaqB9EgxdJ0NvZofp/ncP3gIfbZU85uaFZpxubrS8jt/WYIE4xPu5b6bj7lt9+5g xQ+wB7kqDPQSIp5tC66YnnJbEoieJxxrEZMpa8VCLF329+LUklASRkcLrA9ThLuagKa0 1hPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=kjLXVYEp; 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 x4si20995196plv.329.2019.05.14.14.42.16; Tue, 14 May 2019 14:42:32 -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=kjLXVYEp; 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 S1726590AbfENVkw (ORCPT + 99 others); Tue, 14 May 2019 17:40:52 -0400 Received: from smtprelay-out1.synopsys.com ([198.182.47.102]:33716 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbfENVkv (ORCPT ); Tue, 14 May 2019 17:40:51 -0400 Received: from mailhost.synopsys.com (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 79448C1252; Tue, 14 May 2019 21:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1557870056; bh=UAGFHdNUHCjHtjAzwzRdYB0qbkfQ4RIc8Er0tSFwcA0=; h=From:To:CC:Subject:Date:References:From; b=kjLXVYEpdY/Hmo6FGfegwROk+XHUYftiUFzPloEbEnE7aWiYLo05y0VcjSoHzgAxr 2TuRikAodPlxEELXNvErljSt+UsvYuv6vQ4ZTuQd4IFmY8baGKEIbrXF9EBhYN25Wm qyVBpxIk9jDvA/79zMJCSRVwClnsVOioZUBkkyXnFlIVpPmqC7s0OXfLx735q/iVjI ToMBJpCUYMIt43jBupah2gmuxsPCTSwNs14Mz6EqM2fKQBQ5mBLWT7IdvHBXMcAA7I aXIxFOze3ojtnXgMW15bayg6mO7mp3JR5n2IXjQE+9EyyNiK7XGIBnlUxVkt0ajun4 afiulznKB+hzw== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id C8515A0093; Tue, 14 May 2019 21:40:50 +0000 (UTC) Received: from us01wembx1.internal.synopsys.com ([169.254.1.22]) by US01WXQAHTC1.internal.synopsys.com ([::1]) with mapi id 14.03.0415.000; Tue, 14 May 2019 14:40:50 -0700 From: Thinh Nguyen To: Anurag Kumar Vulisha , Thinh Nguyen , Greg Kroah-Hartman , Rob Herring , Mark Rutland , "Felipe Balbi" , "Claus H. Stovgaard" CC: "linux-usb@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "v.anuragkumar@gmail.com" Subject: Re: [PATCH v2 3/3] usb: dwc3: gadget: Add support for disabling U1 and U2 entries Thread-Topic: [PATCH v2 3/3] usb: dwc3: gadget: Add support for disabling U1 and U2 entries Thread-Index: AQHVBXNg9QMnfODDx0qS+2/7kcKJQQ== Date: Tue, 14 May 2019 21:40:50 +0000 Message-ID: <30102591E157244384E984126FC3CB4F639F7681@us01wembx1.internal.synopsys.com> References: <1557302091-7455-1-git-send-email-anurag.kumar.vulisha@xilinx.com> <1557302091-7455-4-git-send-email-anurag.kumar.vulisha@xilinx.com> <30102591E157244384E984126FC3CB4F639E9823@us01wembx1.internal.synopsys.com> <30102591E157244384E984126FC3CB4F639E9E8F@us01wembx1.internal.synopsys.com> <30102591E157244384E984126FC3CB4F639EA444@us01wembx1.internal.synopsys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.184.19] 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= Anurag Kumar Vulisha wrote:=0A= > Hi Thinh,=0A= >=0A= >> -----Original Message-----=0A= >> From: Thinh Nguyen [mailto:Thinh.Nguyen@synopsys.com]=0A= >> Sent: Saturday, May 11, 2019 7:18 AM=0A= >> To: Anurag Kumar Vulisha ; Thinh Nguyen=0A= >> ; Greg Kroah-Hartman=0A= >> ; Rob Herring ; Mark Rut= land=0A= >> ; Felipe Balbi ; Claus H. Stovga= ard=0A= >> =0A= >> Cc: linux-usb@vger.kernel.org; devicetree@vger.kernel.org; linux-=0A= >> kernel@vger.kernel.org; v.anuragkumar@gmail.com=0A= >> Subject: Re: [PATCH v2 3/3] usb: dwc3: gadget: Add support for disabling= U1 and U2=0A= >> entries=0A= >>=0A= >> Hi,=0A= >>=0A= >> Anurag Kumar Vulisha wrote:=0A= >>> Hi Thinh,=0A= >>>=0A= >>>> -----Original Message-----=0A= >>>> From: Thinh Nguyen [mailto:Thinh.Nguyen@synopsys.com]=0A= >>>> Sent: Friday, May 10, 2019 5:30 AM=0A= >>>> To: Anurag Kumar Vulisha ; Thinh Nguyen=0A= >>>> ; Greg Kroah-Hartman=0A= >>>> ; Rob Herring ; Mark R= utland=0A= >>>> ; Felipe Balbi ; Claus H. Stov= gaard=0A= >>>> =0A= >>>> Cc: linux-usb@vger.kernel.org; devicetree@vger.kernel.org; linux-=0A= >>>> kernel@vger.kernel.org; v.anuragkumar@gmail.com=0A= >>>> Subject: Re: [PATCH v2 3/3] usb: dwc3: gadget: Add support for disabli= ng U1 and=0A= >> U2=0A= >>>> entries=0A= >>>>=0A= >>>> Hi Anurag,=0A= >>>>=0A= >>>> Anurag Kumar Vulisha wrote:=0A= >>>>>>> + return -EINVAL;=0A= >>>>>>>=0A= >>>>>>> reg =3D dwc3_readl(dwc->regs, DWC3_DCTL);=0A= >>>>>>> if (set)=0A= >>>>>>> @@ -626,7 +630,10 @@ static int dwc3_ep0_set_config(struct dwc3 *dw= c,=0A= >>>> struct=0A= >>>>>>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c= =0A= >>>>>>> index e293400..f2d3112 100644=0A= >>>>>>> --- a/drivers/usb/dwc3/gadget.c=0A= >>>>>>> +++ b/drivers/usb/dwc3/gadget.c=0A= >>>>>>> @@ -2073,6 +2073,24 @@ static int dwc3_gadget_stop(struct usb_gadge= t *g)=0A= >>>>>>> return 0;=0A= >>>>>>> }=0A= >>>>>>>=0A= >>>>>>> +static void dwc3_gadget_config_params(struct usb_gadget *g,=0A= >>>>>>> + struct usb_dcd_config_params *params)=0A= >>>>>>> +{=0A= >>>>>>> + struct dwc3 *dwc =3D gadget_to_dwc(g);=0A= >>>>>>> +=0A= >>>>>>> + /* U1 Device exit Latency */=0A= >>>>>>> + if (dwc->dis_u1_entry_quirk)=0A= >>>>>>> + params->bU1devExitLat =3D 0;=0A= >>>>>> It doesn't make sense to have exit latency of 0. Rejecting=0A= >>>>>> SET_FEATURE(enable U1/U2) should already let the host know that the= =0A= >>>>>> device doesn't support U1/U2.=0A= >>>>>>=0A= >>>>> I am okay to remove this, but I feel that it is better to report zero= value instead=0A= >>>>> of a non-zero value in exit latency of BOS when U1 or U2 entries are = not=0A= >> supported.=0A= >>>>> Advantage of reporting 0 is that some hosts doesn't even send=0A= >>>> SET_FEATURE(U1/U2)=0A= >>>>> requests on seeing zero value in BOS descriptor. Also there can be ca= ses where=0A= >> U1 is=0A= >>>>> disabled and U2 entry is allowed or vice versa, for these kind of cas= es the driver=0A= >> can=0A= >>>>> set zero exit latency value for U1 and non-zero exit latency value fo= r U2 . Based=0A= >> on=0A= >>>> this=0A= >>>>> I think it would be better to report 0 when U1/U2 states are not enab= led. Please=0A= >>>> provide=0A= >>>>> your opinion on this.=0A= >>>> Hm... I assume you're testing against linux usb stack and xhci host. I= f=0A= >>>> that's the case, it looks like host will still request the device to= =0A= >>>> enter U1/U2 despite the device rejecting SET_FEATURE(enable U1/U2). Th= is=0A= >>>> needs to be fixed. I think what you have is fine to workaround this is= sue.=0A= >>> Thanks . Will send the next series with the other fixes that you have s= uggested=0A= >>>=0A= >>> Best Regards,=0A= >>> Anurag Kumar Vulisha=0A= >>>=0A= >> I want to try something. Can you see if this helps with your performance= =0A= >> test without setting the U1/U2 exit latency to 0?=0A= >> (No need to change what you have in your patch. This is just for testing= ).=0A= >>=0A= > With your patch , the link doesn't enter into U1/U2 and I am also getting= =0A= > better performance=0A= >=0A= > Thanks,=0A= > Anurag Kumar Vulisha=0A= =0A= Thanks for testing.=0A= =0A= BR,=0A= Thinh=0A=