Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2448542yba; Mon, 6 May 2019 06:20:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqz11SEr/vYjlZhm2n2vip9G3SOF5QhroCycoovzuJxHJblHqYtdf95NJfODVQVcl516MddN X-Received: by 2002:a65:5c4a:: with SMTP id v10mr24633556pgr.359.1557148838042; Mon, 06 May 2019 06:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557148838; cv=none; d=google.com; s=arc-20160816; b=AEuhSExO5cvEDzD8pg3y6lpFJooRuKH4U+Q3FvO9+fK+TT3MMlxOjXRrvLbLLhviPt B90dmf8kXKbc1rR+W1FVoE7c3jRLWH5VUw3XRIQOZE873xUdrjeYxNBeX5Fg1gy3bMnT IVtij2FRQ+lXcZYirjXwFSy0qXSihqE5R3fXnQioLJgYfXaqr/4FbyBD9d6bzjbybdOG 0wbPxeGLruRfsPDj/XsFyelePvP98dpSWx/0JKip+zTXhBWE+55z/VTL7QpaHl2N9yhu DJQyKYI91KTdA7BAMQKXicYgKTMQfwoumlhm1OSPnSwG2CZLU9kvIV9Pro4QgDN4gLUo P5gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=IRmwsW8gEb7lt7gIqM7MoTBt1aLtDm/KsSblhlrXT/U=; b=AUxJYqbEmfAUmdN/qjIyFncD23te84NIpJ113HgQ4rFM1aGRbOFEwDahrisYhTqbbd VlnE1VJyxfBqUAwYUHcMw5vXCcYK034DZY3b4OmJOOT7tvQ+2UGQDrGfvRuBpTdceUbz 3AeHdog2KkoS6tnDKDWSiE+Mlv8ewJgZgj79VK9GzT0y9Bthi3PKH1TovqzDojtFTkRa TEnlvXxlJc1lYQgc1MmLcq9REzn/byj1+J89N0C6+Je9R694PyCzSMde/H8E25KviOuQ pgMbOgTPGS5e5muVxJ4vP/+Z3aN/SSTp9dttfWTzgY/CeeF3ohvjZErXIHftUGWC8VaN BD9w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r14si16353165pgf.45.2019.05.06.06.20.21; Mon, 06 May 2019 06:20:38 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726249AbfEFNTV (ORCPT + 99 others); Mon, 6 May 2019 09:19:21 -0400 Received: from mga12.intel.com ([192.55.52.136]:46398 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725853AbfEFNTV (ORCPT ); Mon, 6 May 2019 09:19:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 May 2019 06:19:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,438,1549958400"; d="scan'208";a="155548586" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.164]) ([10.237.72.164]) by FMSMGA003.fm.intel.com with ESMTP; 06 May 2019 06:19:18 -0700 Subject: Re: [PATCH 1/2] usb: xhci: Make it possible to not have a secondary HCD (3.0) To: Nicolas Boichat , Greg Kroah-Hartman Cc: Mathias Nyman , Matthias Brugger , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Khuong Dinh , Hoan Tran References: <20190502045631.229386-1-drinkcat@chromium.org> From: Mathias Nyman Message-ID: <6844539f-3d5e-e3ff-b498-390cdc731880@linux.intel.com> Date: Mon, 6 May 2019 16:21:53 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190502045631.229386-1-drinkcat@chromium.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2.5.2019 7.56, Nicolas Boichat wrote: > Some XHCI controllers may not have any USB 3.0 port, in this case, it > is not useful to create add hcd->shared_hcd, which has 2 main > downsides: > - A useless USB 3.0 root hub is created. > - A warning is thrown on boot: > hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19) > > The change is mostly about checking if hcd->shared_hcd is NULL before > accessing it. The one special case is in xhci_run, where we need to > call xhci_run_finished immediately, if there is no secondary hcd. To me it looks like this creates an controller starting issue for xHC hardware that have both usb2 and usb3 ports. When we have usb3 ports xhci->shared_hcd is not set yet when xhci_run is called the first time. We will end up starting the xHC before properly setting up the secondary hcd. See further down for details > > Signed-off-by: Nicolas Boichat > --- > > This is a respin of https://lore.kernel.org/patchwork/patch/863993/, > hopefully addressing the comments there. Note that I dropped the change > in xhci-plat.c, as I do not have a device to test it, but made a > similar change in xhci-mtk.c, in the next patch. > > (the @apm.com addresses seem to bounce, so I added some > @amperecomputing.com instead, if somebody there can track back the > original issue, I'm happy to provide a patch for xhci-plat.c as well) > > drivers/usb/host/xhci-hub.c | 7 ++++-- > drivers/usb/host/xhci.c | 45 +++++++++++++++++++++++++++---------- > 2 files changed, 38 insertions(+), 14 deletions(-) > ... > @@ -698,6 +703,10 @@ int xhci_run(struct usb_hcd *hcd) > > xhci_debugfs_init(xhci); > > + /* There is no secondary HCD, start the host controller immediately. */ > + if (!xhci->shared_hcd) > + return xhci_run_finished(xhci); > + PCI xHC controllers with both usb2 and usb3 ports will be started before usb3 parts are properly set up. xhci_pci_probe() usb_hcd_pci_probe() usb_add_hcd() hcd->driver->start(hcd) // .start = xhci_run xhci_run() if (!xhci->shared_hcd) // TRUE as xhci->shared_hcd is not yet set, return xhci_run_finished(xhci) // starting controller too early here xhci->shared_hcd = usb_create_shared_hcd() // now xhci->shared_hcd is set. -Mathias