xref: /linux/arch/s390/kernel/perf_cpum_cf_events.c (revision c716832513f30430179b60ac5ffd203c53f7eb40)
1*c7168325SHendrik Brueckner /*
2*c7168325SHendrik Brueckner  * Perf PMU sysfs events attributes for available CPU-measurement counters
3*c7168325SHendrik Brueckner  *
4*c7168325SHendrik Brueckner  */
5*c7168325SHendrik Brueckner 
6*c7168325SHendrik Brueckner #include <linux/slab.h>
7*c7168325SHendrik Brueckner #include <linux/perf_event.h>
8*c7168325SHendrik Brueckner 
9*c7168325SHendrik Brueckner 
10*c7168325SHendrik Brueckner /* BEGIN: CPUM_CF COUNTER DEFINITIONS =================================== */
11*c7168325SHendrik Brueckner 
12*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, CPU_CYCLES, 0x0000);
13*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, INSTRUCTIONS, 0x0001);
14*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, L1I_DIR_WRITES, 0x0002);
15*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, L1I_PENALTY_CYCLES, 0x0003);
16*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_CPU_CYCLES, 0x0020);
17*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_INSTRUCTIONS, 0x0021);
18*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_L1I_DIR_WRITES, 0x0022);
19*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_L1I_PENALTY_CYCLES, 0x0023);
20*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_L1D_DIR_WRITES, 0x0024);
21*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_L1D_PENALTY_CYCLES, 0x0025);
22*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, L1D_DIR_WRITES, 0x0004);
23*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, L1D_PENALTY_CYCLES, 0x0005);
24*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PRNG_FUNCTIONS, 0x0040);
25*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PRNG_CYCLES, 0x0041);
26*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PRNG_BLOCKED_FUNCTIONS, 0x0042);
27*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, PRNG_BLOCKED_CYCLES, 0x0043);
28*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, SHA_FUNCTIONS, 0x0044);
29*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, SHA_CYCLES, 0x0045);
30*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, SHA_BLOCKED_FUNCTIONS, 0x0046);
31*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, SHA_BLOCKED_CYCLES, 0x0047);
32*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, DEA_FUNCTIONS, 0x0048);
33*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, DEA_CYCLES, 0x0049);
34*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, DEA_BLOCKED_FUNCTIONS, 0x004a);
35*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, DEA_BLOCKED_CYCLES, 0x004b);
36*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, AES_FUNCTIONS, 0x004c);
37*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, AES_CYCLES, 0x004d);
38*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, AES_BLOCKED_FUNCTIONS, 0x004e);
39*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf, AES_BLOCKED_CYCLES, 0x004f);
40*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1I_L2_SOURCED_WRITES, 0x0080);
41*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1D_L2_SOURCED_WRITES, 0x0081);
42*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1I_L3_LOCAL_WRITES, 0x0082);
43*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1D_L3_LOCAL_WRITES, 0x0083);
44*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1I_L3_REMOTE_WRITES, 0x0084);
45*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1D_L3_REMOTE_WRITES, 0x0085);
46*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1D_LMEM_SOURCED_WRITES, 0x0086);
47*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1I_LMEM_SOURCED_WRITES, 0x0087);
48*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1D_RO_EXCL_WRITES, 0x0088);
49*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L1I_CACHELINE_INVALIDATES, 0x0089);
50*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, ITLB1_WRITES, 0x008a);
51*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, DTLB1_WRITES, 0x008b);
52*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, TLB2_PTE_WRITES, 0x008c);
53*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, TLB2_CRSTE_WRITES, 0x008d);
54*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, TLB2_CRSTE_HPAGE_WRITES, 0x008e);
55*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, ITLB1_MISSES, 0x0091);
56*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, DTLB1_MISSES, 0x0092);
57*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z10, L2C_STORES_SENT, 0x0093);
58*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1D_L2_SOURCED_WRITES, 0x0080);
59*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1I_L2_SOURCED_WRITES, 0x0081);
60*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, DTLB1_MISSES, 0x0082);
61*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, ITLB1_MISSES, 0x0083);
62*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L2C_STORES_SENT, 0x0085);
63*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1D_OFFBOOK_L3_SOURCED_WRITES, 0x0086);
64*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1D_ONBOOK_L4_SOURCED_WRITES, 0x0087);
65*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1I_ONBOOK_L4_SOURCED_WRITES, 0x0088);
66*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1D_RO_EXCL_WRITES, 0x0089);
67*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1D_OFFBOOK_L4_SOURCED_WRITES, 0x008a);
68*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1I_OFFBOOK_L4_SOURCED_WRITES, 0x008b);
69*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, DTLB1_HPAGE_WRITES, 0x008c);
70*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1D_LMEM_SOURCED_WRITES, 0x008d);
71*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1I_LMEM_SOURCED_WRITES, 0x008e);
72*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1I_OFFBOOK_L3_SOURCED_WRITES, 0x008f);
73*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, DTLB1_WRITES, 0x0090);
74*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, ITLB1_WRITES, 0x0091);
75*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, TLB2_PTE_WRITES, 0x0092);
76*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, TLB2_CRSTE_HPAGE_WRITES, 0x0093);
77*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, TLB2_CRSTE_WRITES, 0x0094);
78*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1D_ONCHIP_L3_SOURCED_WRITES, 0x0096);
79*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1D_OFFCHIP_L3_SOURCED_WRITES, 0x0098);
80*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1I_ONCHIP_L3_SOURCED_WRITES, 0x0099);
81*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_z196, L1I_OFFCHIP_L3_SOURCED_WRITES, 0x009b);
82*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, DTLB1_MISSES, 0x0080);
83*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, ITLB1_MISSES, 0x0081);
84*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_L2I_SOURCED_WRITES, 0x0082);
85*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_L2I_SOURCED_WRITES, 0x0083);
86*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_L2D_SOURCED_WRITES, 0x0084);
87*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, DTLB1_WRITES, 0x0085);
88*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_LMEM_SOURCED_WRITES, 0x0087);
89*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_LMEM_SOURCED_WRITES, 0x0089);
90*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_RO_EXCL_WRITES, 0x008a);
91*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, DTLB1_HPAGE_WRITES, 0x008b);
92*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, ITLB1_WRITES, 0x008c);
93*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, TLB2_PTE_WRITES, 0x008d);
94*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, TLB2_CRSTE_HPAGE_WRITES, 0x008e);
95*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, TLB2_CRSTE_WRITES, 0x008f);
96*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_ONCHIP_L3_SOURCED_WRITES, 0x0090);
97*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFCHIP_L3_SOURCED_WRITES, 0x0091);
98*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFBOOK_L3_SOURCED_WRITES, 0x0092);
99*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_ONBOOK_L4_SOURCED_WRITES, 0x0093);
100*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFBOOK_L4_SOURCED_WRITES, 0x0094);
101*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, TX_NC_TEND, 0x0095);
102*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_ONCHIP_L3_SOURCED_WRITES_IV, 0x0096);
103*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFCHIP_L3_SOURCED_WRITES_IV, 0x0097);
104*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFBOOK_L3_SOURCED_WRITES_IV, 0x0098);
105*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_ONCHIP_L3_SOURCED_WRITES, 0x0099);
106*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFCHIP_L3_SOURCED_WRITES, 0x009a);
107*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFBOOK_L3_SOURCED_WRITES, 0x009b);
108*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_ONBOOK_L4_SOURCED_WRITES, 0x009c);
109*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFBOOK_L4_SOURCED_WRITES, 0x009d);
110*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, TX_C_TEND, 0x009e);
111*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_ONCHIP_L3_SOURCED_WRITES_IV, 0x009f);
112*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFCHIP_L3_SOURCED_WRITES_IV, 0x00a0);
113*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFBOOK_L3_SOURCED_WRITES_IV, 0x00a1);
114*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, TX_NC_TABORT, 0x00b1);
115*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, TX_C_TABORT_NO_SPECIAL, 0x00b2);
116*c7168325SHendrik Brueckner CPUMF_EVENT_ATTR(cf_zec12, TX_C_TABORT_SPECIAL, 0x00b3);
117*c7168325SHendrik Brueckner 
118*c7168325SHendrik Brueckner static struct attribute *cpumcf_pmu_event_attr[] = {
119*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, CPU_CYCLES),
120*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, INSTRUCTIONS),
121*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, L1I_DIR_WRITES),
122*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, L1I_PENALTY_CYCLES),
123*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PROBLEM_STATE_CPU_CYCLES),
124*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PROBLEM_STATE_INSTRUCTIONS),
125*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PROBLEM_STATE_L1I_DIR_WRITES),
126*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PROBLEM_STATE_L1I_PENALTY_CYCLES),
127*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PROBLEM_STATE_L1D_DIR_WRITES),
128*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PROBLEM_STATE_L1D_PENALTY_CYCLES),
129*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, L1D_DIR_WRITES),
130*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, L1D_PENALTY_CYCLES),
131*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PRNG_FUNCTIONS),
132*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PRNG_CYCLES),
133*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PRNG_BLOCKED_FUNCTIONS),
134*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, PRNG_BLOCKED_CYCLES),
135*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, SHA_FUNCTIONS),
136*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, SHA_CYCLES),
137*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, SHA_BLOCKED_FUNCTIONS),
138*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, SHA_BLOCKED_CYCLES),
139*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, DEA_FUNCTIONS),
140*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, DEA_CYCLES),
141*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, DEA_BLOCKED_FUNCTIONS),
142*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, DEA_BLOCKED_CYCLES),
143*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, AES_FUNCTIONS),
144*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, AES_CYCLES),
145*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, AES_BLOCKED_FUNCTIONS),
146*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf, AES_BLOCKED_CYCLES),
147*c7168325SHendrik Brueckner 	NULL,
148*c7168325SHendrik Brueckner };
149*c7168325SHendrik Brueckner 
150*c7168325SHendrik Brueckner static struct attribute *cpumcf_z10_pmu_event_attr[] __initdata = {
151*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1I_L2_SOURCED_WRITES),
152*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1D_L2_SOURCED_WRITES),
153*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1I_L3_LOCAL_WRITES),
154*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1D_L3_LOCAL_WRITES),
155*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1I_L3_REMOTE_WRITES),
156*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1D_L3_REMOTE_WRITES),
157*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1D_LMEM_SOURCED_WRITES),
158*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1I_LMEM_SOURCED_WRITES),
159*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1D_RO_EXCL_WRITES),
160*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L1I_CACHELINE_INVALIDATES),
161*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, ITLB1_WRITES),
162*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, DTLB1_WRITES),
163*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, TLB2_PTE_WRITES),
164*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, TLB2_CRSTE_WRITES),
165*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, TLB2_CRSTE_HPAGE_WRITES),
166*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, ITLB1_MISSES),
167*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, DTLB1_MISSES),
168*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z10, L2C_STORES_SENT),
169*c7168325SHendrik Brueckner 	NULL,
170*c7168325SHendrik Brueckner };
171*c7168325SHendrik Brueckner 
172*c7168325SHendrik Brueckner static struct attribute *cpumcf_z196_pmu_event_attr[] __initdata = {
173*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1D_L2_SOURCED_WRITES),
174*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1I_L2_SOURCED_WRITES),
175*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, DTLB1_MISSES),
176*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, ITLB1_MISSES),
177*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L2C_STORES_SENT),
178*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1D_OFFBOOK_L3_SOURCED_WRITES),
179*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1D_ONBOOK_L4_SOURCED_WRITES),
180*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1I_ONBOOK_L4_SOURCED_WRITES),
181*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1D_RO_EXCL_WRITES),
182*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1D_OFFBOOK_L4_SOURCED_WRITES),
183*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1I_OFFBOOK_L4_SOURCED_WRITES),
184*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, DTLB1_HPAGE_WRITES),
185*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1D_LMEM_SOURCED_WRITES),
186*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1I_LMEM_SOURCED_WRITES),
187*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1I_OFFBOOK_L3_SOURCED_WRITES),
188*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, DTLB1_WRITES),
189*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, ITLB1_WRITES),
190*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, TLB2_PTE_WRITES),
191*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, TLB2_CRSTE_HPAGE_WRITES),
192*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, TLB2_CRSTE_WRITES),
193*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1D_ONCHIP_L3_SOURCED_WRITES),
194*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1D_OFFCHIP_L3_SOURCED_WRITES),
195*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1I_ONCHIP_L3_SOURCED_WRITES),
196*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_z196, L1I_OFFCHIP_L3_SOURCED_WRITES),
197*c7168325SHendrik Brueckner 	NULL,
198*c7168325SHendrik Brueckner };
199*c7168325SHendrik Brueckner 
200*c7168325SHendrik Brueckner static struct attribute *cpumcf_zec12_pmu_event_attr[] __initdata = {
201*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, DTLB1_MISSES),
202*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, ITLB1_MISSES),
203*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_L2I_SOURCED_WRITES),
204*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_L2I_SOURCED_WRITES),
205*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_L2D_SOURCED_WRITES),
206*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, DTLB1_WRITES),
207*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_LMEM_SOURCED_WRITES),
208*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_LMEM_SOURCED_WRITES),
209*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_RO_EXCL_WRITES),
210*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, DTLB1_HPAGE_WRITES),
211*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, ITLB1_WRITES),
212*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, TLB2_PTE_WRITES),
213*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, TLB2_CRSTE_HPAGE_WRITES),
214*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, TLB2_CRSTE_WRITES),
215*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_ONCHIP_L3_SOURCED_WRITES),
216*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_OFFCHIP_L3_SOURCED_WRITES),
217*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_OFFBOOK_L3_SOURCED_WRITES),
218*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_ONBOOK_L4_SOURCED_WRITES),
219*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_OFFBOOK_L4_SOURCED_WRITES),
220*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, TX_NC_TEND),
221*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_ONCHIP_L3_SOURCED_WRITES_IV),
222*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_OFFCHIP_L3_SOURCED_WRITES_IV),
223*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1D_OFFBOOK_L3_SOURCED_WRITES_IV),
224*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_ONCHIP_L3_SOURCED_WRITES),
225*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_OFFCHIP_L3_SOURCED_WRITES),
226*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_OFFBOOK_L3_SOURCED_WRITES),
227*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_ONBOOK_L4_SOURCED_WRITES),
228*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_OFFBOOK_L4_SOURCED_WRITES),
229*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, TX_C_TEND),
230*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_ONCHIP_L3_SOURCED_WRITES_IV),
231*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_OFFCHIP_L3_SOURCED_WRITES_IV),
232*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, L1I_OFFBOOK_L3_SOURCED_WRITES_IV),
233*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, TX_NC_TABORT),
234*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, TX_C_TABORT_NO_SPECIAL),
235*c7168325SHendrik Brueckner 	CPUMF_EVENT_PTR(cf_zec12, TX_C_TABORT_SPECIAL),
236*c7168325SHendrik Brueckner 	NULL,
237*c7168325SHendrik Brueckner };
238*c7168325SHendrik Brueckner 
239*c7168325SHendrik Brueckner /* END: CPUM_CF COUNTER DEFINITIONS ===================================== */
240*c7168325SHendrik Brueckner 
241*c7168325SHendrik Brueckner static struct attribute_group cpumsf_pmu_events_group = {
242*c7168325SHendrik Brueckner 	.name = "events",
243*c7168325SHendrik Brueckner 	.attrs = cpumcf_pmu_event_attr,
244*c7168325SHendrik Brueckner };
245*c7168325SHendrik Brueckner 
246*c7168325SHendrik Brueckner PMU_FORMAT_ATTR(event, "config:0-63");
247*c7168325SHendrik Brueckner 
248*c7168325SHendrik Brueckner static struct attribute *cpumsf_pmu_format_attr[] = {
249*c7168325SHendrik Brueckner 	&format_attr_event.attr,
250*c7168325SHendrik Brueckner 	NULL,
251*c7168325SHendrik Brueckner };
252*c7168325SHendrik Brueckner 
253*c7168325SHendrik Brueckner static struct attribute_group cpumsf_pmu_format_group = {
254*c7168325SHendrik Brueckner 	.name = "format",
255*c7168325SHendrik Brueckner 	.attrs = cpumsf_pmu_format_attr,
256*c7168325SHendrik Brueckner };
257*c7168325SHendrik Brueckner 
258*c7168325SHendrik Brueckner static const struct attribute_group *cpumsf_pmu_attr_groups[] = {
259*c7168325SHendrik Brueckner 	&cpumsf_pmu_events_group,
260*c7168325SHendrik Brueckner 	&cpumsf_pmu_format_group,
261*c7168325SHendrik Brueckner 	NULL,
262*c7168325SHendrik Brueckner };
263*c7168325SHendrik Brueckner 
264*c7168325SHendrik Brueckner 
265*c7168325SHendrik Brueckner static __init struct attribute **merge_attr(struct attribute **a,
266*c7168325SHendrik Brueckner 					    struct attribute **b)
267*c7168325SHendrik Brueckner {
268*c7168325SHendrik Brueckner 	struct attribute **new;
269*c7168325SHendrik Brueckner 	int j, i;
270*c7168325SHendrik Brueckner 
271*c7168325SHendrik Brueckner 	for (j = 0; a[j]; j++)
272*c7168325SHendrik Brueckner 		;
273*c7168325SHendrik Brueckner 	for (i = 0; b[i]; i++)
274*c7168325SHendrik Brueckner 		j++;
275*c7168325SHendrik Brueckner 	j++;
276*c7168325SHendrik Brueckner 
277*c7168325SHendrik Brueckner 	new = kmalloc(sizeof(struct attribute *) * j, GFP_KERNEL);
278*c7168325SHendrik Brueckner 	if (!new)
279*c7168325SHendrik Brueckner 		return NULL;
280*c7168325SHendrik Brueckner 	j = 0;
281*c7168325SHendrik Brueckner 	for (i = 0; a[i]; i++)
282*c7168325SHendrik Brueckner 		new[j++] = a[i];
283*c7168325SHendrik Brueckner 	for (i = 0; b[i]; i++)
284*c7168325SHendrik Brueckner 		new[j++] = b[i];
285*c7168325SHendrik Brueckner 	new[j] = NULL;
286*c7168325SHendrik Brueckner 
287*c7168325SHendrik Brueckner 	return new;
288*c7168325SHendrik Brueckner }
289*c7168325SHendrik Brueckner 
290*c7168325SHendrik Brueckner __init const struct attribute_group **cpumf_cf_event_group(void)
291*c7168325SHendrik Brueckner {
292*c7168325SHendrik Brueckner 	struct attribute **combined, **model;
293*c7168325SHendrik Brueckner 	struct cpuid cpu_id;
294*c7168325SHendrik Brueckner 
295*c7168325SHendrik Brueckner 	get_cpu_id(&cpu_id);
296*c7168325SHendrik Brueckner 	switch (cpu_id.machine) {
297*c7168325SHendrik Brueckner 	case 0x2097:
298*c7168325SHendrik Brueckner 	case 0x2098:
299*c7168325SHendrik Brueckner 		model = cpumcf_z10_pmu_event_attr;
300*c7168325SHendrik Brueckner 		break;
301*c7168325SHendrik Brueckner 	case 0x2817:
302*c7168325SHendrik Brueckner 	case 0x2818:
303*c7168325SHendrik Brueckner 		model = cpumcf_z196_pmu_event_attr;
304*c7168325SHendrik Brueckner 		break;
305*c7168325SHendrik Brueckner 	case 0x2827:
306*c7168325SHendrik Brueckner 	case 0x2828:
307*c7168325SHendrik Brueckner 		model = cpumcf_zec12_pmu_event_attr;
308*c7168325SHendrik Brueckner 		break;
309*c7168325SHendrik Brueckner 	default:
310*c7168325SHendrik Brueckner 		model = NULL;
311*c7168325SHendrik Brueckner 		break;
312*c7168325SHendrik Brueckner 	};
313*c7168325SHendrik Brueckner 
314*c7168325SHendrik Brueckner 	if (!model)
315*c7168325SHendrik Brueckner 		goto out;
316*c7168325SHendrik Brueckner 
317*c7168325SHendrik Brueckner 	combined = merge_attr(cpumcf_pmu_event_attr, model);
318*c7168325SHendrik Brueckner 	if (combined)
319*c7168325SHendrik Brueckner 		cpumsf_pmu_events_group.attrs = combined;
320*c7168325SHendrik Brueckner out:
321*c7168325SHendrik Brueckner 	return cpumsf_pmu_attr_groups;
322*c7168325SHendrik Brueckner }
323