xref: /OK3568_Linux_fs/kernel/Documentation/trace/sys-t.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun===================
4*4882a593SmuzhiyunMIPI SyS-T over STP
5*4882a593Smuzhiyun===================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThe MIPI SyS-T protocol driver can be used with STM class devices to
8*4882a593Smuzhiyungenerate standardized trace stream. Aside from being a standard, it
9*4882a593Smuzhiyunprovides better trace source identification and timestamp correlation.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunIn order to use the MIPI SyS-T protocol driver with your STM device,
12*4882a593Smuzhiyunfirst, you'll need CONFIG_STM_PROTO_SYS_T.
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunNow, you can select which protocol driver you want to use when you create
15*4882a593Smuzhiyuna policy for your STM device, by specifying it in the policy name:
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun# mkdir /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunIn other words, the policy name format is extended like this:
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun  <device_name>:<protocol_name>.<policy_name>
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunWith Intel TH, therefore it can look like "0-sth:p_sys-t.my-policy".
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunIf the protocol name is omitted, the STM class will chose whichever
26*4882a593Smuzhiyunprotocol driver was loaded first.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunYou can also double check that everything is working as expected by
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun# cat /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/protocol
31*4882a593Smuzhiyunp_sys-t
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunNow, with the MIPI SyS-T protocol driver, each policy node in the
34*4882a593Smuzhiyunconfigfs gets a few additional attributes, which determine per-source
35*4882a593Smuzhiyunparameters specific to the protocol:
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun# mkdir /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/default
38*4882a593Smuzhiyun# ls /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/default
39*4882a593Smuzhiyunchannels
40*4882a593Smuzhiyunclocksync_interval
41*4882a593Smuzhiyundo_len
42*4882a593Smuzhiyunmasters
43*4882a593Smuzhiyunts_interval
44*4882a593Smuzhiyunuuid
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunThe most important one here is the "uuid", which determines the UUID
47*4882a593Smuzhiyunthat will be used to tag all data coming from this source. It is
48*4882a593Smuzhiyunautomatically generated when a new node is created, but it is likely
49*4882a593Smuzhiyunthat you would want to change it.
50*4882a593Smuzhiyun
51*4882a593Smuzhiyundo_len switches on/off the additional "payload length" field in the
52*4882a593SmuzhiyunMIPI SyS-T message header. It is off by default as the STP already
53*4882a593Smuzhiyunmarks message boundaries.
54*4882a593Smuzhiyun
55*4882a593Smuzhiyunts_interval and clocksync_interval determine how much time in milliseconds
56*4882a593Smuzhiyuncan pass before we need to include a protocol (not transport, aka STP)
57*4882a593Smuzhiyuntimestamp in a message header or send a CLOCKSYNC packet, respectively.
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunSee Documentation/ABI/testing/configfs-stp-policy-p_sys-t for more
60*4882a593Smuzhiyundetails.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun* [1] https://www.mipi.org/specifications/sys-t
63