Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a33b0daa authored by Pawel Moll's avatar Pawel Moll Committed by Arnd Bergmann
Browse files

bus: ARM CCN PMU driver



Driver providing perf backend for ARM Cache Coherent Network
interconnect. Supports counting all hardware events and crosspoint
watchpoints.

Currently works with CCN-504 only, although there should be
no changes required for CCN-508 (just impossible to test it now).

Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 779ae55b
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
ARM Cache Coherent Network
==========================

CCN-504 is a ring-bus interconnect consisting of 11 crosspoints
(XPs), with each crosspoint supporting up to two device ports,
so nodes (devices) 0 and 1 are connected to crosspoint 0,
nodes 2 and 3 to crosspoint 1 etc.

PMU (perf) driver
-----------------

The CCN driver registers a perf PMU driver, which provides
description of available events and configuration options
in sysfs, see /sys/bus/event_source/devices/ccn*.

The "format" directory describes format of the config, config1
and config2 fields of the perf_event_attr structure. The "events"
directory provides configuration templates for all documented
events, that can be used with perf tool. For example "xp_valid_flit"
is an equivalent of "type=0x8,event=0x4". Other parameters must be
explicitly specified. For events originating from device, "node"
defines its index. All crosspoint events require "xp" (index),
"port" (device port number) and "vc" (virtual channel ID) and
"dir" (direction). Watchpoints (special "event" value 0xfe) also
require comparator values ("cmp_l" and "cmp_h") and "mask", being
index of the comparator mask.

Masks are defined separately from the event description
(due to limited number of the config values) in the "cmp_mask"
directory, with first 8 configurable by user and additional
4 hardcoded for the most frequent use cases.

Cycle counter is described by a "type" value 0xff and does
not require any other settings.

Example of perf tool use:

/ # perf list | grep ccn
  ccn/cycles/                                        [Kernel PMU event]
<...>
  ccn/xp_valid_flit/                                 [Kernel PMU event]
<...>

/ # perf stat -C 0 -e ccn/cycles/,ccn/xp_valid_flit,xp=1,port=0,vc=1,dir=1/ \
                                                                       sleep 1

The driver does not support sampling, therefore "perf record" will
not work. Also notice that only single cpu is being selected
("-C 0") - this is because perf framework does not support
"non-CPU related" counters (yet?) so system-wide session ("-a")
would try (and in most cases fail) to set up the same event
per each CPU.
+21 −0
Original line number Diff line number Diff line
* ARM CCN (Cache Coherent Network)

Required properties:

- compatible: (standard compatible string) should be one of:
	"arm,ccn-504"
	"arm,ccn-508"

- reg: (standard registers property) physical address and size
	(16MB) of the configuration registers block

- interrupts: (standard interrupt property) single interrupt
	generated by the control block

Example:

	ccn@0x2000000000 {
		compatible = "arm,ccn-504";
		reg = <0x20 0x00000000 0 0x1000000>;
		interrupts = <0 181 4>;
	};
+7 −0
Original line number Diff line number Diff line
@@ -50,6 +50,13 @@ config ARM_CCI
	  Driver supporting the CCI cache coherent interconnect for ARM
	  platforms.

config ARM_CCN
	bool "ARM CCN driver support"
	depends on ARM || ARM64
	help
	  PMU (perf) driver supporting the ARM CCN (Cache Coherent Network)
	  interconnect.

config VEXPRESS_CONFIG
	bool "Versatile Express configuration bus"
	default y if ARCH_VEXPRESS
+3 −1
Original line number Diff line number Diff line
@@ -9,7 +9,9 @@ obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o

# Interconnect bus driver for OMAP SoCs.
obj-$(CONFIG_OMAP_INTERCONNECT)	+= omap_l3_smx.o omap_l3_noc.o
# CCI cache coherent interconnect for ARM platforms

# Interconnect bus drivers for ARM platforms
obj-$(CONFIG_ARM_CCI)		+= arm-cci.o
obj-$(CONFIG_ARM_CCN)		+= arm-ccn.o

obj-$(CONFIG_VEXPRESS_CONFIG)	+= vexpress-config.o

drivers/bus/arm-ccn.c

0 → 100644
+1390 −0

File added.

Preview size limit exceeded, changes collapsed.