xref: /linux/Documentation/trace/events-pci.rst (revision c17ee635fd3a482b2ad2bf5e269755c2eae5f25e)
1*8236fc61SShuai Xue.. SPDX-License-Identifier: GPL-2.0
2*8236fc61SShuai Xue
3*8236fc61SShuai Xue===========================
4*8236fc61SShuai XueSubsystem Trace Points: PCI
5*8236fc61SShuai Xue===========================
6*8236fc61SShuai Xue
7*8236fc61SShuai XueOverview
8*8236fc61SShuai Xue========
9*8236fc61SShuai XueThe PCI tracing system provides tracepoints to monitor critical hardware events
10*8236fc61SShuai Xuethat can impact system performance and reliability. These events normally show
11*8236fc61SShuai Xueup here:
12*8236fc61SShuai Xue
13*8236fc61SShuai Xue	/sys/kernel/tracing/events/pci
14*8236fc61SShuai Xue
15*8236fc61SShuai XueCf. include/trace/events/pci.h for the events definitions.
16*8236fc61SShuai Xue
17*8236fc61SShuai XueAvailable Tracepoints
18*8236fc61SShuai Xue=====================
19*8236fc61SShuai Xue
20*8236fc61SShuai Xuepci_hp_event
21*8236fc61SShuai Xue------------
22*8236fc61SShuai Xue
23*8236fc61SShuai XueMonitors PCI hotplug events including card insertion/removal and link
24*8236fc61SShuai Xuestate changes.
25*8236fc61SShuai Xue::
26*8236fc61SShuai Xue
27*8236fc61SShuai Xue    pci_hp_event  "%s slot:%s, event:%s\n"
28*8236fc61SShuai Xue
29*8236fc61SShuai Xue**Event Types**:
30*8236fc61SShuai Xue
31*8236fc61SShuai Xue* ``LINK_UP`` - PCIe link established
32*8236fc61SShuai Xue* ``LINK_DOWN`` - PCIe link lost
33*8236fc61SShuai Xue* ``CARD_PRESENT`` - Card detected in slot
34*8236fc61SShuai Xue* ``CARD_NOT_PRESENT`` - Card removed from slot
35*8236fc61SShuai Xue
36*8236fc61SShuai Xue**Example Usage**::
37*8236fc61SShuai Xue
38*8236fc61SShuai Xue    # Enable the tracepoint
39*8236fc61SShuai Xue    echo 1 > /sys/kernel/debug/tracing/events/pci/pci_hp_event/enable
40*8236fc61SShuai Xue
41*8236fc61SShuai Xue    # Monitor events (the following output is generated when a device is hotplugged)
42*8236fc61SShuai Xue    cat /sys/kernel/debug/tracing/trace_pipe
43*8236fc61SShuai Xue       irq/51-pciehp-88      [001] .....  1311.177459: pci_hp_event: 0000:00:02.0 slot:10, event:CARD_PRESENT
44*8236fc61SShuai Xue
45*8236fc61SShuai Xue       irq/51-pciehp-88      [001] .....  1311.177566: pci_hp_event: 0000:00:02.0 slot:10, event:LINK_UP
46*8236fc61SShuai Xue
47*8236fc61SShuai Xuepcie_link_event
48*8236fc61SShuai Xue---------------
49*8236fc61SShuai Xue
50*8236fc61SShuai XueMonitors PCIe link speed changes and provides detailed link status information.
51*8236fc61SShuai Xue::
52*8236fc61SShuai Xue
53*8236fc61SShuai Xue    pcie_link_event  "%s type:%d, reason:%d, cur_bus_speed:%d, max_bus_speed:%d, width:%u, flit_mode:%u, status:%s\n"
54*8236fc61SShuai Xue
55*8236fc61SShuai Xue**Parameters**:
56*8236fc61SShuai Xue
57*8236fc61SShuai Xue* ``type`` - PCIe device type (4=Root Port, etc.)
58*8236fc61SShuai Xue* ``reason`` - Reason for link change:
59*8236fc61SShuai Xue
60*8236fc61SShuai Xue  - ``0`` - Link retrain
61*8236fc61SShuai Xue  - ``1`` - Bus enumeration
62*8236fc61SShuai Xue  - ``2`` - Bandwidth notification enable
63*8236fc61SShuai Xue  - ``3`` - Bandwidth notification IRQ
64*8236fc61SShuai Xue  - ``4`` - Hotplug event
65*8236fc61SShuai Xue
66*8236fc61SShuai Xue
67*8236fc61SShuai Xue**Example Usage**::
68*8236fc61SShuai Xue
69*8236fc61SShuai Xue    # Enable the tracepoint
70*8236fc61SShuai Xue    echo 1 > /sys/kernel/debug/tracing/events/pci/pcie_link_event/enable
71*8236fc61SShuai Xue
72*8236fc61SShuai Xue    # Monitor events (the following output is generated when a device is hotplugged)
73*8236fc61SShuai Xue    cat /sys/kernel/debug/tracing/trace_pipe
74*8236fc61SShuai Xue       irq/51-pciehp-88      [001] .....   381.545386: pcie_link_event: 0000:00:02.0 type:4, reason:4, cur_bus_speed:20, max_bus_speed:23, width:1, flit_mode:0, status:DLLLA
75