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]
Date:   Tue, 2 Nov 2021 11:05:10 +0200
From:   Mathias Nyman <mathias.nyman@...ux.intel.com>
To:     Alan Stern <stern@...land.harvard.edu>,
        Mathias Nyman <mathias.nyman@...el.com>,
        "Walt Jr. Brake" <mr.yming81@...il.com>
Cc:     Chunfeng Yun <chunfeng.yun@...iatek.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Nishad Kamdar <nishadkamdar@...il.com>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org,
        Eddie Hung <eddie.hung@...iatek.com>
Subject: Re: [PATCH v2] usb: core: reduce power-on-good delay time of root hub

On 1.11.2021 16.06, Alan Stern wrote:
> On Sat, Oct 30, 2021 at 12:49:37PM +0800, Walt Jr. Brake wrote:
>> This patch make USB 3.1 device cannot be detected, and I report the bug [1]
>> to archlinux three month ago. Yesterday I try to fix it myself, and after I
>> revert this patch, compile the kernel and test, it works.
>>
>> [1] https://bugs.archlinux.org/task/71660?project=1&pagenum=2
>>
>>
>> diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
>> index 22ea1f4f2d66..73f4482d833a 100644
>> --- a/drivers/usb/core/hub.h
>> +++ b/drivers/usb/core/hub.h
>> @@ -148,10 +148,8 @@ static inline unsigned hub_power_on_good_delay(struct
>> usb_hub *hub)
>>  {
>>         unsigned delay = hub->descriptor->bPwrOn2PwrGood * 2;
>>
>> -       if (!hub->hdev->parent) /* root hub */
>> -               return delay;
>> -       else /* Wait at least 100 msec for power to become stable */
>> -               return max(delay, 100U);
>> +       /* Wait at least 100 msec for power to become stable */
>> +       return max(delay, 100U);
>>  }
> 
> Mathias:
> 
> It looks like the bPwrOn2PwrGood value in xhci-hcd's hub descriptor is 
> too small for some USB 3.1 devices.
> 
> Can you look into this?
> 
> Alan Stern
> 

At first glance the xhci roothub bPwrOn2PwrGood value looks ok.
xhci spec 5.4.8 states software should wait 20ms after asserting PP, before
attempting to change the state of the port.

xhci driver sets desc->bPwrOn2PwrGood = 10; (2ms interval, so equals 20ms )

We should probably get this working immediately, so maybe revert that patch
while looking into the rootcause.

Walt Jr. Brake, instead of reverting that patch, could you test if changing the
xhci roothub bPwrOn2PwrGood value helps.

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index a3f875eea751..756231a55602 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -257,7 +257,7 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci,
 {
        u16 temp;
 
-       desc->bPwrOn2PwrGood = 10;      /* xhci section 5.4.9 says 20ms max */
+       desc->bPwrOn2PwrGood = 50;      /* The 20ms in xhci 5.4.8 isn't enough for USB 3.1 */
        desc->bHubContrCurrent = 0;
 
        desc->bNbrPorts = ports;

Thanks
-Mathias

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ