10ba64770SRobin Murphy=============================
20ba64770SRobin MurphyArm Coherent Mesh Network PMU
30ba64770SRobin Murphy=============================
40ba64770SRobin Murphy
50ba64770SRobin MurphyCMN-600 is a configurable mesh interconnect consisting of a rectangular
60ba64770SRobin Murphygrid of crosspoints (XPs), with each crosspoint supporting up to two
70ba64770SRobin Murphydevice ports to which various AMBA CHI agents are attached.
80ba64770SRobin Murphy
90ba64770SRobin MurphyCMN implements a distributed PMU design as part of its debug and trace
100ba64770SRobin Murphyfunctionality. This consists of a local monitor (DTM) at every XP, which
110ba64770SRobin Murphycounts up to 4 event signals from the connected device nodes and/or the
120ba64770SRobin MurphyXP itself. Overflow from these local counters is accumulated in up to 8
130ba64770SRobin Murphyglobal counters implemented by the main controller (DTC), which provides
140ba64770SRobin Murphyoverall PMU control and interrupts for global counter overflow.
150ba64770SRobin Murphy
160ba64770SRobin MurphyPMU events
170ba64770SRobin Murphy----------
180ba64770SRobin Murphy
190ba64770SRobin MurphyThe PMU driver registers a single PMU device for the whole interconnect,
20*79d7c3dcSRobin Murphysee /sys/bus/event_source/devices/arm_cmn_0. Multi-chip systems may link
210ba64770SRobin Murphymore than one CMN together via external CCIX links - in this situation,
220ba64770SRobin Murphyeach mesh counts its own events entirely independently, and additional
230ba64770SRobin MurphyPMU devices will be named arm_cmn_{1..n}.
240ba64770SRobin Murphy
250ba64770SRobin MurphyMost events are specified in a format based directly on the TRM
260ba64770SRobin Murphydefinitions - "type" selects the respective node type, and "eventid" the
270ba64770SRobin Murphyevent number. Some events require an additional occupancy ID, which is
280ba64770SRobin Murphyspecified by "occupid".
290ba64770SRobin Murphy
300ba64770SRobin Murphy* Since RN-D nodes do not have any distinct events from RN-I nodes, they
310ba64770SRobin Murphy  are treated as the same type (0xa), and the common event templates are
320ba64770SRobin Murphy  named "rnid_*".
330ba64770SRobin Murphy
340ba64770SRobin Murphy* The cycle counter is treated as a synthetic event belonging to the DTC
350ba64770SRobin Murphy  node ("type" == 0x3, "eventid" is ignored).
360ba64770SRobin Murphy
370ba64770SRobin Murphy* XP events also encode the port and channel in the "eventid" field, to
380ba64770SRobin Murphy  match the underlying pmu_event0_id encoding for the pmu_event_sel
390ba64770SRobin Murphy  register. The event templates are named with prefixes to cover all
400ba64770SRobin Murphy  permutations.
410ba64770SRobin Murphy
420ba64770SRobin MurphyBy default each event provides an aggregate count over all nodes of the
430ba64770SRobin Murphygiven type. To target a specific node, "bynodeid" must be set to 1 and
440ba64770SRobin Murphy"nodeid" to the appropriate value derived from the CMN configuration
450ba64770SRobin Murphy(as defined in the "Node ID Mapping" section of the TRM).
460ba64770SRobin Murphy
470ba64770SRobin MurphyWatchpoints
480ba64770SRobin Murphy-----------
490ba64770SRobin Murphy
500ba64770SRobin MurphyThe PMU can also count watchpoint events to monitor specific flit
510ba64770SRobin Murphytraffic. Watchpoints are treated as a synthetic event type, and like PMU
520ba64770SRobin Murphyevents can be global or targeted with a particular XP's "nodeid" value.
530ba64770SRobin MurphySince the watchpoint direction is otherwise implicit in the underlying
540ba64770SRobin Murphyregister selection, separate events are provided for flit uploads and
550ba64770SRobin Murphydownloads.
560ba64770SRobin Murphy
570ba64770SRobin MurphyThe flit match value and mask are passed in config1 and config2 ("val"
580ba64770SRobin Murphyand "mask" respectively). "wp_dev_sel", "wp_chn_sel", "wp_grp" and
590ba64770SRobin Murphy"wp_exclusive" are specified per the TRM definitions for dtm_wp_config0.
600ba64770SRobin MurphyWhere a watchpoint needs to match fields from both match groups on the
610ba64770SRobin MurphyREQ or SNP channel, it can be specified as two events - one for each
620ba64770SRobin Murphygroup - with the same nonzero "combine" value. The count for such a
630ba64770SRobin Murphypair of combined events will be attributed to the primary match.
640ba64770SRobin MurphyWatchpoint events with a "combine" value of 0 are considered independent
650ba64770SRobin Murphyand will count individually.
66