18c2ecf20Sopenharmony_ci==========================
28c2ecf20Sopenharmony_ciARM Cache Coherent Network
38c2ecf20Sopenharmony_ci==========================
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciCCN-504 is a ring-bus interconnect consisting of 11 crosspoints
68c2ecf20Sopenharmony_ci(XPs), with each crosspoint supporting up to two device ports,
78c2ecf20Sopenharmony_ciso nodes (devices) 0 and 1 are connected to crosspoint 0,
88c2ecf20Sopenharmony_cinodes 2 and 3 to crosspoint 1 etc.
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciPMU (perf) driver
118c2ecf20Sopenharmony_ci-----------------
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciThe CCN driver registers a perf PMU driver, which provides
148c2ecf20Sopenharmony_cidescription of available events and configuration options
158c2ecf20Sopenharmony_ciin sysfs, see /sys/bus/event_source/devices/ccn*.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciThe "format" directory describes format of the config, config1
188c2ecf20Sopenharmony_ciand config2 fields of the perf_event_attr structure. The "events"
198c2ecf20Sopenharmony_cidirectory provides configuration templates for all documented
208c2ecf20Sopenharmony_cievents, that can be used with perf tool. For example "xp_valid_flit"
218c2ecf20Sopenharmony_ciis an equivalent of "type=0x8,event=0x4". Other parameters must be
228c2ecf20Sopenharmony_ciexplicitly specified.
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciFor events originating from device, "node" defines its index.
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciCrosspoint PMU events require "xp" (index), "bus" (bus number)
278c2ecf20Sopenharmony_ciand "vc" (virtual channel ID).
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciCrosspoint watchpoint-based events (special "event" value 0xfe)
308c2ecf20Sopenharmony_cirequire "xp" and "vc" as above plus "port" (device port index),
318c2ecf20Sopenharmony_ci"dir" (transmit/receive direction), comparator values ("cmp_l"
328c2ecf20Sopenharmony_ciand "cmp_h") and "mask", being index of the comparator mask.
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciMasks are defined separately from the event description
358c2ecf20Sopenharmony_ci(due to limited number of the config values) in the "cmp_mask"
368c2ecf20Sopenharmony_cidirectory, with first 8 configurable by user and additional
378c2ecf20Sopenharmony_ci4 hardcoded for the most frequent use cases.
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciCycle counter is described by a "type" value 0xff and does
408c2ecf20Sopenharmony_cinot require any other settings.
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciThe driver also provides a "cpumask" sysfs attribute, which contains
438c2ecf20Sopenharmony_cia single CPU ID, of the processor which will be used to handle all
448c2ecf20Sopenharmony_cithe CCN PMU events. It is recommended that the user space tools
458c2ecf20Sopenharmony_cirequest the events on this processor (if not, the perf_event->cpu value
468c2ecf20Sopenharmony_ciwill be overwritten anyway). In case of this processor being offlined,
478c2ecf20Sopenharmony_cithe events are migrated to another one and the attribute is updated.
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciExample of perf tool use::
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci  / # perf list | grep ccn
528c2ecf20Sopenharmony_ci    ccn/cycles/                                        [Kernel PMU event]
538c2ecf20Sopenharmony_ci  <...>
548c2ecf20Sopenharmony_ci    ccn/xp_valid_flit,xp=?,port=?,vc=?,dir=?/          [Kernel PMU event]
558c2ecf20Sopenharmony_ci  <...>
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci  / # perf stat -a -e ccn/cycles/,ccn/xp_valid_flit,xp=1,port=0,vc=1,dir=1/ \
588c2ecf20Sopenharmony_ci                                                                         sleep 1
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciThe driver does not support sampling, therefore "perf record" will
618c2ecf20Sopenharmony_cinot work. Per-task (without "-a") perf sessions are not supported.
62