intel_th.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. =======================
  2. Intel(R) Trace Hub (TH)
  3. =======================
  4. Overview
  5. --------
  6. Intel(R) Trace Hub (TH) is a set of hardware blocks that produce,
  7. switch and output trace data from multiple hardware and software
  8. sources over several types of trace output ports encoded in System
  9. Trace Protocol (MIPI STPv2) and is intended to perform full system
  10. debugging. For more information on the hardware, see Intel(R) Trace
  11. Hub developer's manual [1].
  12. It consists of trace sources, trace destinations (outputs) and a
  13. switch (Global Trace Hub, GTH). These devices are placed on a bus of
  14. their own ("intel_th"), where they can be discovered and configured
  15. via sysfs attributes.
  16. Currently, the following Intel TH subdevices (blocks) are supported:
  17. - Software Trace Hub (STH), trace source, which is a System Trace
  18. Module (STM) device,
  19. - Memory Storage Unit (MSU), trace output, which allows storing
  20. trace hub output in system memory,
  21. - Parallel Trace Interface output (PTI), trace output to an external
  22. debug host via a PTI port,
  23. - Global Trace Hub (GTH), which is a switch and a central component
  24. of Intel(R) Trace Hub architecture.
  25. Common attributes for output devices are described in
  26. Documentation/ABI/testing/sysfs-bus-intel_th-output-devices, the most
  27. notable of them is "active", which enables or disables trace output
  28. into that particular output device.
  29. GTH allows directing different STP masters into different output ports
  30. via its "masters" attribute group. More detailed GTH interface
  31. description is at Documentation/ABI/testing/sysfs-bus-intel_th-devices-gth.
  32. STH registers an stm class device, through which it provides interface
  33. to userspace and kernelspace software trace sources. See
  34. Documentation/trace/stm.rst for more information on that.
  35. MSU can be configured to collect trace data into a system memory
  36. buffer, which can later on be read from its device nodes via read() or
  37. mmap() interface.
  38. On the whole, Intel(R) Trace Hub does not require any special
  39. userspace software to function; everything can be configured, started
  40. and collected via sysfs attributes, and device nodes.
  41. [1] https://software.intel.com/sites/default/files/managed/d3/3c/intel-th-developer-manual.pdf
  42. Bus and Subdevices
  43. ------------------
  44. For each Intel TH device in the system a bus of its own is
  45. created and assigned an id number that reflects the order in which TH
  46. devices were emumerated. All TH subdevices (devices on intel_th bus)
  47. begin with this id: 0-gth, 0-msc0, 0-msc1, 0-pti, 0-sth, which is
  48. followed by device's name and an optional index.
  49. Output devices also get a device node in /dev/intel_thN, where N is
  50. the Intel TH device id. For example, MSU's memory buffers, when
  51. allocated, are accessible via /dev/intel_th0/msc{0,1}.
  52. Quick example
  53. -------------
  54. # figure out which GTH port is the first memory controller::
  55. $ cat /sys/bus/intel_th/devices/0-msc0/port
  56. 0
  57. # looks like it's port 0, configure master 33 to send data to port 0::
  58. $ echo 0 > /sys/bus/intel_th/devices/0-gth/masters/33
  59. # allocate a 2-windowed multiblock buffer on the first memory
  60. # controller, each with 64 pages::
  61. $ echo multi > /sys/bus/intel_th/devices/0-msc0/mode
  62. $ echo 64,64 > /sys/bus/intel_th/devices/0-msc0/nr_pages
  63. # enable wrapping for this controller, too::
  64. $ echo 1 > /sys/bus/intel_th/devices/0-msc0/wrap
  65. # and enable tracing into this port::
  66. $ echo 1 > /sys/bus/intel_th/devices/0-msc0/active
  67. # .. send data to master 33, see stm.txt for more details ..
  68. # .. wait for traces to pile up ..
  69. # .. and stop the trace::
  70. $ echo 0 > /sys/bus/intel_th/devices/0-msc0/active
  71. # and now you can collect the trace from the device node::
  72. $ cat /dev/intel_th0/msc0 > my_stp_trace
  73. Host Debugger Mode
  74. ------------------
  75. It is possible to configure the Trace Hub and control its trace
  76. capture from a remote debug host, which should be connected via one of
  77. the hardware debugging interfaces, which will then be used to both
  78. control Intel Trace Hub and transfer its trace data to the debug host.
  79. The driver needs to be told that such an arrangement is taking place
  80. so that it does not touch any capture/port configuration and avoids
  81. conflicting with the debug host's configuration accesses. The only
  82. activity that the driver will perform in this mode is collecting
  83. software traces to the Software Trace Hub (an stm class device). The
  84. user is still responsible for setting up adequate master/channel
  85. mappings that the decoder on the receiving end would recognize.
  86. In order to enable the host mode, set the 'host_mode' parameter of the
  87. 'intel_th' kernel module to 'y'. None of the virtual output devices
  88. will show up on the intel_th bus. Also, trace configuration and
  89. capture controlling attribute groups of the 'gth' device will not be
  90. exposed. The 'sth' device will operate as usual.