Skip to content

Commit

Permalink
usb/early: Add driver for xhci debug capability
Browse files Browse the repository at this point in the history
XHCI debug capability (DbC) is an optional but standalone
functionality provided by an xHCI host controller. Software
learns this capability by walking through the extended
capability list of the host. XHCI specification describes
DbC in section 7.6.

This patch introduces the code to probe and initialize the
debug capability hardware during early boot. With hardware
initialized, the debug target (system on which this code is
running) will present a debug device through the debug port
(normally the first USB3 port). The debug device is fully
compliant with the USB framework and provides the equivalent
of a very high performance (USB3) full-duplex serial link
between the debug host and target. The DbC functionality is
independent of the xHCI host. There isn't any precondition
from the xHCI host side for the DbC to work.

One use for this feature is kernel debugging, for example
when your machine crashes very early before the regular
console code is initialized. Other uses include simpler,
lockless logging instead of a full-blown printk console
driver and klogd.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-usb@vger.kernel.org
Link: http://lkml.kernel.org/r/1490083293-3792-3-git-send-email-baolu.lu@linux.intel.com
[ Small fix to the Kconfig help text. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Lu Baolu authored and Ingo Molnar committed Mar 21, 2017
1 parent dd759d9 commit aeb9dd1
Show file tree
Hide file tree
Showing 6 changed files with 1,281 additions and 3 deletions.
27 changes: 25 additions & 2 deletions arch/x86/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ config TRACE_IRQFLAGS_SUPPORT

source "lib/Kconfig.debug"

config EARLY_PRINTK_USB
bool

config X86_VERBOSE_BOOTUP
bool "Enable verbose x86 bootup info messages"
default y
Expand All @@ -23,19 +26,20 @@ config EARLY_PRINTK
This is useful for kernel debugging when your machine crashes very
early before the console code is initialized. For normal operation
it is not recommended because it looks ugly and doesn't cooperate
with klogd/syslogd or the X server. You should normally N here,
with klogd/syslogd or the X server. You should normally say N here,
unless you want to debug such a crash.

config EARLY_PRINTK_DBGP
bool "Early printk via EHCI debug port"
depends on EARLY_PRINTK && PCI
select EARLY_PRINTK_USB
---help---
Write kernel log output directly into the EHCI debug port.

This is useful for kernel debugging when your machine crashes very
early before the console code is initialized. For normal operation
it is not recommended because it looks ugly and doesn't cooperate
with klogd/syslogd or the X server. You should normally N here,
with klogd/syslogd or the X server. You should normally say N here,
unless you want to debug such a crash. You need usb debug device.

config EARLY_PRINTK_EFI
Expand All @@ -48,6 +52,25 @@ config EARLY_PRINTK_EFI
This is useful for kernel debugging when your machine crashes very
early before the console code is initialized.

config EARLY_PRINTK_USB_XDBC
bool "Early printk via the xHCI debug port"
depends on EARLY_PRINTK && PCI
select EARLY_PRINTK_USB
---help---
Write kernel log output directly into the xHCI debug port.

One use for this feature is kernel debugging, for example when your
machine crashes very early before the regular console code is
initialized. Other uses include simpler, lockless logging instead of
a full-blown printk console driver + klogd.

For normal production environments this is normally not recommended,
because it doesn't feed events into klogd/syslogd and doesn't try to
print anything on the screen.

You should normally say N here, unless you want to debug early
crashes or need a very simple printk logging facility.

config X86_PTDUMP_CORE
def_bool n

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/
obj-$(CONFIG_USB_SERIAL) += serial/

obj-$(CONFIG_USB) += misc/
obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/
obj-$(CONFIG_EARLY_PRINTK_USB) += early/

obj-$(CONFIG_USB_ATM) += atm/
obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/early/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
#

obj-$(CONFIG_EARLY_PRINTK_DBGP) += ehci-dbgp.o
obj-$(CONFIG_EARLY_PRINTK_USB_XDBC) += xhci-dbc.o
Loading

0 comments on commit aeb9dd1

Please sign in to comment.