intel_th.txt 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. Intel(R) Trace Hub (TH)
  2. =======================
  3. Overview
  4. --------
  5. Intel(R) Trace Hub (TH) is a set of hardware blocks that produce,
  6. switch and output trace data from multiple hardware and software
  7. sources over several types of trace output ports encoded in System
  8. Trace Protocol (MIPI STPv2) and is intended to perform full system
  9. debugging. For more information on the hardware, see Intel(R) Trace
  10. Hub developer's manual [1].
  11. It consists of trace sources, trace destinations (outputs) and a
  12. switch (Global Trace Hub, GTH). These devices are placed on a bus of
  13. their own ("intel_th"), where they can be discovered and configured
  14. via sysfs attributes.
  15. Currently, the following Intel TH subdevices (blocks) are supported:
  16. - Software Trace Hub (STH), trace source, which is a System Trace
  17. Module (STM) device,
  18. - Memory Storage Unit (MSU), trace output, which allows storing
  19. trace hub output in system memory,
  20. - Parallel Trace Interface output (PTI), trace output to an external
  21. debug host via a PTI port,
  22. - Global Trace Hub (GTH), which is a switch and a central component
  23. of Intel(R) Trace Hub architecture.
  24. Common attributes for output devices are described in
  25. Documentation/ABI/testing/sysfs-bus-intel_th-output-devices, the most
  26. notable of them is "active", which enables or disables trace output
  27. into that particular output device.
  28. GTH allows directing different STP masters into different output ports
  29. via its "masters" attribute group. More detailed GTH interface
  30. description is at Documentation/ABI/testing/sysfs-bus-intel_th-devices-gth.
  31. STH registers an stm class device, through which it provides interface
  32. to userspace and kernelspace software trace sources. See
  33. Documentation/tracing/stm.txt for more information on that.
  34. MSU can be configured to collect trace data into a system memory
  35. buffer, which can later on be read from its device nodes via read() or
  36. mmap() interface.
  37. On the whole, Intel(R) Trace Hub does not require any special
  38. userspace software to function; everything can be configured, started
  39. and collected via sysfs attributes, and device nodes.
  40. [1] https://software.intel.com/sites/default/files/managed/d3/3c/intel-th-developer-manual.pdf
  41. Bus and Subdevices
  42. ------------------
  43. For each Intel TH device in the system a bus of its own is
  44. created and assigned an id number that reflects the order in which TH
  45. devices were emumerated. All TH subdevices (devices on intel_th bus)
  46. begin with this id: 0-gth, 0-msc0, 0-msc1, 0-pti, 0-sth, which is
  47. followed by device's name and an optional index.
  48. Output devices also get a device node in /dev/intel_thN, where N is
  49. the Intel TH device id. For example, MSU's memory buffers, when
  50. allocated, are accessible via /dev/intel_th0/msc{0,1}.
  51. Quick example
  52. -------------
  53. # figure out which GTH port is the first memory controller:
  54. $ cat /sys/bus/intel_th/devices/0-msc0/port
  55. 0
  56. # looks like it's port 0, configure master 33 to send data to port 0:
  57. $ echo 0 > /sys/bus/intel_th/devices/0-gth/masters/33
  58. # allocate a 2-windowed multiblock buffer on the first memory
  59. # controller, each with 64 pages:
  60. $ echo multi > /sys/bus/intel_th/devices/0-msc0/mode
  61. $ echo 64,64 > /sys/bus/intel_th/devices/0-msc0/nr_pages
  62. # enable wrapping for this controller, too:
  63. $ echo 1 > /sys/bus/intel_th/devices/0-msc0/wrap
  64. # and enable tracing into this port:
  65. $ echo 1 > /sys/bus/intel_th/devices/0-msc0/active
  66. # .. send data to master 33, see stm.txt for more details ..
  67. # .. wait for traces to pile up ..
  68. # .. and stop the trace:
  69. $ echo 0 > /sys/bus/intel_th/devices/0-msc0/active
  70. # and now you can collect the trace from the device node:
  71. $ cat /dev/intel_th0/msc0 > my_stp_trace