xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/perf/arm-cmn.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun=============================
2*4882a593SmuzhiyunArm Coherent Mesh Network PMU
3*4882a593Smuzhiyun=============================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunCMN-600 is a configurable mesh interconnect consisting of a rectangular
6*4882a593Smuzhiyungrid of crosspoints (XPs), with each crosspoint supporting up to two
7*4882a593Smuzhiyundevice ports to which various AMBA CHI agents are attached.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunCMN implements a distributed PMU design as part of its debug and trace
10*4882a593Smuzhiyunfunctionality. This consists of a local monitor (DTM) at every XP, which
11*4882a593Smuzhiyuncounts up to 4 event signals from the connected device nodes and/or the
12*4882a593SmuzhiyunXP itself. Overflow from these local counters is accumulated in up to 8
13*4882a593Smuzhiyunglobal counters implemented by the main controller (DTC), which provides
14*4882a593Smuzhiyunoverall PMU control and interrupts for global counter overflow.
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunPMU events
17*4882a593Smuzhiyun----------
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunThe PMU driver registers a single PMU device for the whole interconnect,
20*4882a593Smuzhiyunsee /sys/bus/event_source/devices/arm_cmn_0. Multi-chip systems may link
21*4882a593Smuzhiyunmore than one CMN together via external CCIX links - in this situation,
22*4882a593Smuzhiyuneach mesh counts its own events entirely independently, and additional
23*4882a593SmuzhiyunPMU devices will be named arm_cmn_{1..n}.
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunMost events are specified in a format based directly on the TRM
26*4882a593Smuzhiyundefinitions - "type" selects the respective node type, and "eventid" the
27*4882a593Smuzhiyunevent number. Some events require an additional occupancy ID, which is
28*4882a593Smuzhiyunspecified by "occupid".
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun* Since RN-D nodes do not have any distinct events from RN-I nodes, they
31*4882a593Smuzhiyun  are treated as the same type (0xa), and the common event templates are
32*4882a593Smuzhiyun  named "rnid_*".
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun* The cycle counter is treated as a synthetic event belonging to the DTC
35*4882a593Smuzhiyun  node ("type" == 0x3, "eventid" is ignored).
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun* XP events also encode the port and channel in the "eventid" field, to
38*4882a593Smuzhiyun  match the underlying pmu_event0_id encoding for the pmu_event_sel
39*4882a593Smuzhiyun  register. The event templates are named with prefixes to cover all
40*4882a593Smuzhiyun  permutations.
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunBy default each event provides an aggregate count over all nodes of the
43*4882a593Smuzhiyungiven type. To target a specific node, "bynodeid" must be set to 1 and
44*4882a593Smuzhiyun"nodeid" to the appropriate value derived from the CMN configuration
45*4882a593Smuzhiyun(as defined in the "Node ID Mapping" section of the TRM).
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunWatchpoints
48*4882a593Smuzhiyun-----------
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunThe PMU can also count watchpoint events to monitor specific flit
51*4882a593Smuzhiyuntraffic. Watchpoints are treated as a synthetic event type, and like PMU
52*4882a593Smuzhiyunevents can be global or targeted with a particular XP's "nodeid" value.
53*4882a593SmuzhiyunSince the watchpoint direction is otherwise implicit in the underlying
54*4882a593Smuzhiyunregister selection, separate events are provided for flit uploads and
55*4882a593Smuzhiyundownloads.
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunThe flit match value and mask are passed in config1 and config2 ("val"
58*4882a593Smuzhiyunand "mask" respectively). "wp_dev_sel", "wp_chn_sel", "wp_grp" and
59*4882a593Smuzhiyun"wp_exclusive" are specified per the TRM definitions for dtm_wp_config0.
60*4882a593SmuzhiyunWhere a watchpoint needs to match fields from both match groups on the
61*4882a593SmuzhiyunREQ or SNP channel, it can be specified as two events - one for each
62*4882a593Smuzhiyungroup - with the same nonzero "combine" value. The count for such a
63*4882a593Smuzhiyunpair of combined events will be attributed to the primary match.
64*4882a593SmuzhiyunWatchpoint events with a "combine" value of 0 are considered independent
65*4882a593Smuzhiyunand will count individually.
66