PAPI 7.1.0.0
Loading...
Searching...
No Matches
pfmlib_montecito.h
Go to the documentation of this file.
1/*
2 * Dual-Core Itanium 2 PMU specific types and definitions
3 *
4 * Copyright (c) 2005-2006 Hewlett-Packard Development Company, L.P.
5 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11 * of the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24#ifndef __PFMLIB_MONTECITO_H__
25#define __PFMLIB_MONTECITO_H__
26
27#include <perfmon/pfmlib.h>
28#include <endian.h>
29
30#if BYTE_ORDER != LITTLE_ENDIAN
31#error "this file only supports little endian environments"
32#endif
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#define PMU_MONT_FIRST_COUNTER 4 /* index of first PMC/PMD counter */
38#define PMU_MONT_NUM_COUNTERS 12 /* total numbers of PMC/PMD pairs used as counting monitors */
39#define PMU_MONT_NUM_PMCS 27 /* total number of PMCS defined */
40#define PMU_MONT_NUM_PMDS 36 /* total number of PMDS defined */
41#define PMU_MONT_NUM_ETB 16 /* total number of PMDS in ETB */
42#define PMU_MONT_COUNTER_WIDTH 47 /* hardware counter bit width */
43
44/*
45 * This structure provides a detailed way to setup a PMC register.
46 * Once value is loaded, it must be copied (via pmu_reg) to the
47 * perfmon_req_t and passed to the kernel via perfmonctl().
48 */
49typedef union {
50 unsigned long pmc_val; /* complete register value */
51
52 /* This is the Montecito-specific PMC layout for counters PMC4-PMC15 */
53 struct {
54 unsigned long pmc_plm:4; /* privilege level mask */
55 unsigned long pmc_ev:1; /* external visibility */
56 unsigned long pmc_oi:1; /* overflow interrupt */
57 unsigned long pmc_pm:1; /* privileged monitor */
58 unsigned long pmc_ig1:1; /* ignored */
59 unsigned long pmc_es:8; /* event select */
60 unsigned long pmc_umask:4; /* unit mask */
61 unsigned long pmc_thres:3; /* threshold */
62 unsigned long pmc_ig2:1; /* ignored */
63 unsigned long pmc_ism:2; /* instruction set: must be 2 */
64 unsigned long pmc_all:1; /* 0=only self, 1=both threads */
65 unsigned long pmc_i:1; /* Invalidate */
66 unsigned long pmc_s:1; /* Shared */
67 unsigned long pmc_e:1; /* Exclusive */
68 unsigned long pmc_m:1; /* Modified */
69 unsigned long pmc_res3:33; /* reserved */
70 } pmc_mont_counter_reg;
71
72 /* opcode matchers mask registers */
73 struct {
74 unsigned long opcm_mask:41; /* opcode mask */
75 unsigned long opcm_ig1:7; /* ignored */
76 unsigned long opcm_b:1; /* B-syllable */
77 unsigned long opcm_f:1; /* F-syllable */
78 unsigned long opcm_i:1; /* I-syllable */
79 unsigned long opcm_m:1; /* M-syllable */
80 unsigned long opcm_ig2:4; /* ignored */
81 unsigned long opcm_inv:1; /* inverse range for ibrp0 */
82 unsigned long opcm_ig_ad:1; /* ignore address range restrictions */
83 unsigned long opcm_ig3:6; /* ignored */
84 } pmc32_34_mont_reg;
85
86 /* opcode matchers match registers */
87 struct {
88 unsigned long opcm_match:41; /* opcode match */
89 unsigned long opcm_ig1:23; /* ignored */
90 } pmc33_35_mont_reg;
91
92 /* opcode matcher config register */
93 struct {
94 unsigned long opcm_ch0_ig_opcm:1; /* chan0 opcode constraint */
95 unsigned long opcm_ch1_ig_opcm:1; /* chan1 opcode constraint */
96 unsigned long opcm_ch2_ig_opcm:1; /* chan2 opcode constraint */
97 unsigned long opcm_ch3_ig_opcm:1; /* chan3 opcode constraint */
98 unsigned long opcm_res:28; /* reserved */
99 unsigned long opcm_ig:32; /* ignored */
100 } pmc36_mont_reg;
101
102 /*
103 * instruction event address register configuration (I-EAR)
104 *
105 * The register has two layouts depending on the value of the ct field.
106 * In cache mode(ct=1x):
107 * - ct is 1 bit, umask is 8 bits
108 * In TLB mode (ct=0x):
109 * - ct is 2 bits, umask is 7 bits
110 * ct=11 => cache mode using a latency filter with eighth bit set
111 * ct=01 => nothing monitored
112 *
113 * The ct=01 value is the only reason why we cannot fix the layout
114 * to ct 1 bit and umask 8 bits. Even though in TLB mode, only 6 bits
115 * are effectively used for the umask, if the user inadvertently sets
116 * a umask with the most significant bit set, it would be equivalent
117 * to no monitoring.
118 */
119 struct {
120 unsigned long iear_plm:4; /* privilege level mask */
121 unsigned long iear_pm:1; /* privileged monitor */
122 unsigned long iear_umask:8; /* event unit mask */
123 unsigned long iear_ct:1; /* =1 for i-cache */
124 unsigned long iear_res:2; /* reserved */
125 unsigned long iear_ig:48; /* ignored */
126 } pmc37_mont_cache_reg;
127
128 struct {
129 unsigned long iear_plm:4; /* privilege level mask */
130 unsigned long iear_pm:1; /* privileged monitor */
131 unsigned long iear_umask:7; /* event unit mask */
132 unsigned long iear_ct:2; /* 00=i-tlb, 01=nothing 1x=illegal */
133 unsigned long iear_res:50; /* reserved */
134 } pmc37_mont_tlb_reg;
135
136 /* data event address register configuration (D-EAR) */
137 struct {
138 unsigned long dear_plm:4; /* privilege level mask */
139 unsigned long dear_ig1:2; /* ignored */
140 unsigned long dear_pm:1; /* privileged monitor */
141 unsigned long dear_mode:2; /* mode */
142 unsigned long dear_ig2:7; /* ignored */
143 unsigned long dear_umask:4; /* unit mask */
144 unsigned long dear_ig3:4; /* ignored */
145 unsigned long dear_ism:2; /* instruction set: must be 2 */
146 unsigned long dear_ig4:38; /* ignored */
147 } pmc40_mont_reg;
148
149 /* IP event address register (IP-EAR) */
150 struct {
151 unsigned long ipear_plm:4; /* privilege level mask */
152 unsigned long ipear_ig1:2; /* ignored */
153 unsigned long ipear_pm:1; /* privileged monitor */
154 unsigned long ipear_ig2:1; /* ignored */
155 unsigned long ipear_mode:3; /* mode */
156 unsigned long ipear_delay:8; /* delay */
157 unsigned long ipear_ig3:45; /* reserved */
158 } pmc42_mont_reg;
159
160 /* execution trace buffer configuration register (ETB) */
161 struct {
162 unsigned long etbc_plm:4; /* privilege level */
163 unsigned long etbc_res1:2; /* reserved */
164 unsigned long etbc_pm:1; /* privileged monitor */
165 unsigned long etbc_ds:1; /* data selector */
166 unsigned long etbc_tm:2; /* taken mask */
167 unsigned long etbc_ptm:2; /* predicted taken address mask */
168 unsigned long etbc_ppm:2; /* predicted predicate mask */
169 unsigned long etbc_brt:2; /* branch type mask */
170 unsigned long etbc_ig:48; /* ignored */
171 } pmc39_mont_reg;
172
173 /* data address range configuration register */
174 struct {
175 unsigned long darc_res1:3; /* reserved */
176 unsigned long darc_cfg_dtag0:2; /* constraints on dbrp0 */
177 unsigned long darc_res2:6; /* reserved */
178 unsigned long darc_cfg_dtag1:2; /* constraints on dbrp1 */
179 unsigned long darc_res3:6; /* reserved */
180 unsigned long darc_cfg_dtag2:2; /* constraints on dbrp2 */
181 unsigned long darc_res4:6; /* reserved */
182 unsigned long darc_cfg_dtag3:2; /* constraints on dbrp3 */
183 unsigned long darc_res5:16; /* reserved */
184 unsigned long darc_ena_dbrp0:1; /* enable constraints dbrp0 */
185 unsigned long darc_ena_dbrp1:1; /* enable constraints dbrp1 */
186 unsigned long darc_ena_dbrp2:1; /* enable constraints dbrp2 */
187 unsigned long darc_ena_dbrp3:1; /* enable constraint dbr3 */
188 unsigned long darc_res6:15;
189 } pmc41_mont_reg;
190
191 /* instruction address range configuration register */
192 struct {
193 unsigned long iarc_res1:1; /* reserved */
194 unsigned long iarc_ig_ibrp0:1; /* constrained by ibrp0 */
195 unsigned long iarc_res2:2; /* reserved */
196 unsigned long iarc_ig_ibrp1:1; /* constrained by ibrp1 */
197 unsigned long iarc_res3:2; /* reserved */
198 unsigned long iarc_ig_ibrp2:1; /* constrained by ibrp2 */
199 unsigned long iarc_res4:2; /* reserved */
200 unsigned long iarc_ig_ibrp3:1; /* constrained by ibrp3 */
201 unsigned long iarc_res5:2; /* reserved */
202 unsigned long iarc_fine:1; /* fine mode */
203 unsigned long iarc_ig6:50; /* reserved */
204 } pmc38_mont_reg;
205
207
208typedef union {
209 unsigned long pmd_val; /* counter value */
210
211 /* counting pmd register */
212 struct {
213 unsigned long pmd_count:47; /* 47-bit hardware counter */
214 unsigned long pmd_sxt47:17; /* sign extension of bit 46 */
215 } pmd_mont_counter_reg;
216
217 /* data event address register */
218 struct {
219 unsigned long dear_daddr; /* data address */
220 } pmd32_mont_reg;
221
222 /* data event address register (D-EAR) */
223 struct {
224 unsigned long dear_latency:13; /* latency */
225 unsigned long dear_ov:1; /* latency overflow */
226 unsigned long dear_stat:2; /* status */
227 unsigned long dear_ig:48; /* ignored */
228 } pmd33_mont_reg;
229
230 /* instruction event address register (I-EAR) */
231 struct {
232 unsigned long iear_stat:2; /* status bit */
233 unsigned long iear_ig:3; /* ignored */
234 unsigned long iear_iaddr:59; /* instruction cache line address {60:51} sxt {50}*/
235 } pmd34_mont_reg;
236
237 /* instruction event address register (I-EAR) */
238 struct {
239 unsigned long iear_latency:12; /* latency */
240 unsigned long iear_ov:1; /* latency overflow */
241 unsigned long iear_ig:51; /* ignored */
242 } pmd35_mont_reg;
243
244 /* data event address register (D-EAR) */
245 struct {
246 unsigned long dear_slot:2; /* slot */
247 unsigned long dear_bn:1; /* bundle bit (if 1 add 16 to iaddr) */
248 unsigned long dear_vl:1; /* valid */
249 unsigned long dear_iaddr:60; /* instruction address (2-bundle window)*/
250 } pmd36_mont_reg;
251
252 /* execution trace buffer index register (ETB) */
253 struct {
254 unsigned long etbi_ebi:4; /* next entry index */
255 unsigned long etbi_ig1:1; /* ignored */
256 unsigned long etbi_full:1; /* ETB overflowed at least once */
257 unsigned long etbi_ig2:58; /* ignored */
258 } pmd38_mont_reg;
259
260 /* execution trace buffer extension register (ETB) */
261 struct {
262 unsigned long etb_pmd48ext_b1:1; /* pmd48 ext */
263 unsigned long etb_pmd48ext_bruflush:1; /* pmd48 ext */
264 unsigned long etb_pmd48ext_res:2; /* reserved */
265
266 unsigned long etb_pmd56ext_b1:1; /* pmd56 ext */
267 unsigned long etb_pmd56ext_bruflush:1; /* pmd56 ext */
268 unsigned long etb_pmd56ext_res:2; /* reserved */
269
270 unsigned long etb_pmd49ext_b1:1; /* pmd49 ext */
271 unsigned long etb_pmd49ext_bruflush:1; /* pmd49 ext */
272 unsigned long etb_pmd49ext_res:2; /* reserved */
273
274 unsigned long etb_pmd57ext_b1:1; /* pmd57 ext */
275 unsigned long etb_pmd57ext_bruflush:1; /* pmd57 ext */
276 unsigned long etb_pmd57ext_res:2; /* reserved */
277
278 unsigned long etb_pmd50ext_b1:1; /* pmd50 ext */
279 unsigned long etb_pmd50ext_bruflush:1; /* pmd50 ext */
280 unsigned long etb_pmd50ext_res:2; /* reserved */
281
282 unsigned long etb_pmd58ext_b1:1; /* pmd58 ext */
283 unsigned long etb_pmd58ext_bruflush:1; /* pmd58 ext */
284 unsigned long etb_pmd58ext_res:2; /* reserved */
285
286 unsigned long etb_pmd51ext_b1:1; /* pmd51 ext */
287 unsigned long etb_pmd51ext_bruflush:1; /* pmd51 ext */
288 unsigned long etb_pmd51ext_res:2; /* reserved */
289
290 unsigned long etb_pmd59ext_b1:1; /* pmd59 ext */
291 unsigned long etb_pmd59ext_bruflush:1; /* pmd59 ext */
292 unsigned long etb_pmd59ext_res:2; /* reserved */
293
294 unsigned long etb_pmd52ext_b1:1; /* pmd52 ext */
295 unsigned long etb_pmd52ext_bruflush:1; /* pmd52 ext */
296 unsigned long etb_pmd52ext_res:2; /* reserved */
297
298 unsigned long etb_pmd60ext_b1:1; /* pmd60 ext */
299 unsigned long etb_pmd60ext_bruflush:1; /* pmd60 ext */
300 unsigned long etb_pmd60ext_res:2; /* reserved */
301
302 unsigned long etb_pmd53ext_b1:1; /* pmd53 ext */
303 unsigned long etb_pmd53ext_bruflush:1; /* pmd53 ext */
304 unsigned long etb_pmd53ext_res:2; /* reserved */
305
306 unsigned long etb_pmd61ext_b1:1; /* pmd61 ext */
307 unsigned long etb_pmd61ext_bruflush:1; /* pmd61 ext */
308 unsigned long etb_pmd61ext_res:2; /* reserved */
309
310 unsigned long etb_pmd54ext_b1:1; /* pmd54 ext */
311 unsigned long etb_pmd54ext_bruflush:1; /* pmd54 ext */
312 unsigned long etb_pmd54ext_res:2; /* reserved */
313
314 unsigned long etb_pmd62ext_b1:1; /* pmd62 ext */
315 unsigned long etb_pmd62ext_bruflush:1; /* pmd62 ext */
316 unsigned long etb_pmd62ext_res:2; /* reserved */
317
318 unsigned long etb_pmd55ext_b1:1; /* pmd55 ext */
319 unsigned long etb_pmd55ext_bruflush:1; /* pmd55 ext */
320 unsigned long etb_pmd55ext_res:2; /* reserved */
321
322 unsigned long etb_pmd63ext_b1:1; /* pmd63 ext */
323 unsigned long etb_pmd63ext_bruflush:1; /* pmd63 ext */
324 unsigned long etb_pmd63ext_res:2; /* reserved */
325 } pmd39_mont_reg;
326
327 /*
328 * execution trace buffer extension register when used with IP-EAR
329 *
330 * to be used in conjunction with pmd48_63_ipear_reg (see below)
331 */
332 struct {
333 unsigned long ipear_pmd48ext_cycles:2; /* pmd48 upper 2 bits of cycles */
334 unsigned long ipear_pmd48ext_f:1; /* pmd48 flush bit */
335 unsigned long ipear_pmd48ext_ef:1; /* pmd48 early freeze */
336
337 unsigned long ipear_pmd56ext_cycles:2; /* pmd56 upper 2 bits of cycles */
338 unsigned long ipear_pmd56ext_f:1; /* pmd56 flush bit */
339 unsigned long ipear_pmd56ext_ef:1; /* pmd56 early freeze */
340
341 unsigned long ipear_pmd49ext_cycles:2; /* pmd49 upper 2 bits of cycles */
342 unsigned long ipear_pmd49ext_f:1; /* pmd49 flush bit */
343 unsigned long ipear_pmd49ext_ef:1; /* pmd49 early freeze */
344
345 unsigned long ipear_pmd57ext_cycles:2; /* pmd57 upper 2 bits of cycles */
346 unsigned long ipear_pmd57ext_f:1; /* pmd57 flush bit */
347 unsigned long ipear_pmd57ext_ef:1; /* pmd57 early freeze */
348
349 unsigned long ipear_pmd50ext_cycles:2; /* pmd50 upper 2 bits of cycles */
350 unsigned long ipear_pmd50ext_f:1; /* pmd50 flush bit */
351 unsigned long ipear_pmd50ext_ef:1; /* pmd50 early freeze */
352
353 unsigned long ipear_pmd58ext_cycles:2; /* pmd58 upper 2 bits of cycles */
354 unsigned long ipear_pmd58ext_f:1; /* pmd58 flush bit */
355 unsigned long ipear_pmd58ext_ef:1; /* pmd58 early freeze */
356
357 unsigned long ipear_pmd51ext_cycles:2; /* pmd51 upper 2 bits of cycles */
358 unsigned long ipear_pmd51ext_f:1; /* pmd51 flush bit */
359 unsigned long ipear_pmd51ext_ef:1; /* pmd51 early freeze */
360
361 unsigned long ipear_pmd59ext_cycles:2; /* pmd59 upper 2 bits of cycles */
362 unsigned long ipear_pmd59ext_f:1; /* pmd59 flush bit */
363 unsigned long ipear_pmd59ext_ef:1; /* pmd59 early freeze */
364
365 unsigned long ipear_pmd52ext_cycles:2; /* pmd52 upper 2 bits of cycles */
366 unsigned long ipear_pmd52ext_f:1; /* pmd52 flush bit */
367 unsigned long ipear_pmd52ext_ef:1; /* pmd52 early freeze */
368
369 unsigned long ipear_pmd60ext_cycles:2; /* pmd60 upper 2 bits of cycles */
370 unsigned long ipear_pmd60ext_f:1; /* pmd60 flush bit */
371 unsigned long ipear_pmd60ext_ef:1; /* pmd60 early freeze */
372
373 unsigned long ipear_pmd53ext_cycles:2; /* pmd53 upper 2 bits of cycles */
374 unsigned long ipear_pmd53ext_f:1; /* pmd53 flush bit */
375 unsigned long ipear_pmd53ext_ef:1; /* pmd53 early freeze */
376
377 unsigned long ipear_pmd61ext_cycles:2; /* pmd61 upper 2 bits of cycles */
378 unsigned long ipear_pmd61ext_f:1; /* pmd61 flush bit */
379 unsigned long ipear_pmd61ext_ef:1; /* pmd61 early freeze */
380
381 unsigned long ipear_pmd54ext_cycles:2; /* pmd54 upper 2 bits of cycles */
382 unsigned long ipear_pmd54ext_f:1; /* pmd54 flush bit */
383 unsigned long ipear_pmd54ext_ef:1; /* pmd54 early freeze */
384
385 unsigned long ipear_pmd62ext_cycles:2; /* pmd62 upper 2 bits of cycles */
386 unsigned long ipear_pmd62ext_f:1; /* pmd62 flush bit */
387 unsigned long ipear_pmd62ext_ef:1; /* pmd62 early freeze */
388
389 unsigned long ipear_pmd55ext_cycles:2; /* pmd55 upper 2 bits of cycles */
390 unsigned long ipear_pmd55ext_f:1; /* pmd55 flush bit */
391 unsigned long ipear_pmd55ext_ef:1; /* pmd55 early freeze */
392
393 unsigned long ipear_pmd63ext_cycles:2; /* pmd63 upper 2 bits of cycles */
394 unsigned long ipear_pmd63ext_f:1; /* pmd63 flush bit */
395 unsigned long ipear_pmd63ext_ef:1; /* pmd63 early freeze */
396 } pmd39_ipear_mont_reg;
397
398 /*
399 * execution trace buffer data register (ETB)
400 *
401 * when pmc39.ds == 0: pmd48-63 contains branch targets
402 * when pmc39.ds == 1: pmd48-63 content is undefined
403 */
404 struct {
405 unsigned long etb_s:1; /* source bit */
406 unsigned long etb_mp:1; /* mispredict bit */
407 unsigned long etb_slot:2; /* which slot, 3=not taken branch */
408 unsigned long etb_addr:60; /* bundle address(s=1), target address(s=0) */
409 } pmd48_63_etb_mont_reg;
410
411 /*
412 * execution trace buffer when used with IP-EAR with PMD48-63.ef=0
413 *
414 * The cycles field straddles pmdXX and corresponding extension in
415 * pmd39 (pmd39_ipear_mont_reg). For instance, cycles for pmd48:
416 *
417 * cycles= pmd39_ipear_mont_reg.etb_pmd48ext_cycles << 4
418 * | pmd48_63_etb_ipear_mont_reg.etb_cycles
419 */
420 struct {
421 unsigned long ipear_addr:60; /* retired IP[63:4] */
422 unsigned long ipear_cycles:4; /* lower 4 bit of cycles */
423 } pmd48_63_ipear_mont_reg;
424
425 /*
426 * execution trace buffer when used with IP-EAR with PMD48-63.ef=1
427 *
428 * The cycles field straddles pmdXX and corresponding extension in
429 * pmd39 (pmd39_ipear_mont_reg). For instance, cycles for pmd48:
430 *
431 * cycles= pmd39_ipear_mont_reg.etb_pmd48ext_cycles << 4
432 * | pmd48_63_etb_ipear_ef_mont_reg.etb_cycles
433 */
434
435 struct {
436 unsigned long ipear_delay:8; /* delay count */
437 unsigned long ipear_addr:52; /* retired IP[61:12] */
438 unsigned long ipear_cycles:4; /* lower 5 bit of cycles */
439 } pmd48_63_ipear_ef_mont_reg;
440
442
443typedef struct {
444 unsigned int flags; /* counter specific flags */
445 unsigned int thres; /* per event threshold */
447
448/*
449 * counter specific flags
450 */
451#define PFMLIB_MONT_FL_EVT_NO_QUALCHECK 0x1 /* don't check qualifier constraints */
452#define PFMLIB_MONT_FL_EVT_ALL_THRD 0x2 /* event measured for both threads */
453#define PFMLIB_MONT_FL_EVT_ACTIVE_ONLY 0x4 /* measure the event only when the thread is active */
454#define PFMLIB_MONT_FL_EVT_ALWAYS 0x8 /* measure the event at all times (active or inactive) */
455
456/*
457 *
458 * The ETB can be configured via 4 different methods:
459 *
460 * - BRANCH_EVENT is in the event list, pfp_mont_etb.etb_used == 0:
461 * The ETB will be configured (PMC12) to record all branches AND a counting
462 * monitor will be setup to count BRANCH_EVENT.
463 *
464 * - BRANCH_EVENT is in the event list, pfp_mont_etb.etb_used == 1:
465 * The ETB will be configured (PMC12) according to information in pfp_mont_etb AND
466 * a counter will be setup to count BRANCH_EVENT.
467 *
468 * - BRANCH_EVENT is NOT in the event list, pfp_mont_etb.etb_used == 0:
469 * Nothing is programmed
470 *
471 * - BRANCH_EVENT is NOT in the event list, pfp_mont_etb.etb_used == 1:
472 * The ETB will be configured (PMC12) according to information in pfp_mont_etb.
473 * This is the free running ETB mode.
474 */
475typedef struct {
476 unsigned char etb_used; /* set to 1 if the ETB is used */
477 unsigned int etb_plm; /* ETB privilege level mask */
478 unsigned char etb_tm; /* taken mask */
479 unsigned char etb_ptm; /* predicted target mask */
480 unsigned char etb_ppm; /* predicted predicate mask */
481 unsigned char etb_brt; /* branch type mask */
483
484/*
485 * There are four ways to configure EAR:
486 *
487 * - an EAR event is in the event list AND pfp_mont_?ear.ear_used = 0:
488 * The EAR will be programmed (PMC37 or PMC40) based on the information encoded in the
489 * event (umask, cache, tlb,alat). A counting monitor will be programmed to
490 * count DATA_EAR_EVENTS or L1I_EAR_EVENTS depending on the type of EAR.
491 *
492 * - an EAR event is in the event list AND pfp_mont_?ear.ear_used = 1:
493 * The EAR will be programmed (PMC37 or PMC40) according to the information in the
494 * pfp_mont_?ear structure because it contains more detailed information
495 * (such as priv level and instruction set). A counting monitor will be programmed
496 * to count DATA_EAR_EVENTS or L1I_EAR_EVENTS depending on the type of EAR.
497 *
498 * - no EAR event is in the event list AND pfp_mont_?ear.ear_used = 0:
499 * Nothing is programmed.
500 *
501 * - no EAR event is in the event list AND pfp_mont_?ear.ear_used = 1:
502 * The EAR will be programmed (PMC37 or PMC40) according to the information in the
503 * pfp_mont_?ear structure. This is the free running mode for EAR
504 */
505
506typedef enum {
507 PFMLIB_MONT_EAR_CACHE_MODE= 0, /* Cache mode : I-EAR and D-EAR */
508 PFMLIB_MONT_EAR_TLB_MODE = 1, /* TLB mode : I-EAR and D-EAR */
509 PFMLIB_MONT_EAR_ALAT_MODE = 2 /* ALAT mode : D-EAR only */
511
512typedef struct {
513 unsigned char ear_used; /* when set will force definition of PMC[10] */
514
516 unsigned int ear_plm; /* IEAR privilege level mask */
517 unsigned long ear_umask; /* umask value for PMC10 */
519
520/*
521 * describes one range. rr_plm is ignored for data ranges
522 * a range is interpreted as unused (not defined) when rr_start = rr_end = 0.
523 * if rr_plm is not set it will use the default settings set in the generic
524 * library param structure.
525 */
526typedef struct {
527 unsigned int rr_plm; /* privilege level (ignored for data ranges) */
528 unsigned long rr_start; /* start address */
529 unsigned long rr_end; /* end address (not included) */
531typedef struct {
532 unsigned long rr_soff; /* start offset from actual start */
533 unsigned long rr_eoff; /* end offset from actual end */
535
536/*
537 * rr_used must be set to true for the library to configure the debug registers.
538 * rr_inv only applies when the rr_limits table contains ONLY 1 range.
539 *
540 * If using less than 4 intervals, must mark the end with entry: rr_start = rr_end = 0
541 */
542typedef struct {
543 unsigned int rr_flags; /* set of flags for all ranges */
544 pfmlib_mont_input_rr_desc_t rr_limits[4]; /* at most 4 distinct intervals */
545 unsigned char rr_used; /* set if address range restriction is used */
547/*
548 * rr_flags values:
549 * PFMLIB_MONT_IRR_DEMAND_FETCH, PFMLIB_MONT_IRR_PREFETCH_MATCH to be used
550 * ONLY in conunction with any of the following (dual) events:
551 *
552 * - ISB_BUNPAIRS_IN, L1I_FETCH_RAB_HIT, L1I_FETCH_ISB_HIT, L1I_FILLS
553 *
554 * PFMLIB_MONT_IRR_DEMAND_FETCH: declared interest in demand fetched cache
555 * line (force use of IBRP0)
556 *
557 * PFMLIB_MONT_IRR_PREFETCH_MATCH: declared interest in regular prefetched cache
558 * line (force use of IBRP1)
559 */
560#define PFMLIB_MONT_RR_INV 0x1 /* inverse instruction ranges (iranges only) */
561#define PFMLIB_MONT_RR_NO_FINE_MODE 0x2 /* force non fine mode for instruction ranges */
562#define PFMLIB_MONT_IRR_DEMAND_FETCH 0x4 /* demand fetch only for dual events */
563#define PFMLIB_MONT_IRR_PREFETCH_MATCH 0x8 /* regular prefetches for dual events */
564
565
566typedef struct {
567 unsigned int rr_nbr_used; /* how many registers were used */
568 pfmlib_mont_output_rr_desc_t rr_infos[4]; /* at most 4 distinct intervals */
569 pfmlib_reg_t rr_br[8]; /* debug reg to configure */
571
572typedef struct {
573 unsigned char opcm_used; /* set when opcm is used */
574 unsigned char opcm_m; /* M slot */
575 unsigned char opcm_i; /* I slot */
576 unsigned char opcm_f; /* F slot */
577 unsigned char opcm_b; /* B slot */
578 unsigned long opcm_match; /* match field */
579 unsigned long opcm_mask; /* mask field */
581
582typedef struct {
583 unsigned char ipear_used; /* set when ipear is used */
584 unsigned int ipear_plm; /* IP-EAR privilege level mask */
585 unsigned short ipear_delay; /* delay in cycles */
587
588/*
589 * Montecito specific parameters for the library
590 */
591typedef struct {
592 pfmlib_mont_counter_t pfp_mont_counters[PMU_MONT_NUM_COUNTERS]; /* extended counter features */
593
594 unsigned long pfp_mont_flags; /* Montecito specific flags */
595
596 pfmlib_mont_opcm_t pfp_mont_opcm1; /* pmc32/pmc33 (opcode matcher) configuration */
597 pfmlib_mont_opcm_t pfp_mont_opcm2; /* pmc34/pmc35 (opcode matcher) configuration */
598 pfmlib_mont_ear_t pfp_mont_iear; /* IEAR configuration */
599 pfmlib_mont_ear_t pfp_mont_dear; /* DEAR configuration */
600 pfmlib_mont_etb_t pfp_mont_etb; /* ETB configuration */
601 pfmlib_mont_ipear_t pfp_mont_ipear; /* IP-EAR configuration */
602 pfmlib_mont_input_rr_t pfp_mont_drange; /* data range restrictions */
603 pfmlib_mont_input_rr_t pfp_mont_irange; /* code range restrictions */
604 unsigned long reserved[1]; /* for future use */
606
607typedef struct {
608 pfmlib_mont_output_rr_t pfp_mont_drange; /* data range restrictions */
609 pfmlib_mont_output_rr_t pfp_mont_irange; /* code range restrictions */
610 unsigned long reserved[6]; /* for future use */
612
613extern int pfm_mont_is_ear(unsigned int i);
614extern int pfm_mont_is_dear(unsigned int i);
615extern int pfm_mont_is_dear_tlb(unsigned int i);
616extern int pfm_mont_is_dear_cache(unsigned int i);
617extern int pfm_mont_is_dear_alat(unsigned int i);
618extern int pfm_mont_is_iear(unsigned int i);
619extern int pfm_mont_is_iear_tlb(unsigned int i);
620extern int pfm_mont_is_iear_cache(unsigned int i);
621extern int pfm_mont_is_etb(unsigned int i);
622extern int pfm_mont_support_opcm(unsigned int i);
623extern int pfm_mont_support_iarr(unsigned int i);
624extern int pfm_mont_support_darr(unsigned int i);
625extern int pfm_mont_support_all(unsigned int i);
626extern int pfm_mont_get_ear_mode(unsigned int i, pfmlib_mont_ear_mode_t *m);
628
629extern int pfm_mont_get_event_maxincr(unsigned int i, unsigned int *maxincr);
630extern int pfm_mont_get_event_umask(unsigned int i, unsigned long *umask);
631extern int pfm_mont_get_event_group(unsigned int i, int *grp);
632extern int pfm_mont_get_event_set(unsigned int i, int *set);
633extern int pfm_mont_get_event_type(unsigned int i, int *type);
634
635/*
636 * values of group (grp) returned by pfm_mont_get_event_group()
637 */
638#define PFMLIB_MONT_EVT_NO_GRP 0 /* event does not belong to a group */
639#define PFMLIB_MONT_EVT_L1D_CACHE_GRP 1 /* event belongs to L1D Cache group */
640#define PFMLIB_MONT_EVT_L2D_CACHE_GRP 2 /* event belongs to L2D Cache group */
641
642/*
643 * possible values returned in set by pfm_mont_get_event_set()
644 */
645#define PFMLIB_MONT_EVT_NO_SET -1 /* event does not belong to a set */
646
647/*
648 * values of type returned by pfm_mont_get_event_type()
649 */
650#define PFMLIB_MONT_EVT_ACTIVE 0 /* event measures only when thread is active */
651#define PFMLIB_MONT_EVT_FLOATING 1
652#define PFMLIB_MONT_EVT_CAUSAL 2
653#define PFMLIB_MONT_EVT_SELF_FLOATING 3 /* floating with .self, causal otherwise */
654
655#ifdef __cplusplus /* extern C */
656}
657#endif
658
659#endif /* __PFMLIB_MONTECITO_H__ */
int i
uint16_t reserved
uint16_t type
int pfm_mont_irange_is_fine(pfmlib_output_param_t *outp, pfmlib_mont_output_param_t *mod_out)
int pfm_mont_is_iear_tlb(unsigned int i)
int pfm_mont_support_opcm(unsigned int i)
int pfm_mont_is_ear(unsigned int i)
int pfm_mont_is_dear_cache(unsigned int i)
int pfm_mont_get_event_umask(unsigned int i, unsigned long *umask)
int pfm_mont_get_event_set(unsigned int i, int *set)
int pfm_mont_is_dear_alat(unsigned int i)
#define PMU_MONT_NUM_COUNTERS
int pfm_mont_support_darr(unsigned int i)
int pfm_mont_get_event_maxincr(unsigned int i, unsigned int *maxincr)
int pfm_mont_get_ear_mode(unsigned int i, pfmlib_mont_ear_mode_t *m)
int pfm_mont_is_iear_cache(unsigned int i)
int pfm_mont_support_all(unsigned int i)
int pfm_mont_get_event_group(unsigned int i, int *grp)
pfmlib_mont_ear_mode_t
@ PFMLIB_MONT_EAR_TLB_MODE
@ PFMLIB_MONT_EAR_CACHE_MODE
@ PFMLIB_MONT_EAR_ALAT_MODE
int pfm_mont_support_iarr(unsigned int i)
int pfm_mont_is_etb(unsigned int i)
int pfm_mont_is_dear(unsigned int i)
int pfm_mont_is_iear(unsigned int i)
int pfm_mont_get_event_type(unsigned int i, int *type)
int pfm_mont_is_dear_tlb(unsigned int i)
unsigned char ear_used
unsigned long ear_umask
unsigned int ear_plm
pfmlib_mont_ear_mode_t ear_mode
unsigned char etb_brt
unsigned char etb_used
unsigned char etb_ptm
unsigned int etb_plm
unsigned char etb_ppm
unsigned char etb_tm
pfmlib_mont_ear_t pfp_mont_iear
pfmlib_mont_input_rr_t pfp_mont_irange
pfmlib_mont_input_rr_t pfp_mont_drange
pfmlib_mont_ipear_t pfp_mont_ipear
pfmlib_mont_opcm_t pfp_mont_opcm2
pfmlib_mont_opcm_t pfp_mont_opcm1
pfmlib_mont_ear_t pfp_mont_dear
pfmlib_mont_etb_t pfp_mont_etb
unsigned char ipear_used
unsigned short ipear_delay
unsigned long opcm_match
unsigned char opcm_i
unsigned char opcm_b
unsigned long opcm_mask
unsigned char opcm_f
unsigned char opcm_used
unsigned char opcm_m
pfmlib_mont_output_rr_t pfp_mont_irange
pfmlib_mont_output_rr_t pfp_mont_drange
unsigned long iarc_ig6
unsigned long dear_ig3
unsigned long etbc_plm
unsigned long iarc_ig_ibrp1
unsigned long iarc_res2
unsigned long ipear_pm
unsigned long iarc_res1
unsigned long iear_ig
unsigned long opcm_ig1
unsigned long darc_ena_dbrp0
unsigned long etbc_ptm
unsigned long opcm_inv
unsigned long iarc_ig_ibrp0
unsigned long dear_pm
unsigned long dear_ism
unsigned long darc_res3
unsigned long opcm_ch3_ig_opcm
unsigned long ipear_ig1
unsigned long pmc_ism
unsigned long pmc_ev
unsigned long dear_plm
unsigned long ipear_mode
unsigned long pmc_res3
unsigned long darc_res6
unsigned long iarc_fine
unsigned long iarc_res5
unsigned long opcm_res
unsigned long pmc_thres
unsigned long opcm_ig3
unsigned long iarc_res3
unsigned long etbc_ds
unsigned long ipear_delay
unsigned long dear_mode
unsigned long pmc_ig2
unsigned long pmc_s
unsigned long ipear_plm
unsigned long opcm_ch1_ig_opcm
unsigned long darc_res2
unsigned long darc_cfg_dtag1
unsigned long ipear_ig2
unsigned long darc_res1
unsigned long pmc_i
unsigned long darc_ena_dbrp2
unsigned long darc_res5
unsigned long pmc_ig1
unsigned long iarc_res4
unsigned long pmc_umask
unsigned long pmc_pm
unsigned long opcm_i
unsigned long iarc_ig_ibrp3
unsigned long etbc_ppm
unsigned long pmc_oi
unsigned long dear_ig1
unsigned long darc_ena_dbrp3
unsigned long pmc_e
unsigned long dear_ig2
unsigned long etbc_ig
unsigned long iear_pm
unsigned long opcm_mask
unsigned long darc_ena_dbrp1
unsigned long opcm_ch2_ig_opcm
unsigned long opcm_m
unsigned long opcm_ig
unsigned long etbc_brt
unsigned long pmc_plm
unsigned long opcm_b
unsigned long darc_cfg_dtag3
unsigned long etbc_res1
unsigned long iear_ct
unsigned long iear_res
unsigned long darc_res4
unsigned long ipear_ig3
unsigned long pmc_all
unsigned long etbc_pm
unsigned long opcm_ig_ad
unsigned long iear_plm
unsigned long etbc_tm
unsigned long dear_umask
unsigned long opcm_ig2
unsigned long pmc_es
unsigned long iarc_ig_ibrp2
unsigned long opcm_ch0_ig_opcm
unsigned long darc_cfg_dtag0
unsigned long darc_cfg_dtag2
unsigned long opcm_match
unsigned long iear_umask
unsigned long pmc_val
unsigned long pmc_m
unsigned long opcm_f
unsigned long dear_ig4
unsigned long ipear_pmd60ext_f
unsigned long dear_slot
unsigned long etb_pmd58ext_res
unsigned long etb_pmd63ext_b1
unsigned long ipear_pmd54ext_cycles
unsigned long ipear_pmd52ext_ef
unsigned long ipear_pmd62ext_ef
unsigned long dear_ig
unsigned long etb_addr
unsigned long ipear_pmd63ext_cycles
unsigned long etb_pmd50ext_res
unsigned long etb_pmd54ext_res
unsigned long ipear_pmd52ext_cycles
unsigned long ipear_pmd62ext_f
unsigned long etb_pmd60ext_b1
unsigned long etb_pmd61ext_bruflush
unsigned long ipear_pmd53ext_ef
unsigned long etb_pmd59ext_bruflush
unsigned long pmd_count
unsigned long etb_pmd52ext_b1
unsigned long ipear_pmd55ext_f
unsigned long etb_pmd48ext_b1
unsigned long ipear_pmd57ext_f
unsigned long ipear_pmd53ext_cycles
unsigned long etb_pmd51ext_bruflush
unsigned long etb_pmd53ext_bruflush
unsigned long ipear_pmd51ext_f
unsigned long etb_pmd49ext_bruflush
unsigned long etb_pmd48ext_res
unsigned long ipear_pmd61ext_ef
unsigned long ipear_pmd58ext_ef
unsigned long ipear_pmd59ext_cycles
unsigned long etb_pmd59ext_b1
unsigned long pmd_sxt47
unsigned long etb_pmd58ext_b1
unsigned long etb_pmd51ext_res
unsigned long etb_pmd60ext_bruflush
unsigned long ipear_cycles
unsigned long ipear_pmd61ext_cycles
unsigned long etb_pmd57ext_res
unsigned long iear_stat
unsigned long etb_pmd62ext_bruflush
unsigned long ipear_pmd51ext_ef
unsigned long ipear_pmd50ext_cycles
unsigned long etb_pmd54ext_bruflush
unsigned long ipear_pmd63ext_f
unsigned long ipear_pmd52ext_f
unsigned long iear_ov
unsigned long etb_pmd61ext_res
unsigned long etb_pmd53ext_b1
unsigned long etb_pmd56ext_b1
unsigned long ipear_pmd51ext_cycles
unsigned long etb_pmd51ext_b1
unsigned long ipear_pmd55ext_ef
unsigned long etb_pmd57ext_bruflush
unsigned long etb_pmd62ext_b1
unsigned long etb_pmd55ext_b1
unsigned long etb_pmd55ext_res
unsigned long etb_pmd54ext_b1
unsigned long etb_pmd63ext_bruflush
unsigned long etb_pmd50ext_b1
unsigned long etbi_ig1
unsigned long dear_bn
unsigned long ipear_pmd48ext_f
unsigned long ipear_pmd56ext_ef
unsigned long ipear_pmd61ext_f
unsigned long etb_pmd53ext_res
unsigned long etbi_ig2
unsigned long etb_pmd50ext_bruflush
unsigned long dear_ov
unsigned long etb_pmd49ext_res
unsigned long ipear_pmd58ext_cycles
unsigned long etb_mp
unsigned long etb_pmd60ext_res
unsigned long ipear_pmd60ext_cycles
unsigned long ipear_pmd49ext_f
unsigned long etb_pmd57ext_b1
unsigned long iear_latency
unsigned long ipear_pmd50ext_f
unsigned long etbi_full
unsigned long ipear_pmd58ext_f
unsigned long etb_pmd58ext_bruflush
unsigned long ipear_pmd59ext_f
unsigned long etb_pmd52ext_res
unsigned long ipear_pmd49ext_ef
unsigned long ipear_pmd48ext_ef
unsigned long etb_slot
unsigned long etb_pmd63ext_res
unsigned long etb_pmd56ext_bruflush
unsigned long etb_pmd62ext_res
unsigned long ipear_pmd53ext_f
unsigned long iear_iaddr
unsigned long etbi_ebi
unsigned long dear_latency
unsigned long etb_pmd49ext_b1
unsigned long ipear_pmd63ext_ef
unsigned long dear_iaddr
unsigned long etb_pmd59ext_res
unsigned long ipear_pmd60ext_ef
unsigned long ipear_pmd48ext_cycles
unsigned long ipear_pmd59ext_ef
unsigned long etb_pmd56ext_res
unsigned long ipear_pmd54ext_f
unsigned long ipear_pmd55ext_cycles
unsigned long dear_vl
unsigned long ipear_pmd57ext_cycles
unsigned long ipear_pmd56ext_cycles
unsigned long ipear_delay
unsigned long etb_pmd52ext_bruflush
unsigned long etb_pmd48ext_bruflush
unsigned long ipear_pmd49ext_cycles
unsigned long ipear_pmd50ext_ef
unsigned long ipear_addr
unsigned long ipear_pmd54ext_ef
unsigned long dear_stat
unsigned long etb_pmd55ext_bruflush
unsigned long ipear_pmd62ext_cycles
unsigned long ipear_pmd56ext_f
unsigned long iear_ig
unsigned long etb_pmd61ext_b1
unsigned long dear_daddr
unsigned long pmd_val
unsigned long ipear_pmd57ext_ef