From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Ajay Gupta <ajaykuee@gmail.com>, mathias.nyman@intel.com
Cc: linux-usb@vger.kernel.org, Ajay Gupta <ajayg@nvidia.com>
Subject: Re: [PATCH] usb: xhci: enable interrupt only after xhci_start()
Date: Thu, 20 Feb 2020 15:18:50 +0200 [thread overview]
Message-ID: <85ae3a52-f968-ce02-af51-e4d2aa140f8b@linux.intel.com> (raw)
In-Reply-To: <20200218235024.15266-1-ajayg@nvidia.com>
On 19.2.2020 1.50, Ajay Gupta wrote:
> From: Ajay Gupta <ajayg@nvidia.com>
>
> Xhci interrupt must be enabled only after controller is
> initialized and started. Currently interrupt is enabled
> first in xhci_run() and later hcd state is set to running
> in xhci_run_finished().
>
> On a slow system (such as FPGA based platform) the time
> difference between enabling interrupt and setting the hcd
> state becomes huge enough where interrupt is triggered but
> controller initialization is not complete yet.
>
> Fixing the same by moving the interrupt enable (CMD_EIE)
> part of code snippet from xhci_run() to xhci_run_finished().
>
> Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
> ---
Sounds reasonable, but xHCI specs wants interrupts set and enabled before
xHC is running state.
I see this can be an issue if we get a port event for a USB 3 port before
the USB3 hcd is added.
What kind of issues did you see? I'd guess NULL pointer dereference in
handle_port_status()?.
We could move interrupt enabling to xhci_run_finished() before
xhci_start() is called, then the USB3 hcd should be initialized before
we receive interrupts.
Does that work for you?
Details:
xHCI section 4.2 "Host Controller Initialization" has the following sequence:
- Enable host system interrupt (CMD_EIE),
- Enable primary interupter (set IE bit in IMAN register)
- set run bit in USBCMD register.
And section 5.5.2 has a note:
"All registers of the Primary Interrupter shall be initialized before setting the
Run/Stop (RS) flag in the USBCMD register to ‘1’."
-Mathias
next prev parent reply other threads:[~2020-02-20 13:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-18 23:50 [PATCH] usb: xhci: enable interrupt only after xhci_start() Ajay Gupta
2020-02-20 13:18 ` Mathias Nyman [this message]
2020-02-20 18:01 ` Ajay Gupta
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=85ae3a52-f968-ce02-af51-e4d2aa140f8b@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=ajayg@nvidia.com \
--cc=ajaykuee@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.