Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3087711pxb; Fri, 5 Nov 2021 09:32:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu7XkItvh/W+xbvd6Pv1GlGNGkq7hWMof+naBfnaJjI8U21JwOt5f7QE/hICyndCTARC0O X-Received: by 2002:a5d:85d8:: with SMTP id e24mr145049ios.109.1636129933649; Fri, 05 Nov 2021 09:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636129933; cv=none; d=google.com; s=arc-20160816; b=ZaYRurcYim2QwlEr8dMdhcEFlIsWB4Md8V+stI7PIWGCJZxo84NbuOmRohqAFc6NT5 +atFaV2c3bEcb9aiYr9Ibu9vHZEUK8Zmv8Pl8K/KCEJSFCxskoigX23ObzfZUsfPd+3o culc0r6bcCn1sQmOKGfiw2RO+R3w4sX7mnmS5qY1PnCAamiXKfBH/RssNJ7FblBaz/LC Yc/TMIREJTQ0kOSlargM9X3lKXtBage4/MgBneP72H1VsWkjy0EFboR5xWlvI+gMNM/D TVw5G83F06esvZKbMhGps7pb6VR/pDV6EwwxzqGtQ56vDTlWVHflPD8YvKBuJIjGthSa bAQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=86zxGl4tsJRSGSOl3xbOf+I4bdGdmsWF8SI4OhgHGvk=; b=czZX3Ky7tYdUEfr0z9P2B28Gmg7XDdA/i9JfQPIf8StzvNsYITdc6o/QRz8XGm5J+G 1y3irZ6hFB7jTkdF8HFM3cDHm9IyozyfuJHJ6ZHUF4ttNgbX1A8uN7reGbeNV40daApc d9by2G+JtZH8wCACRVWyNebwXRoTQMSIBqiHF1FL4fqmVUkWnGNJ1eijCMQl9sSVvD5e lPJwwDebJhnPDpXNebjG+w8B4G0MJcSEiP4szpue6VKDLiZSetfbmCRBBA/YnIaMSLHu eggQd7HQs0V9EPza0lARJY/8lV+W5LaL1Jji9IdAZ35BpLw/MxARgSikVgcW7Laabmfp hspw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n13si16467100ili.16.2021.11.05.09.31.56; Fri, 05 Nov 2021 09:32:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232861AbhKENdb (ORCPT + 99 others); Fri, 5 Nov 2021 09:33:31 -0400 Received: from netrider.rowland.org ([192.131.102.5]:35359 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S232832AbhKENda (ORCPT ); Fri, 5 Nov 2021 09:33:30 -0400 Received: (qmail 1591166 invoked by uid 1000); 5 Nov 2021 09:30:50 -0400 Date: Fri, 5 Nov 2021 09:30:50 -0400 From: Alan Stern To: Greg Kroah-Hartman Cc: Mathias Nyman , "Walt Jr. Brake" , Mathias Nyman , Chunfeng Yun , Matthias Brugger , Nishad Kamdar , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Eddie Hung Subject: Re: [PATCH v2] usb: core: reduce power-on-good delay time of root hub Message-ID: <20211105133050.GA1590803@rowland.harvard.edu> References: <1618017645-12259-1-git-send-email-chunfeng.yun@mediatek.com> <5e907ccd-40bb-2ece-fe05-1a65a74f3aa2@gmail.com> <20211101140613.GC1456700@rowland.harvard.edu> <3cf46eaf-5443-30df-6d72-b92a6a518afc@linux.intel.com> <62d0ac30-f2b9-f58c-cb1e-215ccb455753@gmail.com> <13d55059-9f66-8599-54fc-46698bae41d1@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 05, 2021 at 11:00:31AM +0100, Greg Kroah-Hartman wrote: > On Wed, Nov 03, 2021 at 10:37:33PM +0200, Mathias Nyman wrote: > > On 2.11.2021 22.29, Walt Jr. Brake wrote: > > > On 2/11/2021 17:05, Mathias Nyman wrote: > > >> 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 > > > > > > Mathias: > > > > > > Sorry to reply lately. I test with your patch, it works. > > > > > > I also test with setting bPwrOn2PwrGood to 45, and it not work. > > > > > > Seems that the minimal value should be 50 for this case. > > > > > > > Thanks for testing, and for checking that 90ms wait isn't enough > > Can you send a "real" patch for this so I can get it into the tree soon > to resolve the regression? Also, it might make sense to move the desc->bPwrOn2PwrGood setting from xhci_common_hub_descriptor into the speed-specific routines. For the USB-2 root hub the value can remain set to 10; only the USB-3 root hub needs to be changed. Alan Stern