From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Nicolas Boichat <drinkcat@chromium.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Khuong Dinh <khuong@os.amperecomputing.com>,
Hoan Tran <hoan@os.amperecomputing.com>
Subject: Re: [PATCH 1/2] usb: xhci: Make it possible to not have a secondary HCD (3.0)
Date: Mon, 6 May 2019 16:21:53 +0300 [thread overview]
Message-ID: <6844539f-3d5e-e3ff-b498-390cdc731880@linux.intel.com> (raw)
In-Reply-To: <20190502045631.229386-1-drinkcat@chromium.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 <drinkcat@chromium.org>
> ---
>
> 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
next prev parent reply other threads:[~2019-05-06 13:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-02 4:56 [PATCH 1/2] usb: xhci: Make it possible to not have a secondary HCD (3.0) Nicolas Boichat
2019-05-02 4:56 ` [PATCH 2/2] usb: xhci-mtk: Do not create shared_hcd if no USB 3.0 port available Nicolas Boichat
2019-05-07 7:37 ` Chunfeng Yun
2019-05-06 13:21 ` Mathias Nyman [this message]
2019-05-08 1:17 ` [PATCH 1/2] usb: xhci: Make it possible to not have a secondary HCD (3.0) Nicolas Boichat
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=6844539f-3d5e-e3ff-b498-390cdc731880@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=drinkcat@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=hoan@os.amperecomputing.com \
--cc=khuong@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=matthias.bgg@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