Skip to content

Commit aeb9dd1

Browse files
LuBaoluingomolnar
authored andcommitted
usb/early: Add driver for xhci debug capability
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 <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mathias Nyman <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] [ Small fix to the Kconfig help text. ] Signed-off-by: Ingo Molnar <[email protected]>
1 parent dd759d9 commit aeb9dd1

6 files changed

Lines changed: 1281 additions & 3 deletions

File tree

arch/x86/Kconfig.debug

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ config TRACE_IRQFLAGS_SUPPORT
55

66
source "lib/Kconfig.debug"
77

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

2932
config EARLY_PRINTK_DBGP
3033
bool "Early printk via EHCI debug port"
3134
depends on EARLY_PRINTK && PCI
35+
select EARLY_PRINTK_USB
3236
---help---
3337
Write kernel log output directly into the EHCI debug port.
3438

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

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

55+
config EARLY_PRINTK_USB_XDBC
56+
bool "Early printk via the xHCI debug port"
57+
depends on EARLY_PRINTK && PCI
58+
select EARLY_PRINTK_USB
59+
---help---
60+
Write kernel log output directly into the xHCI debug port.
61+
62+
One use for this feature is kernel debugging, for example when your
63+
machine crashes very early before the regular console code is
64+
initialized. Other uses include simpler, lockless logging instead of
65+
a full-blown printk console driver + klogd.
66+
67+
For normal production environments this is normally not recommended,
68+
because it doesn't feed events into klogd/syslogd and doesn't try to
69+
print anything on the screen.
70+
71+
You should normally say N here, unless you want to debug early
72+
crashes or need a very simple printk logging facility.
73+
5174
config X86_PTDUMP_CORE
5275
def_bool n
5376

drivers/usb/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/
4949
obj-$(CONFIG_USB_SERIAL) += serial/
5050

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

5454
obj-$(CONFIG_USB_ATM) += atm/
5555
obj-$(CONFIG_USB_SPEEDTOUCH) += atm/

drivers/usb/early/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
#
44

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

0 commit comments

Comments
 (0)