mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Joel Stanley <joel@jms.id.au>, linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [RFC PATCH] xhci: do not halt the secondary HCD
Date: Mon, 19 Sep 2016 13:22:46 +0300	[thread overview]
Message-ID: <e489f36b-81ce-747b-7dd4-475dee62fdf3@cogentembedded.com> (raw)
In-Reply-To: <20160919063545.2055-1-joel@jms.id.au>

Hello.

On 9/19/2016 9:35 AM, Joel Stanley wrote:

> We can't halt the secondary HCD, because it's also the primary HCD,
> which will cause problems if we have devices attached to the primary
> HCD, like a keyboard.
>
> We've been carrying this in our Linux-as-a-bootloader environment for a little
> while now. The machines all have the same TI TUSB73x0 part, and when we kexec
> the devices don't come back until a system power cycle.
>
> I'd like some advice on an acceptable way to upstream the fix, so that the xhci
> device survives kexec.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  drivers/usb/host/xhci.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index adc169d2fd76..ec92a843325b 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -682,6 +682,21 @@ void xhci_stop(struct usb_hcd *hcd)
>
>  	mutex_lock(&xhci->mutex);
>
> +	/*
> +	 * We can't halt the secondary HCD, because it's also the primary
> +	 * HCD, which will cause problems if we have devices attached to the
> +	 * primary HCD, like a keyboard.
> +	 */
> +	if (!usb_hcd_is_primary_hcd(hcd)) {
> +		/* The shared_hcd is going to be deallocated shortly (the USB
> +		 * core only calls this function when allocation fails in
> +		 * usb_add_hcd(), or usb_remove_hcd() is called).  So we need
> +		 * to unset xHCI's pointer.  */

    Please format this comment the same way as the comment above it.

> +		xhci->shared_hcd = NULL;
> +		mutex_unlock(&xhci->mutex);
> +		return;
> +	}
> +
>  	if (!(xhci->xhc_state & XHCI_STATE_HALTED)) {
>  		spin_lock_irq(&xhci->lock);
>
[...]

MBR, Sergei

      parent reply	other threads:[~2016-09-19 10:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19  6:35 Joel Stanley
2016-09-19  7:03 ` Greg KH
2016-09-19  7:41 ` Mathias Nyman
2016-09-19  8:23   ` Joel Stanley
2016-09-20  8:26     ` Mathias Nyman
2016-10-26  4:27       ` Joel Stanley
2016-09-19 10:22 ` Sergei Shtylyov [this message]

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=e489f36b-81ce-747b-7dd4-475dee62fdf3@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®