lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d308300f-2559-4d13-8d15-5a2416ac00c9@oss.qualcomm.com>
Date: Tue, 21 Jan 2025 22:19:08 +0530
From: Prashanth K <prashanth.k@....qualcomm.com>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Simona Vetter <simona.vetter@...ll.ch>, Takashi Iwai <tiwai@...e.de>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: gadget: Increase the limit of USB_GADGET_VBUS_DRAW
 to 900mA



On 21-01-25 08:36 pm, Alan Stern wrote:
> On Tue, Jan 21, 2025 at 09:50:08AM +0530, Prashanth K wrote:
>>
>>
>> On 20-01-25 08:17 pm, Alan Stern wrote:
>>> On Mon, Jan 20, 2025 at 04:47:02PM +0530, Prashanth K wrote:
>>>> Currently CONFIG_USB_GADGET_VBUS_DRAW limits the maximum current
>>>> drawn from Vbus to be up to 500mA. However USB gadget operating
>>>> in SuperSpeed or higher can draw up to 900mA. Also, MaxPower in
>>>> ConfigFS takes its default value from this config. Hence increase
>>>> the allowed range of CONFIG_USB_GADGET_VBUS_DRAW to 900mA.
>>>
>>> Is this the sort of thing that really needs to be a Kconfig option?  Why 
>>> not make the decision at runtime, based on the needs of the gadget or 
>>> function drivers and the connection speed?
>>>
>>> Alan Stern
>>>
>>
>> Right, set_config() in composite.c does this in runtime based on the
>> values of MaxPower (from configFS), VBUS_DRAW defconfig and speed.
>> If we don't set MaxPower from configFS, this config helps to set it
>> during compile time. In fact MaxPower in configFS takes its default
>> value from CONFIG_USB_GADGET_VBUS_DRAW . Sent this patch because Kconfig
>> has this limitation where it's only allowing values upto 500mA.
> 
> Why does MaxPower need to be set at compile time?  Why not set it at 
> runtime instead?
> 
> If MaxPower gets set at runtime then it can take its default value to be 
> 500 mA or 900 mA depending on the connection speed.  There will be no 
> need for CONFIG_USB_GAGDGET_VBUS_DRAW.
> 

Yes, agreed. Can we mark CONFIG_USB_GAGDGET_VBUS_DRAW as legacy and
maybe also avoid configfs/composite from using it?

> You are trying to improve a compile-time limitation on a quantity which 
> isn't known until runtime.  The whole idea of doing it that way is 
> fundamentally wrong.  You shouldn't try to improve it a little, you 
> should fix the basic mistake by doing everything at runtime.
> 
> Alan Stern
> 
Regards,
Prashanth K


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ