linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anurag Kumar Vulisha <anuragku@xilinx.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Felipe Balbi <balbi@kernel.org>,
	"Claus H. Stovgaard" <cst@phaseone.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"v.anuragkumar@gmail.com" <v.anuragkumar@gmail.com>
Subject: RE: [PATCH v2 3/3] usb: dwc3: gadget: Add support for disabling U1 and U2 entries
Date: Mon, 13 May 2019 14:15:07 +0000	[thread overview]
Message-ID: <BYAPR02MB5591B928413B5118142841BDA70F0@BYAPR02MB5591.namprd02.prod.outlook.com> (raw)
In-Reply-To: <30102591E157244384E984126FC3CB4F639EA444@us01wembx1.internal.synopsys.com>

Hi Thinh,

>-----Original Message-----
>From: Thinh Nguyen [mailto:Thinh.Nguyen@synopsys.com]
>Sent: Saturday, May 11, 2019 7:18 AM
>To: Anurag Kumar Vulisha <anuragku@xilinx.com>; Thinh Nguyen
><Thinh.Nguyen@synopsys.com>; Greg Kroah-Hartman
><gregkh@linuxfoundation.org>; Rob Herring <robh+dt@kernel.org>; Mark Rutland
><mark.rutland@arm.com>; Felipe Balbi <balbi@kernel.org>; Claus H. Stovgaard
><cst@phaseone.com>
>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
>
>Hi,
>
>Anurag Kumar Vulisha wrote:
>> Hi Thinh,
>>
>>> -----Original Message-----
>>> From: Thinh Nguyen [mailto:Thinh.Nguyen@synopsys.com]
>>> Sent: Friday, May 10, 2019 5:30 AM
>>> To: Anurag Kumar Vulisha <anuragku@xilinx.com>; Thinh Nguyen
>>> <Thinh.Nguyen@synopsys.com>; Greg Kroah-Hartman
>>> <gregkh@linuxfoundation.org>; Rob Herring <robh+dt@kernel.org>; Mark Rutland
>>> <mark.rutland@arm.com>; Felipe Balbi <balbi@kernel.org>; Claus H. Stovgaard
>>> <cst@phaseone.com>
>>> 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
>>>
>>> Hi Anurag,
>>>
>>> Anurag Kumar Vulisha wrote:
>>>>>> +		return -EINVAL;
>>>>>>
>>>>>>  	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
>>>>>>  	if (set)
>>>>>> @@ -626,7 +630,10 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc,
>>> struct
>>>>>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
>>>>>> index e293400..f2d3112 100644
>>>>>> --- a/drivers/usb/dwc3/gadget.c
>>>>>> +++ b/drivers/usb/dwc3/gadget.c
>>>>>> @@ -2073,6 +2073,24 @@ static int dwc3_gadget_stop(struct usb_gadget *g)
>>>>>>  	return 0;
>>>>>>  }
>>>>>>
>>>>>> +static void dwc3_gadget_config_params(struct usb_gadget *g,
>>>>>> +				      struct usb_dcd_config_params *params)
>>>>>> +{
>>>>>> +	struct dwc3		*dwc = gadget_to_dwc(g);
>>>>>> +
>>>>>> +	/* U1 Device exit Latency */
>>>>>> +	if (dwc->dis_u1_entry_quirk)
>>>>>> +		params->bU1devExitLat = 0;
>>>>> It doesn't make sense to have exit latency of 0. Rejecting
>>>>> SET_FEATURE(enable U1/U2) should already let the host know that the
>>>>> device doesn't support U1/U2.
>>>>>
>>>> I am okay to remove this, but I feel that it is better to report zero value instead
>>>> of a non-zero value in exit latency of BOS when U1 or U2 entries are not
>supported.
>>>> Advantage of reporting 0 is that some hosts doesn't even send
>>> SET_FEATURE(U1/U2)
>>>> requests on seeing zero value in BOS descriptor. Also there can be cases where
>U1 is
>>>> disabled and U2 entry is allowed or vice versa, for these kind of cases the driver
>can
>>>> set zero exit latency value for U1 and non-zero exit latency value for U2 . Based
>on
>>> this
>>>> I think it would be better to report 0 when U1/U2 states are not enabled. Please
>>> provide
>>>> your opinion on this.
>>> Hm... I assume you're testing against linux usb stack and xhci host. If
>>> that's the case, it looks like host will still request the device to
>>> enter U1/U2 despite the device rejecting SET_FEATURE(enable U1/U2). This
>>> needs to be fixed. I think what you have is fine to workaround this issue.
>> Thanks . Will send the next series with the other fixes that you have suggested
>>
>> Best Regards,
>> Anurag Kumar Vulisha
>>
>
>I want to try something. Can you see if this helps with your performance
>test without setting the U1/U2 exit latency to 0?
>(No need to change what you have in your patch. This is just for testing).
>

With your patch , the link doesn't enter into U1/U2 and I am also getting
better performance

Thanks,
Anurag Kumar Vulisha

>diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
>index 2f94568ba385..619351c581cf 100644
>--- a/drivers/usb/core/hub.c
>+++ b/drivers/usb/core/hub.c
>@@ -4057,8 +4057,18 @@ static void usb_enable_link_state(struct usb_hcd
>*hcd, struct usb_device *udev,
>                /* Only a configured device will accept the Set Feature
>                 * U1/U2_ENABLE
>                 */
>-               if (udev->actconfig)
>-                       usb_set_device_initiated_lpm(udev, state, true);
>+               if (udev->actconfig) {
>+                       if (usb_set_device_initiated_lpm(udev, state,
>true)) {
>+                               /*
>+                                * Don't request U1/U2 entry if the device
>+                                * cannot enable U1/U2.
>+                                */
>+                               usb_set_lpm_timeout(udev, state, 0);
>+
>hcd->driver->disable_usb3_lpm_timeout(hcd, udev,
>+
>state);
>+                               return;
>+                       }
>+               }
>
>                /* As soon as usb_set_lpm_timeout(timeout) returns 0, the
>                 * hub-initiated LPM is enabled. Thus, LPM is enabled no
>
>

  reply	other threads:[~2019-05-13 14:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08  7:54 [PATCH v2 0/3] usb: gadget: Add support for disabling U1 and U2 entries Anurag Kumar Vulisha
2019-05-08  7:54 ` [PATCH v2 1/3] doc: dt: bindings: usb: dwc3: Update entries for disabling U1 and U2 Anurag Kumar Vulisha
2019-05-08  7:54 ` [PATCH v2 2/3] usb: gadget: send usb_gadget as an argument in get_config_params Anurag Kumar Vulisha
2019-05-08  7:54 ` [PATCH v2 3/3] usb: dwc3: gadget: Add support for disabling U1 and U2 entries Anurag Kumar Vulisha
2019-05-08 19:33   ` Thinh Nguyen
2019-05-09  7:33     ` Anurag Kumar Vulisha
2019-05-09 23:59       ` Thinh Nguyen
2019-05-10  6:58         ` Anurag Kumar Vulisha
2019-05-11  1:48           ` Thinh Nguyen
2019-05-13 14:15             ` Anurag Kumar Vulisha [this message]
2019-05-14 21:40               ` Thinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR02MB5591B928413B5118142841BDA70F0@BYAPR02MB5591.namprd02.prod.outlook.com \
    --to=anuragku@xilinx.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=cst@phaseone.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=v.anuragkumar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).