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