Skip to contentSkip to conversation

powerpc/powernv: Detect supported IMC units and its events

PATCH In review Madhavan Srinivasan 1 participant 1 message Jun 8, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH v10 3/10 powerpc/powernv: Detect supported IMC units and its events

Parse device tree to detect IMC units. Traverse through each IMC unit node to find supported events and corresponding unit/scale files (if any).

The device tree for IMC counters starts at the node "imc-counters". This node contains all the IMC PMU nodes and event nodes
for these IMC PMUs. The PMU nodes have an "events" property which has a phandle value for the actual events node. The events are separated from the PMU nodes to abstract out the common events. For example, PMU node "mcs0", "mcs1" etc. will contain a pointer to "nest-mcs-events" since, the events are common between these PMUs. These events have a different prefix based on their relation to different PMUs, and hence, the PMU nodes themselves contain an "events-prefix" property. The value for this property concatenated to the event name, forms the actual event name. Also, the PMU have a "reg" field as the base offset for the events which belong to this PMU. This "reg" field is added to event's "reg" field in the "events" node, which gives us the location of the counter data. Kernel code uses this offset as event configuration value.

Device tree parser code also looks for scale/unit property in the event node and passes on the value as an event attr for perf interface to use in the post processing by the perf tool. Some PMUs may have common scale and unit properties which implies that all events supported by this PMU inherit the scale and unit properties of the PMU itself. For those events, we need to set the common unit and scale values.

For failure to initialize any unit or any event, disable that unit and continue setting up the rest of them.

---
 arch/powerpc/include/asm/opal-api.h       |   6 +
 arch/powerpc/platforms/powernv/opal-imc.c | 458 +++++++++++++++++++++++++++++-
 2 files changed, 463 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/opal-api.h +6 -0
index cb3e6242a78c..aa150f03a2d7 100644
@@ -1003,6 +1003,12 @@ enum {
 	XIVE_DUMP_EMU_STATE	= 5,
 };
 
+/* In-Memory Collection Counters Type */
+enum {
+	IMC_COUNTER_PER_CHIP            = 0x10,
+	IMC_COUNTER_PER_SOCKET          = 0x20,
+};
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __OPAL_API_H */
arch/powerpc/platforms/powernv/opal-imc.c +457 -1

473 lines not on this page · raw message

Signature · 1 line
2.7.4