perfmon: added intel internal io pmu support
[vpp.git] / src / plugins / perfmon / intel / uncore.h
1 /*
2  * Copyright (c) 2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef __perfmon_intel_uncore_h__
17 #define __perfmon_intel_uncore_h__
18
19 #define foreach_intel_uncore_unit_type                                        \
20   _ (IMC, "imc", "integrated Memory Controller (iMC)", "iMC%u/%u")            \
21   _ (UPI, "upi", "Ultra Path Interconnect (UPI)", "UPI%u/%u")                 \
22   _ (IIO, "iio", "Internal IO (IIO)", "IIO%u/%u")
23
24 typedef enum
25 {
26 #define _(t, n, name, fmt) INTEL_UNCORE_UNIT_##t,
27   foreach_intel_uncore_unit_type
28 #undef _
29     INTEL_UNCORE_N_UNITS,
30 } intel_uncore_unit_type_t;
31
32 typedef struct
33 {
34   intel_uncore_unit_type_t unit_type;
35   char **unit_names;
36 } intel_uncore_unit_type_names_t;
37
38 #define PERF_INTEL_CODE(event, umask, edge, any, inv, cmask)                  \
39   ((event) | (umask) << 8 | (edge) << 18 | (any) << 21 | (inv) << 23 |        \
40    (cmask) << 24)
41
42 /* Type, EventCode, UMask, ch_mask, fc_mask, name, suffix, description */
43 #define foreach_intel_uncore_event                                            \
44   _ (IMC, 0x04, 0x03, 0, 0, UNC_M_CAS_COUNT, RD,                              \
45      "All DRAM Read CAS Commands issued (including underfills)")              \
46   _ (IMC, 0x04, 0x0c, 0, 0, UNC_M_CAS_COUNT, WR,                              \
47      "All DRAM Write CAS commands issued")                                    \
48   _ (IMC, 0x04, 0x0f, 0, 0, UNC_M_CAS_COUNT, ALL,                             \
49      "All DRAM CAS commands issued")                                          \
50   _ (IIO, 0x83, 0x01, 0x1, 0x7, UNC_IIO_DATA_REQ_OF_CPU_PART0, WR,            \
51      "Four byte data request of the CPU : Card writing to DRAM")              \
52   _ (IIO, 0x83, 0x01, 0x2, 0x7, UNC_IIO_DATA_REQ_OF_CPU_PART1, WR,            \
53      "Four byte data request of the CPU : Card writing to DRAM")              \
54   _ (IIO, 0x83, 0x01, 0x4, 0x7, UNC_IIO_DATA_REQ_OF_CPU_PART2, WR,            \
55      "Four byte data request of the CPU : Card writing to DRAM")              \
56   _ (IIO, 0x83, 0x01, 0x8, 0x7, UNC_IIO_DATA_REQ_OF_CPU_PART3, WR,            \
57      "Four byte data request of the CPU : Card writing to DRAM")              \
58   _ (IIO, 0x83, 0x04, 0x1, 0x7, UNC_IIO_DATA_REQ_OF_CPU_PART0, RD,            \
59      "Four byte data request of the CPU : Card reading from DRAM")            \
60   _ (IIO, 0x83, 0x04, 0x2, 0x7, UNC_IIO_DATA_REQ_OF_CPU_PART1, RD,            \
61      "Four byte data request of the CPU : Card reading from DRAM")            \
62   _ (IIO, 0x83, 0x04, 0x4, 0x7, UNC_IIO_DATA_REQ_OF_CPU_PART2, RD,            \
63      "Four byte data request of the CPU : Card reading from DRAM")            \
64   _ (IIO, 0x83, 0x04, 0x8, 0x7, UNC_IIO_DATA_REQ_OF_CPU_PART3, RD,            \
65      "Four byte data request of the CPU : Card reading from DRAM")            \
66   _ (IIO, 0xC0, 0x01, 0x1, 0x7, UNC_IIO_DATA_REQ_BY_CPU_PART0, WR,            \
67      "Data requested by the CPU : Core writing to Card's MMIO space")         \
68   _ (IIO, 0xC0, 0x01, 0x2, 0x7, UNC_IIO_DATA_REQ_BY_CPU_PART1, WR,            \
69      "Data requested by the CPU : Core writing to Card's MMIO space")         \
70   _ (IIO, 0xC0, 0x01, 0x4, 0x7, UNC_IIO_DATA_REQ_BY_CPU_PART2, WR,            \
71      "Data requested by the CPU : Core writing to Card's MMIO space")         \
72   _ (IIO, 0xC0, 0x01, 0x8, 0x7, UNC_IIO_DATA_REQ_BY_CPU_PART3, WR,            \
73      "Data requested by the CPU : Core writing to Card's MMIO space")         \
74   _ (IIO, 0x83, 0x80, 0x1, 0x7, UNC_IIO_DATA_REQ_BY_CPU_PART0, RD,            \
75      "Data requested by the CPU : Core reading from Card's MMIO space")       \
76   _ (IIO, 0x83, 0x80, 0x2, 0x7, UNC_IIO_DATA_REQ_BY_CPU_PART1, RD,            \
77      "Data requested by the CPU : Core reading from Card's MMIO space")       \
78   _ (IIO, 0x83, 0x80, 0x4, 0x7, UNC_IIO_DATA_REQ_BY_CPU_PART2, RD,            \
79      "Data requested by the CPU : Core reading from Card's MMIO space")       \
80   _ (IIO, 0x83, 0x80, 0x8, 0x7, UNC_IIO_DATA_REQ_BY_CPU_PART3, RD,            \
81      "Data requested by the CPU : Core reading from Card's MMIO space")
82
83 typedef enum
84 {
85 #define _(unit, event, umask, ch_mask, fc_mask, name, suffix, desc)           \
86   INTEL_UNCORE_E_##unit##_##name##_##suffix,
87   foreach_intel_uncore_event
88 #undef _
89     INTEL_UNCORE_N_EVENTS,
90 } perfmon_intel_uncore_event_index_t;
91
92 #endif