162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci===================
462306a36Sopenharmony_ciMIPI SyS-T over STP
562306a36Sopenharmony_ci===================
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciThe MIPI SyS-T protocol driver can be used with STM class devices to
862306a36Sopenharmony_cigenerate standardized trace stream. Aside from being a standard, it
962306a36Sopenharmony_ciprovides better trace source identification and timestamp correlation.
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ciIn order to use the MIPI SyS-T protocol driver with your STM device,
1262306a36Sopenharmony_cifirst, you'll need CONFIG_STM_PROTO_SYS_T.
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciNow, you can select which protocol driver you want to use when you create
1562306a36Sopenharmony_cia policy for your STM device, by specifying it in the policy name:
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci# mkdir /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciIn other words, the policy name format is extended like this:
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci  <device_name>:<protocol_name>.<policy_name>
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciWith Intel TH, therefore it can look like "0-sth:p_sys-t.my-policy".
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciIf the protocol name is omitted, the STM class will chose whichever
2662306a36Sopenharmony_ciprotocol driver was loaded first.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciYou can also double check that everything is working as expected by
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci# cat /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/protocol
3162306a36Sopenharmony_cip_sys-t
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciNow, with the MIPI SyS-T protocol driver, each policy node in the
3462306a36Sopenharmony_ciconfigfs gets a few additional attributes, which determine per-source
3562306a36Sopenharmony_ciparameters specific to the protocol:
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci# mkdir /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/default
3862306a36Sopenharmony_ci# ls /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/default
3962306a36Sopenharmony_cichannels
4062306a36Sopenharmony_ciclocksync_interval
4162306a36Sopenharmony_cido_len
4262306a36Sopenharmony_cimasters
4362306a36Sopenharmony_cits_interval
4462306a36Sopenharmony_ciuuid
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciThe most important one here is the "uuid", which determines the UUID
4762306a36Sopenharmony_cithat will be used to tag all data coming from this source. It is
4862306a36Sopenharmony_ciautomatically generated when a new node is created, but it is likely
4962306a36Sopenharmony_cithat you would want to change it.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_cido_len switches on/off the additional "payload length" field in the
5262306a36Sopenharmony_ciMIPI SyS-T message header. It is off by default as the STP already
5362306a36Sopenharmony_cimarks message boundaries.
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_cits_interval and clocksync_interval determine how much time in milliseconds
5662306a36Sopenharmony_cican pass before we need to include a protocol (not transport, aka STP)
5762306a36Sopenharmony_citimestamp in a message header or send a CLOCKSYNC packet, respectively.
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ciSee Documentation/ABI/testing/configfs-stp-policy-p_sys-t for more
6062306a36Sopenharmony_cidetails.
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci* [1] https://www.mipi.org/specifications/sys-t
63