Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: coresight: convert txt to rst

This changes from plain text to reStructuredText as suggestion
in doc-guide [1]

[1] https://www.kernel.org/doc/html/latest/doc-guide/sphinx.html

Some adaptations such as: literal block, ``inline literal`` and
alignment text,...

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Phong Tran and committed by
Jonathan Corbet
fe13225f 34d5f4f2

+226 -203
+35 -30
Documentation/trace/coresight-cpu-debug.txt Documentation/trace/coresight-cpu-debug.rst
··· 1 - Coresight CPU Debug Module 2 - ========================== 1 + ========================== 2 + Coresight CPU Debug Module 3 + ========================== 3 4 4 - Author: Leo Yan <leo.yan@linaro.org> 5 - Date: April 5th, 2017 5 + :Author: Leo Yan <leo.yan@linaro.org> 6 + :Date: April 5th, 2017 6 7 7 8 Introduction 8 9 ------------ ··· 70 69 have been enabled properly. In ARMv8-a ARM (ARM DDI 0487A.k) chapter 'H9.1 71 70 Debug registers', the debug registers are spread into two domains: the debug 72 71 domain and the CPU domain. 72 + :: 73 73 74 74 +---------------+ 75 75 | | ··· 127 125 "coresight_cpu_debug.enable=1" to the kernel command line parameter. 128 126 129 127 The driver also can work as module, so can enable the debugging when insmod 130 - module: 131 - # insmod coresight_cpu_debug.ko debug=1 128 + module:: 129 + 130 + # insmod coresight_cpu_debug.ko debug=1 132 131 133 132 When boot time or insmod module you have not enabled the debugging, the driver 134 133 uses the debugfs file system to provide a knob to dynamically enable or disable 135 134 debugging: 136 135 137 - To enable it, write a '1' into /sys/kernel/debug/coresight_cpu_debug/enable: 138 - # echo 1 > /sys/kernel/debug/coresight_cpu_debug/enable 136 + To enable it, write a '1' into /sys/kernel/debug/coresight_cpu_debug/enable:: 139 137 140 - To disable it, write a '0' into /sys/kernel/debug/coresight_cpu_debug/enable: 141 - # echo 0 > /sys/kernel/debug/coresight_cpu_debug/enable 138 + # echo 1 > /sys/kernel/debug/coresight_cpu_debug/enable 139 + 140 + To disable it, write a '0' into /sys/kernel/debug/coresight_cpu_debug/enable:: 141 + 142 + # echo 0 > /sys/kernel/debug/coresight_cpu_debug/enable 142 143 143 144 As explained in chapter "Clock and power domain", if you are working on one 144 145 platform which has idle states to power off debug logic and the power ··· 159 154 interface (see Documentation/power/pm_qos_interface.rst for more 160 155 details). As specified in the PM QoS documentation the requested 161 156 parameter will stay in effect until the file descriptor is released. 162 - For example: 157 + For example:: 163 158 164 - # exec 3<> /dev/cpu_dma_latency; echo 0 >&3 165 - ... 166 - Do some work... 167 - ... 168 - # exec 3<>- 159 + # exec 3<> /dev/cpu_dma_latency; echo 0 >&3 160 + ... 161 + Do some work... 162 + ... 163 + # exec 3<>- 169 164 170 165 The same can also be done from an application program. 171 166 172 167 Disable specific CPU's specific idle state from cpuidle sysfs (see 173 - Documentation/admin-guide/pm/cpuidle.rst): 174 - # echo 1 > /sys/devices/system/cpu/cpu$cpu/cpuidle/state$state/disable 168 + Documentation/admin-guide/pm/cpuidle.rst):: 175 169 170 + # echo 1 > /sys/devices/system/cpu/cpu$cpu/cpuidle/state$state/disable 176 171 177 172 Output format 178 173 ------------- 179 174 180 - Here is an example of the debugging output format: 175 + Here is an example of the debugging output format:: 181 176 182 - ARM external debug module: 183 - coresight-cpu-debug 850000.debug: CPU[0]: 184 - coresight-cpu-debug 850000.debug: EDPRSR: 00000001 (Power:On DLK:Unlock) 185 - coresight-cpu-debug 850000.debug: EDPCSR: handle_IPI+0x174/0x1d8 186 - coresight-cpu-debug 850000.debug: EDCIDSR: 00000000 187 - coresight-cpu-debug 850000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0) 188 - coresight-cpu-debug 852000.debug: CPU[1]: 189 - coresight-cpu-debug 852000.debug: EDPRSR: 00000001 (Power:On DLK:Unlock) 190 - coresight-cpu-debug 852000.debug: EDPCSR: debug_notifier_call+0x23c/0x358 191 - coresight-cpu-debug 852000.debug: EDCIDSR: 00000000 192 - coresight-cpu-debug 852000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0) 177 + ARM external debug module: 178 + coresight-cpu-debug 850000.debug: CPU[0]: 179 + coresight-cpu-debug 850000.debug: EDPRSR: 00000001 (Power:On DLK:Unlock) 180 + coresight-cpu-debug 850000.debug: EDPCSR: handle_IPI+0x174/0x1d8 181 + coresight-cpu-debug 850000.debug: EDCIDSR: 00000000 182 + coresight-cpu-debug 850000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0) 183 + coresight-cpu-debug 852000.debug: CPU[1]: 184 + coresight-cpu-debug 852000.debug: EDPRSR: 00000001 (Power:On DLK:Unlock) 185 + coresight-cpu-debug 852000.debug: EDPCSR: debug_notifier_call+0x23c/0x358 186 + coresight-cpu-debug 852000.debug: EDCIDSR: 00000000 187 + coresight-cpu-debug 852000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0)
+187 -171
Documentation/trace/coresight.txt Documentation/trace/coresight.rst
··· 1 - Coresight - HW Assisted Tracing on ARM 2 - ====================================== 1 + ====================================== 2 + Coresight - HW Assisted Tracing on ARM 3 + ====================================== 3 4 4 - Author: Mathieu Poirier <mathieu.poirier@linaro.org> 5 - Date: September 11th, 2014 5 + :Author: Mathieu Poirier <mathieu.poirier@linaro.org> 6 + :Date: September 11th, 2014 6 7 7 8 Introduction 8 9 ------------ ··· 27 26 creating an interface to the outside world where data can be transferred to a 28 27 host without fear of filling up the onboard coresight memory buffer. 29 28 30 - At typical coresight system would look like this: 29 + At typical coresight system would look like this:: 31 30 32 31 ***************************************************************** 33 32 **************************** AMBA AXI ****************************===|| ··· 96 95 97 96 Acronyms: 98 97 99 - PTM: Program Trace Macrocell 100 - ETM: Embedded Trace Macrocell 101 - STM: System trace Macrocell 102 - ETB: Embedded Trace Buffer 103 - ITM: Instrumentation Trace Macrocell 104 - TPIU: Trace Port Interface Unit 105 - TMC-ETR: Trace Memory Controller, configured as Embedded Trace Router 106 - TMC-ETF: Trace Memory Controller, configured as Embedded Trace FIFO 107 - CTI: Cross Trigger Interface 98 + PTM: 99 + Program Trace Macrocell 100 + ETM: 101 + Embedded Trace Macrocell 102 + STM: 103 + System trace Macrocell 104 + ETB: 105 + Embedded Trace Buffer 106 + ITM: 107 + Instrumentation Trace Macrocell 108 + TPIU: 109 + Trace Port Interface Unit 110 + TMC-ETR: 111 + Trace Memory Controller, configured as Embedded Trace Router 112 + TMC-ETF: 113 + Trace Memory Controller, configured as Embedded Trace FIFO 114 + CTI: 115 + Cross Trigger Interface 108 116 109 117 Classification: 110 118 ··· 128 118 129 119 130 120 Device Tree Bindings 131 - ---------------------- 121 + -------------------- 132 122 133 123 See Documentation/devicetree/bindings/arm/coresight.txt for details. 134 124 ··· 143 133 manage coresight devices on a platform. Any coresight compliant device can 144 134 register with the framework for as long as they use the right APIs: 145 135 146 - struct coresight_device *coresight_register(struct coresight_desc *desc); 147 - void coresight_unregister(struct coresight_device *csdev); 136 + .. c:function:: struct coresight_device *coresight_register(struct coresight_desc *desc); 137 + .. c:function:: void coresight_unregister(struct coresight_device *csdev); 148 138 149 - The registering function is taking a "struct coresight_device *csdev" and 150 - register the device with the core framework. The unregister function takes 151 - a reference to a "struct coresight_device", obtained at registration time. 139 + The registering function is taking a ``struct coresight_desc *desc`` and 140 + register the device with the core framework. The unregister function takes 141 + a reference to a ``struct coresight_device *csdev`` obtained at registration time. 152 142 153 143 If everything goes well during the registration process the new devices will 154 - show up under /sys/bus/coresight/devices, as showns here for a TC2 platform: 144 + show up under /sys/bus/coresight/devices, as showns here for a TC2 platform:: 155 145 156 - root:~# ls /sys/bus/coresight/devices/ 157 - replicator 20030000.tpiu 2201c000.ptm 2203c000.etm 2203e000.etm 158 - 20010000.etb 20040000.funnel 2201d000.ptm 2203d000.etm 159 - root:~# 146 + root:~# ls /sys/bus/coresight/devices/ 147 + replicator 20030000.tpiu 2201c000.ptm 2203c000.etm 2203e000.etm 148 + 20010000.etb 20040000.funnel 2201d000.ptm 2203d000.etm 149 + root:~# 160 150 161 - The functions take a "struct coresight_device", which looks like this: 151 + The functions take a ``struct coresight_device``, which looks like this:: 162 152 163 - struct coresight_desc { 164 - enum coresight_dev_type type; 165 - struct coresight_dev_subtype subtype; 166 - const struct coresight_ops *ops; 167 - struct coresight_platform_data *pdata; 168 - struct device *dev; 169 - const struct attribute_group **groups; 170 - }; 153 + struct coresight_desc { 154 + enum coresight_dev_type type; 155 + struct coresight_dev_subtype subtype; 156 + const struct coresight_ops *ops; 157 + struct coresight_platform_data *pdata; 158 + struct device *dev; 159 + const struct attribute_group **groups; 160 + }; 171 161 172 162 173 163 The "coresight_dev_type" identifies what the device is, i.e, source link or 174 164 sink while the "coresight_dev_subtype" will characterise that type further. 175 165 176 - The "struct coresight_ops" is mandatory and will tell the framework how to 166 + The ``struct coresight_ops`` is mandatory and will tell the framework how to 177 167 perform base operations related to the components, each component having 178 - a different set of requirement. For that "struct coresight_ops_sink", 179 - "struct coresight_ops_link" and "struct coresight_ops_source" have been 168 + a different set of requirement. For that ``struct coresight_ops_sink``, 169 + ``struct coresight_ops_link`` and ``struct coresight_ops_source`` have been 180 170 provided. 181 171 182 - The next field, "struct coresight_platform_data *pdata" is acquired by calling 183 - "of_get_coresight_platform_data()", as part of the driver's _probe routine and 184 - "struct device *dev" gets the device reference embedded in the "amba_device": 172 + The next field ``struct coresight_platform_data *pdata`` is acquired by calling 173 + ``of_get_coresight_platform_data()``, as part of the driver's _probe routine and 174 + ``struct device *dev`` gets the device reference embedded in the ``amba_device``:: 185 175 186 - static int etm_probe(struct amba_device *adev, const struct amba_id *id) 187 - { 188 - ... 189 - ... 190 - drvdata->dev = &adev->dev; 191 - ... 192 - } 176 + static int etm_probe(struct amba_device *adev, const struct amba_id *id) 177 + { 178 + ... 179 + ... 180 + drvdata->dev = &adev->dev; 181 + ... 182 + } 193 183 194 184 Specific class of device (source, link, or sink) have generic operations 195 - that can be performed on them (see "struct coresight_ops"). The 196 - "**groups" is a list of sysfs entries pertaining to operations 185 + that can be performed on them (see ``struct coresight_ops``). The ``**groups`` 186 + is a list of sysfs entries pertaining to operations 197 187 specific to that component only. "Implementation defined" customisations are 198 188 expected to be accessed and controlled using those entries. 199 189 200 - 201 190 Device Naming scheme 202 - ------------------------ 191 + -------------------- 192 + 203 193 The devices that appear on the "coresight" bus were named the same as their 204 194 parent devices, i.e, the real devices that appears on AMBA bus or the platform bus. 205 195 Thus the names were based on the Linux Open Firmware layer naming convention, 206 196 which follows the base physical address of the device followed by the device 207 - type. e.g: 197 + type. e.g:: 208 198 209 - root:~# ls /sys/bus/coresight/devices/ 210 - 20010000.etf 20040000.funnel 20100000.stm 22040000.etm 211 - 22140000.etm 230c0000.funnel 23240000.etm 20030000.tpiu 212 - 20070000.etr 20120000.replicator 220c0000.funnel 213 - 23040000.etm 23140000.etm 23340000.etm 199 + root:~# ls /sys/bus/coresight/devices/ 200 + 20010000.etf 20040000.funnel 20100000.stm 22040000.etm 201 + 22140000.etm 230c0000.funnel 23240000.etm 20030000.tpiu 202 + 20070000.etr 20120000.replicator 220c0000.funnel 203 + 23040000.etm 23140000.etm 23340000.etm 214 204 215 205 However, with the introduction of ACPI support, the names of the real 216 206 devices are a bit cryptic and non-obvious. Thus, a new naming scheme was 217 207 introduced to use more generic names based on the type of the device. The 218 - following rules apply: 208 + following rules apply:: 219 209 220 210 1) Devices that are bound to CPUs, are named based on the CPU logical 221 211 number. ··· 230 220 231 221 e.g, tmc_etf0, tmc_etr0, funnel0, funnel1 232 222 233 - Thus, with the new scheme the devices could appear as : 223 + Thus, with the new scheme the devices could appear as :: 234 224 235 - root:~# ls /sys/bus/coresight/devices/ 236 - etm0 etm1 etm2 etm3 etm4 etm5 funnel0 237 - funnel1 funnel2 replicator0 stm0 tmc_etf0 tmc_etr0 tpiu0 225 + root:~# ls /sys/bus/coresight/devices/ 226 + etm0 etm1 etm2 etm3 etm4 etm5 funnel0 227 + funnel1 funnel2 replicator0 stm0 tmc_etf0 tmc_etr0 tpiu0 238 228 239 229 Some of the examples below might refer to old naming scheme and some 240 230 to the newer scheme, to give a confirmation that what you see on your ··· 244 234 How to use the tracer modules 245 235 ----------------------------- 246 236 247 - There are two ways to use the Coresight framework: 1) using the perf cmd line 248 - tools and 2) interacting directly with the Coresight devices using the sysFS 249 - interface. Preference is given to the former as using the sysFS interface 237 + There are two ways to use the Coresight framework: 238 + 239 + 1. using the perf cmd line tools. 240 + 2. interacting directly with the Coresight devices using the sysFS interface. 241 + 242 + Preference is given to the former as using the sysFS interface 250 243 requires a deep understanding of the Coresight HW. The following sections 251 244 provide details on using both methods. 252 245 ··· 258 245 Before trace collection can start, a coresight sink needs to be identified. 259 246 There is no limit on the amount of sinks (nor sources) that can be enabled at 260 247 any given moment. As a generic operation, all device pertaining to the sink 261 - class will have an "active" entry in sysfs: 248 + class will have an "active" entry in sysfs:: 262 249 263 - root:/sys/bus/coresight/devices# ls 264 - replicator 20030000.tpiu 2201c000.ptm 2203c000.etm 2203e000.etm 265 - 20010000.etb 20040000.funnel 2201d000.ptm 2203d000.etm 266 - root:/sys/bus/coresight/devices# ls 20010000.etb 267 - enable_sink status trigger_cntr 268 - root:/sys/bus/coresight/devices# echo 1 > 20010000.etb/enable_sink 269 - root:/sys/bus/coresight/devices# cat 20010000.etb/enable_sink 270 - 1 271 - root:/sys/bus/coresight/devices# 250 + root:/sys/bus/coresight/devices# ls 251 + replicator 20030000.tpiu 2201c000.ptm 2203c000.etm 2203e000.etm 252 + 20010000.etb 20040000.funnel 2201d000.ptm 2203d000.etm 253 + root:/sys/bus/coresight/devices# ls 20010000.etb 254 + enable_sink status trigger_cntr 255 + root:/sys/bus/coresight/devices# echo 1 > 20010000.etb/enable_sink 256 + root:/sys/bus/coresight/devices# cat 20010000.etb/enable_sink 257 + 1 258 + root:/sys/bus/coresight/devices# 272 259 273 260 At boot time the current etm3x driver will configure the first address 274 261 comparator with "_stext" and "_etext", essentially tracing any instruction 275 262 that falls within that range. As such "enabling" a source will immediately 276 - trigger a trace capture: 263 + trigger a trace capture:: 277 264 278 - root:/sys/bus/coresight/devices# echo 1 > 2201c000.ptm/enable_source 279 - root:/sys/bus/coresight/devices# cat 2201c000.ptm/enable_source 280 - 1 281 - root:/sys/bus/coresight/devices# cat 20010000.etb/status 282 - Depth: 0x2000 283 - Status: 0x1 284 - RAM read ptr: 0x0 285 - RAM wrt ptr: 0x19d3 <----- The write pointer is moving 286 - Trigger cnt: 0x0 287 - Control: 0x1 288 - Flush status: 0x0 289 - Flush ctrl: 0x2001 290 - root:/sys/bus/coresight/devices# 265 + root:/sys/bus/coresight/devices# echo 1 > 2201c000.ptm/enable_source 266 + root:/sys/bus/coresight/devices# cat 2201c000.ptm/enable_source 267 + 1 268 + root:/sys/bus/coresight/devices# cat 20010000.etb/status 269 + Depth: 0x2000 270 + Status: 0x1 271 + RAM read ptr: 0x0 272 + RAM wrt ptr: 0x19d3 <----- The write pointer is moving 273 + Trigger cnt: 0x0 274 + Control: 0x1 275 + Flush status: 0x0 276 + Flush ctrl: 0x2001 277 + root:/sys/bus/coresight/devices# 291 278 292 - Trace collection is stopped the same way: 279 + Trace collection is stopped the same way:: 293 280 294 - root:/sys/bus/coresight/devices# echo 0 > 2201c000.ptm/enable_source 295 - root:/sys/bus/coresight/devices# 281 + root:/sys/bus/coresight/devices# echo 0 > 2201c000.ptm/enable_source 282 + root:/sys/bus/coresight/devices# 296 283 297 - The content of the ETB buffer can be harvested directly from /dev: 284 + The content of the ETB buffer can be harvested directly from /dev:: 298 285 299 - root:/sys/bus/coresight/devices# dd if=/dev/20010000.etb \ 300 - of=~/cstrace.bin 301 - 302 - 64+0 records in 303 - 64+0 records out 304 - 32768 bytes (33 kB) copied, 0.00125258 s, 26.2 MB/s 305 - root:/sys/bus/coresight/devices# 286 + root:/sys/bus/coresight/devices# dd if=/dev/20010000.etb \ 287 + of=~/cstrace.bin 288 + 64+0 records in 289 + 64+0 records out 290 + 32768 bytes (33 kB) copied, 0.00125258 s, 26.2 MB/s 291 + root:/sys/bus/coresight/devices# 306 292 307 293 The file cstrace.bin can be decompressed using "ptm2human", DS-5 or Trace32. 308 294 309 295 Following is a DS-5 output of an experimental loop that increments a variable up 310 296 to a certain value. The example is simple and yet provides a glimpse of the 311 297 wealth of possibilities that coresight provides. 298 + :: 312 299 313 - Info Tracing enabled 314 - Instruction 106378866 0x8026B53C E52DE004 false PUSH {lr} 315 - Instruction 0 0x8026B540 E24DD00C false SUB sp,sp,#0xc 316 - Instruction 0 0x8026B544 E3A03000 false MOV r3,#0 317 - Instruction 0 0x8026B548 E58D3004 false STR r3,[sp,#4] 318 - Instruction 0 0x8026B54C E59D3004 false LDR r3,[sp,#4] 319 - Instruction 0 0x8026B550 E3530004 false CMP r3,#4 320 - Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 321 - Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 322 - Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 323 - Timestamp Timestamp: 17106715833 324 - Instruction 319 0x8026B54C E59D3004 false LDR r3,[sp,#4] 325 - Instruction 0 0x8026B550 E3530004 false CMP r3,#4 326 - Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 327 - Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 328 - Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 329 - Instruction 9 0x8026B54C E59D3004 false LDR r3,[sp,#4] 330 - Instruction 0 0x8026B550 E3530004 false CMP r3,#4 331 - Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 332 - Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 333 - Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 334 - Instruction 7 0x8026B54C E59D3004 false LDR r3,[sp,#4] 335 - Instruction 0 0x8026B550 E3530004 false CMP r3,#4 336 - Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 337 - Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 338 - Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 339 - Instruction 7 0x8026B54C E59D3004 false LDR r3,[sp,#4] 340 - Instruction 0 0x8026B550 E3530004 false CMP r3,#4 341 - Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 342 - Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 343 - Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 344 - Instruction 10 0x8026B54C E59D3004 false LDR r3,[sp,#4] 345 - Instruction 0 0x8026B550 E3530004 false CMP r3,#4 346 - Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 347 - Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 348 - Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 349 - Instruction 6 0x8026B560 EE1D3F30 false MRC p15,#0x0,r3,c13,c0,#1 350 - Instruction 0 0x8026B564 E1A0100D false MOV r1,sp 351 - Instruction 0 0x8026B568 E3C12D7F false BIC r2,r1,#0x1fc0 352 - Instruction 0 0x8026B56C E3C2203F false BIC r2,r2,#0x3f 353 - Instruction 0 0x8026B570 E59D1004 false LDR r1,[sp,#4] 354 - Instruction 0 0x8026B574 E59F0010 false LDR r0,[pc,#16] ; [0x8026B58C] = 0x80550368 355 - Instruction 0 0x8026B578 E592200C false LDR r2,[r2,#0xc] 356 - Instruction 0 0x8026B57C E59221D0 false LDR r2,[r2,#0x1d0] 357 - Instruction 0 0x8026B580 EB07A4CF true BL {pc}+0x1e9344 ; 0x804548c4 358 - Info Tracing enabled 359 - Instruction 13570831 0x8026B584 E28DD00C false ADD sp,sp,#0xc 360 - Instruction 0 0x8026B588 E8BD8000 true LDM sp!,{pc} 361 - Timestamp Timestamp: 17107041535 300 + Info Tracing enabled 301 + Instruction 106378866 0x8026B53C E52DE004 false PUSH {lr} 302 + Instruction 0 0x8026B540 E24DD00C false SUB sp,sp,#0xc 303 + Instruction 0 0x8026B544 E3A03000 false MOV r3,#0 304 + Instruction 0 0x8026B548 E58D3004 false STR r3,[sp,#4] 305 + Instruction 0 0x8026B54C E59D3004 false LDR r3,[sp,#4] 306 + Instruction 0 0x8026B550 E3530004 false CMP r3,#4 307 + Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 308 + Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 309 + Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 310 + Timestamp Timestamp: 17106715833 311 + Instruction 319 0x8026B54C E59D3004 false LDR r3,[sp,#4] 312 + Instruction 0 0x8026B550 E3530004 false CMP r3,#4 313 + Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 314 + Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 315 + Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 316 + Instruction 9 0x8026B54C E59D3004 false LDR r3,[sp,#4] 317 + Instruction 0 0x8026B550 E3530004 false CMP r3,#4 318 + Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 319 + Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 320 + Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 321 + Instruction 7 0x8026B54C E59D3004 false LDR r3,[sp,#4] 322 + Instruction 0 0x8026B550 E3530004 false CMP r3,#4 323 + Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 324 + Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 325 + Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 326 + Instruction 7 0x8026B54C E59D3004 false LDR r3,[sp,#4] 327 + Instruction 0 0x8026B550 E3530004 false CMP r3,#4 328 + Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 329 + Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 330 + Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 331 + Instruction 10 0x8026B54C E59D3004 false LDR r3,[sp,#4] 332 + Instruction 0 0x8026B550 E3530004 false CMP r3,#4 333 + Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1 334 + Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4] 335 + Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c 336 + Instruction 6 0x8026B560 EE1D3F30 false MRC p15,#0x0,r3,c13,c0,#1 337 + Instruction 0 0x8026B564 E1A0100D false MOV r1,sp 338 + Instruction 0 0x8026B568 E3C12D7F false BIC r2,r1,#0x1fc0 339 + Instruction 0 0x8026B56C E3C2203F false BIC r2,r2,#0x3f 340 + Instruction 0 0x8026B570 E59D1004 false LDR r1,[sp,#4] 341 + Instruction 0 0x8026B574 E59F0010 false LDR r0,[pc,#16] ; [0x8026B58C] = 0x80550368 342 + Instruction 0 0x8026B578 E592200C false LDR r2,[r2,#0xc] 343 + Instruction 0 0x8026B57C E59221D0 false LDR r2,[r2,#0x1d0] 344 + Instruction 0 0x8026B580 EB07A4CF true BL {pc}+0x1e9344 ; 0x804548c4 345 + Info Tracing enabled 346 + Instruction 13570831 0x8026B584 E28DD00C false ADD sp,sp,#0xc 347 + Instruction 0 0x8026B588 E8BD8000 true LDM sp!,{pc} 348 + Timestamp Timestamp: 17107041535 362 349 363 350 2) Using perf framework: 364 351 ··· 383 370 listed along with configuration options within forward slashes '/'. Since a 384 371 Coresight system will typically have more than one sink, the name of the sink to 385 372 work with needs to be specified as an event option. 386 - On newer kernels the available sinks are listed in sysFS under: 387 - ($SYSFS)/bus/event_source/devices/cs_etm/sinks/ 373 + On newer kernels the available sinks are listed in sysFS under 374 + ($SYSFS)/bus/event_source/devices/cs_etm/sinks/:: 388 375 389 376 root@localhost:/sys/bus/event_source/devices/cs_etm/sinks# ls 390 377 tmc_etf0 tmc_etr0 tpiu0 391 378 392 379 On older kernels, this may need to be found from the list of coresight devices, 393 - available under ($SYSFS)/bus/coresight/devices/: 380 + available under ($SYSFS)/bus/coresight/devices/:: 394 381 395 382 root:~# ls /sys/bus/coresight/devices/ 396 383 etm0 etm1 etm2 etm3 etm4 etm5 funnel0 397 384 funnel1 funnel2 replicator0 stm0 tmc_etf0 tmc_etr0 tpiu0 398 - 399 385 root@linaro-nano:~# perf record -e cs_etm/@tmc_etr0/u --per-thread program 400 386 401 387 As mentioned above in section "Device Naming scheme", the names of the devices could ··· 407 395 408 396 More information on the above and other example on how to use Coresight with 409 397 the perf tools can be found in the "HOWTO.md" file of the openCSD gitHub 410 - repository [3]. 398 + repository [#third]_. 411 399 412 400 2.1) AutoFDO analysis using the perf tools: 413 401 414 402 perf can be used to record and analyze trace of programs. 415 403 416 404 Execution can be recorded using 'perf record' with the cs_etm event, 417 - specifying the name of the sink to record to, e.g: 405 + specifying the name of the sink to record to, e.g:: 418 406 419 407 perf record -e cs_etm/@tmc_etr0/u --per-thread 420 408 ··· 433 421 434 422 'perf inject' accepts the --itrace option in which case tracing data is 435 423 removed and replaced with the synthesized events. e.g. 424 + :: 436 425 437 426 perf inject --itrace --strip -i perf.data -o perf.data.new 438 427 439 428 Below is an example of using ARM ETM for autoFDO. It requires autofdo 440 429 (https://github.com/google/autofdo) and gcc version 5. The bubble 441 430 sort example is from the AutoFDO tutorial (https://gcc.gnu.org/wiki/AutoFDO/Tutorial). 431 + :: 442 432 443 433 $ gcc-5 -O3 sort.c -o sort 444 434 $ taskset -c 2 ./sort ··· 469 455 than the program flow through the code. 470 456 471 457 As with any other CoreSight component, specifics about the STM tracer can be 472 - found in sysfs with more information on each entry being found in [1]: 458 + found in sysfs with more information on each entry being found in [#first]_:: 473 459 474 - root@genericarmv8:~# ls /sys/bus/coresight/devices/stm0 475 - enable_source hwevent_select port_enable subsystem uevent 476 - hwevent_enable mgmt port_select traceid 477 - root@genericarmv8:~# 460 + root@genericarmv8:~# ls /sys/bus/coresight/devices/stm0 461 + enable_source hwevent_select port_enable subsystem uevent 462 + hwevent_enable mgmt port_select traceid 463 + root@genericarmv8:~# 478 464 479 465 Like any other source a sink needs to be identified and the STM enabled before 480 - being used: 466 + being used:: 481 467 482 - root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink 483 - root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/stm0/enable_source 468 + root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink 469 + root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/stm0/enable_source 484 470 485 471 From there user space applications can request and use channels using the devfs 486 - interface provided for that purpose by the generic STM API: 472 + interface provided for that purpose by the generic STM API:: 487 473 488 - root@genericarmv8:~# ls -l /dev/stm0 489 - crw------- 1 root root 10, 61 Jan 3 18:11 /dev/stm0 490 - root@genericarmv8:~# 474 + root@genericarmv8:~# ls -l /dev/stm0 475 + crw------- 1 root root 10, 61 Jan 3 18:11 /dev/stm0 476 + root@genericarmv8:~# 491 477 492 - Details on how to use the generic STM API can be found here [2]. 478 + Details on how to use the generic STM API can be found here [#second]_. 493 479 494 - [1]. Documentation/ABI/testing/sysfs-bus-coresight-devices-stm 495 - [2]. Documentation/trace/stm.rst 496 - [3]. https://github.com/Linaro/perf-opencsd 480 + .. [#first] Documentation/ABI/testing/sysfs-bus-coresight-devices-stm 481 + 482 + .. [#second] Documentation/trace/stm.rst 483 + 484 + .. [#third] https://github.com/Linaro/perf-opencsd
+2
Documentation/trace/index.rst
··· 23 23 intel_th 24 24 stm 25 25 sys-t 26 + coresight 27 + coresight-cpu-debug
+2 -2
MAINTAINERS
··· 1582 1582 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1583 1583 S: Maintained 1584 1584 F: drivers/hwtracing/coresight/* 1585 - F: Documentation/trace/coresight.txt 1586 - F: Documentation/trace/coresight-cpu-debug.txt 1585 + F: Documentation/trace/coresight.rst 1586 + F: Documentation/trace/coresight-cpu-debug.rst 1587 1587 F: Documentation/devicetree/bindings/arm/coresight.txt 1588 1588 F: Documentation/devicetree/bindings/arm/coresight-cpu-debug.txt 1589 1589 F: Documentation/ABI/testing/sysfs-bus-coresight-devices-*