PAPI 7.1.0.0
Loading...
Searching...
No Matches
pfmlib_itanium2.c File Reference
Include dependency graph for pfmlib_itanium2.c:

Go to the source code of this file.

Macros

#define is_ear(i)   event_is_ear(itanium2_pe+(i))
 
#define is_ear_tlb(i)   event_is_ear_tlb(itanium2_pe+(i))
 
#define is_ear_alat(i)   event_is_ear_alat(itanium2_pe+(i))
 
#define is_ear_cache(i)   event_is_ear_cache(itanium2_pe+(i))
 
#define is_iear(i)   event_is_iear(itanium2_pe+(i))
 
#define is_dear(i)   event_is_dear(itanium2_pe+(i))
 
#define is_btb(i)   event_is_btb(itanium2_pe+(i))
 
#define has_opcm(i)   event_opcm_ok(itanium2_pe+(i))
 
#define has_iarr(i)   event_iarr_ok(itanium2_pe+(i))
 
#define has_darr(i)   event_darr_ok(itanium2_pe+(i))
 
#define evt_use_opcm(e)   ((e)->pfp_ita2_pmc8.opcm_used != 0 || (e)->pfp_ita2_pmc9.opcm_used !=0)
 
#define evt_use_irange(e)   ((e)->pfp_ita2_irange.rr_used)
 
#define evt_use_drange(e)   ((e)->pfp_ita2_drange.rr_used)
 
#define evt_grp(e)   (int)itanium2_pe[e].pme_qualifiers.pme_qual.pme_group
 
#define evt_set(e)   (int)itanium2_pe[e].pme_qualifiers.pme_qual.pme_set
 
#define evt_umask(e)   itanium2_pe[e].pme_umask
 
#define FINE_MODE_BOUNDARY_BITS   12
 
#define FINE_MODE_MASK   ~((1U<<12)-1)
 
#define pmc_plm   pmc_ita2_counter_reg.pmc_plm
 
#define pmc_ev   pmc_ita2_counter_reg.pmc_ev
 
#define pmc_oi   pmc_ita2_counter_reg.pmc_oi
 
#define pmc_pm   pmc_ita2_counter_reg.pmc_pm
 
#define pmc_es   pmc_ita2_counter_reg.pmc_es
 
#define pmc_umask   pmc_ita2_counter_reg.pmc_umask
 
#define pmc_thres   pmc_ita2_counter_reg.pmc_thres
 
#define pmc_ism   pmc_ita2_counter_reg.pmc_ism
 
#define NPREFETCH_EVENTS   sizeof(prefetch_events)/sizeof(int)
 
#define NCANCEL_EVENTS   sizeof(cancel_events)/sizeof(int)
 
#define has_counter(e, b)   (itanium2_pe[e].pme_counters & (1 << (b)) ? (b) : 0)
 
#define DR_USED   0x1 /* data range is used */
 
#define OP_USED   0x2 /* opcode matching is used */
 
#define IR_USED   0x4 /* code range is used */
 

Functions

static char * pfm_ita2_get_event_name (unsigned int i)
 
static int pfm_ita2_detect (void)
 
static int check_cross_groups_and_umasks (pfmlib_input_param_t *inp)
 
static int check_prefetch_events (pfmlib_input_param_t *inp)
 
static unsigned int check_inst_retired_events (pfmlib_input_param_t *inp, unsigned long *retired_mask)
 
static int check_fine_mode_possible (pfmlib_ita2_input_rr_t *rr, int n)
 
static int check_intervals (pfmlib_ita2_input_rr_t *irr, int mode, unsigned int *n_intervals)
 
static int valid_assign (pfmlib_event_t *e, unsigned int *as, pfmlib_regmask_t *r_pmcs, unsigned int cnt)
 
static int check_cancel_events (pfmlib_input_param_t *inp)
 
static int pfm_ita2_dispatch_counters (pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp)
 
static int pfm_dispatch_iear (pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp)
 
static int pfm_dispatch_dear (pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp)
 
static int pfm_dispatch_opcm (pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita2_output_param_t *mod_out)
 
static int pfm_dispatch_btb (pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp)
 
static void do_normal_rr (unsigned long start, unsigned long end, pfmlib_reg_t *br, int nbr, int dir, int *idx, int *reg_idx, int plm)
 
static void print_one_range (pfmlib_ita2_input_rr_desc_t *in_rr, pfmlib_ita2_output_rr_desc_t *out_rr, pfmlib_reg_t *dbr, int base_idx, int n_pairs, int fine_mode, unsigned int rr_flags)
 
static int compute_fine_rr (pfmlib_ita2_input_rr_t *irr, int dfl_plm, int n, int *base_idx, pfmlib_ita2_output_rr_t *orr)
 
static int compute_single_rr (pfmlib_ita2_input_rr_t *irr, int dfl_plm, int *base_idx, pfmlib_ita2_output_rr_t *orr)
 
static int compute_normal_rr (pfmlib_ita2_input_rr_t *irr, int dfl_plm, int n, int *base_idx, pfmlib_ita2_output_rr_t *orr)
 
static int pfm_dispatch_irange (pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita2_output_param_t *mod_out)
 
static int pfm_dispatch_drange (pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita2_output_param_t *mod_out)
 
static int check_qualifier_constraints (pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in)
 
static int check_range_plm (pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in)
 
static int pfm_ita2_dispatch_events (pfmlib_input_param_t *inp, void *model_in, pfmlib_output_param_t *outp, void *model_out)
 
int pfm_ita2_get_event_maxincr (unsigned int i, unsigned int *maxincr)
 
int pfm_ita2_is_ear (unsigned int i)
 
int pfm_ita2_is_dear (unsigned int i)
 
int pfm_ita2_is_dear_tlb (unsigned int i)
 
int pfm_ita2_is_dear_cache (unsigned int i)
 
int pfm_ita2_is_dear_alat (unsigned int i)
 
int pfm_ita2_is_iear (unsigned int i)
 
int pfm_ita2_is_iear_tlb (unsigned int i)
 
int pfm_ita2_is_iear_cache (unsigned int i)
 
int pfm_ita2_is_btb (unsigned int i)
 
int pfm_ita2_support_iarr (unsigned int i)
 
int pfm_ita2_support_darr (unsigned int i)
 
int pfm_ita2_support_opcm (unsigned int i)
 
int pfm_ita2_get_ear_mode (unsigned int i, pfmlib_ita2_ear_mode_t *m)
 
static int pfm_ita2_get_event_code (unsigned int i, unsigned int cnt, int *code)
 
int pfm_ita2_get_event_umask (unsigned int i, unsigned long *umask)
 
int pfm_ita2_get_event_group (unsigned int i, int *grp)
 
int pfm_ita2_get_event_set (unsigned int i, int *set)
 
int pfm_ita2_irange_is_fine (pfmlib_output_param_t *outp, pfmlib_ita2_output_param_t *mod_out)
 
static void pfm_ita2_get_event_counters (unsigned int j, pfmlib_regmask_t *counters)
 
static void pfm_ita2_get_impl_pmcs (pfmlib_regmask_t *impl_pmcs)
 
static void pfm_ita2_get_impl_pmds (pfmlib_regmask_t *impl_pmds)
 
static void pfm_ita2_get_impl_counters (pfmlib_regmask_t *impl_counters)
 
static void pfm_ita2_get_hw_counter_width (unsigned int *width)
 
static int pfm_ita2_get_event_description (unsigned int ev, char **str)
 
static int pfm_ita2_get_cycle_event (pfmlib_event_t *e)
 
static int pfm_ita2_get_inst_retired (pfmlib_event_t *e)
 

Variables

static int has_fine_mode_bug
 
static int prefetch_events []
 
static int cancel_events []
 
static const unsigned long iod_tab [8]
 
pfm_pmu_support_t itanium2_support
 

Macro Definition Documentation

◆ DR_USED

#define DR_USED   0x1 /* data range is used */

◆ evt_grp

#define evt_grp (   e)    (int)itanium2_pe[e].pme_qualifiers.pme_qual.pme_group

Definition at line 53 of file pfmlib_itanium2.c.

◆ evt_set

#define evt_set (   e)    (int)itanium2_pe[e].pme_qualifiers.pme_qual.pme_set

Definition at line 54 of file pfmlib_itanium2.c.

◆ evt_umask

#define evt_umask (   e)    itanium2_pe[e].pme_umask

Definition at line 55 of file pfmlib_itanium2.c.

◆ evt_use_drange

#define evt_use_drange (   e)    ((e)->pfp_ita2_drange.rr_used)

Definition at line 51 of file pfmlib_itanium2.c.

◆ evt_use_irange

#define evt_use_irange (   e)    ((e)->pfp_ita2_irange.rr_used)

Definition at line 50 of file pfmlib_itanium2.c.

◆ evt_use_opcm

#define evt_use_opcm (   e)    ((e)->pfp_ita2_pmc8.opcm_used != 0 || (e)->pfp_ita2_pmc9.opcm_used !=0)

Definition at line 49 of file pfmlib_itanium2.c.

◆ FINE_MODE_BOUNDARY_BITS

#define FINE_MODE_BOUNDARY_BITS   12

Definition at line 58 of file pfmlib_itanium2.c.

◆ FINE_MODE_MASK

#define FINE_MODE_MASK   ~((1U<<12)-1)

Definition at line 59 of file pfmlib_itanium2.c.

◆ has_counter

#define has_counter (   e,
  b 
)    (itanium2_pe[e].pme_counters & (1 << (b)) ? (b) : 0)

◆ has_darr

#define has_darr (   i)    event_darr_ok(itanium2_pe+(i))

Definition at line 47 of file pfmlib_itanium2.c.

◆ has_iarr

#define has_iarr (   i)    event_iarr_ok(itanium2_pe+(i))

Definition at line 46 of file pfmlib_itanium2.c.

◆ has_opcm

#define has_opcm (   i)    event_opcm_ok(itanium2_pe+(i))

Definition at line 45 of file pfmlib_itanium2.c.

◆ IR_USED

#define IR_USED   0x4 /* code range is used */

◆ is_btb

#define is_btb (   i)    event_is_btb(itanium2_pe+(i))

Definition at line 44 of file pfmlib_itanium2.c.

◆ is_dear

#define is_dear (   i)    event_is_dear(itanium2_pe+(i))

Definition at line 43 of file pfmlib_itanium2.c.

◆ is_ear

#define is_ear (   i)    event_is_ear(itanium2_pe+(i))

Definition at line 38 of file pfmlib_itanium2.c.

◆ is_ear_alat

#define is_ear_alat (   i)    event_is_ear_alat(itanium2_pe+(i))

Definition at line 40 of file pfmlib_itanium2.c.

◆ is_ear_cache

#define is_ear_cache (   i)    event_is_ear_cache(itanium2_pe+(i))

Definition at line 41 of file pfmlib_itanium2.c.

◆ is_ear_tlb

#define is_ear_tlb (   i)    event_is_ear_tlb(itanium2_pe+(i))

Definition at line 39 of file pfmlib_itanium2.c.

◆ is_iear

#define is_iear (   i)    event_is_iear(itanium2_pe+(i))

Definition at line 42 of file pfmlib_itanium2.c.

◆ NCANCEL_EVENTS

#define NCANCEL_EVENTS   sizeof(cancel_events)/sizeof(int)

Definition at line 429 of file pfmlib_itanium2.c.

◆ NPREFETCH_EVENTS

#define NPREFETCH_EVENTS   sizeof(prefetch_events)/sizeof(int)

Definition at line 193 of file pfmlib_itanium2.c.

◆ OP_USED

#define OP_USED   0x2 /* opcode matching is used */

◆ pmc_es

#define pmc_es   pmc_ita2_counter_reg.pmc_es

Definition at line 66 of file pfmlib_itanium2.c.

◆ pmc_ev

#define pmc_ev   pmc_ita2_counter_reg.pmc_ev

Definition at line 63 of file pfmlib_itanium2.c.

◆ pmc_ism

#define pmc_ism   pmc_ita2_counter_reg.pmc_ism

Definition at line 69 of file pfmlib_itanium2.c.

◆ pmc_oi

#define pmc_oi   pmc_ita2_counter_reg.pmc_oi

Definition at line 64 of file pfmlib_itanium2.c.

◆ pmc_plm

#define pmc_plm   pmc_ita2_counter_reg.pmc_plm

Definition at line 62 of file pfmlib_itanium2.c.

◆ pmc_pm

#define pmc_pm   pmc_ita2_counter_reg.pmc_pm

Definition at line 65 of file pfmlib_itanium2.c.

◆ pmc_thres

#define pmc_thres   pmc_ita2_counter_reg.pmc_thres

Definition at line 68 of file pfmlib_itanium2.c.

◆ pmc_umask

#define pmc_umask   pmc_ita2_counter_reg.pmc_umask

Definition at line 67 of file pfmlib_itanium2.c.

Function Documentation

◆ check_cancel_events()

static int check_cancel_events ( pfmlib_input_param_t inp)
static

Definition at line 432 of file pfmlib_itanium2.c.

433{
434 unsigned int i, j, count;
435 int code;
436 int cancel_codes[NCANCEL_EVENTS];
437 int idx = -1;
438
439 for(i=0; i < NCANCEL_EVENTS; i++) {
441 cancel_codes[i] = code;
442 }
443 count = inp->pfp_event_count;
444 for(i=0; i < count; i++) {
445 for (j=0; j < NCANCEL_EVENTS; j++) {
446 pfm_get_event_code(inp->pfp_events[i].event, &code);
447 if (code == cancel_codes[j]) {
448 if (idx != -1) {
449 return PFMLIB_ERR_INVAL;
450 }
451 idx = inp->pfp_events[i].event;
452 }
453 }
454 }
455 return PFMLIB_SUCCESS;
456}
int i
static long count
#define PFMLIB_SUCCESS
Definition: pfmlib.h:283
#define PFMLIB_ERR_INVAL
Definition: pfmlib.h:285
pfm_err_t pfm_get_event_code(unsigned int idx, int *code)
static int cancel_events[]
#define NCANCEL_EVENTS
unsigned int event
Definition: pfmlib.h:86
pfmlib_event_t pfp_events[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:113
unsigned int pfp_event_count
Definition: pfmlib.h:109
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_cross_groups_and_umasks()

static int check_cross_groups_and_umasks ( pfmlib_input_param_t inp)
static

Definition at line 130 of file pfmlib_itanium2.c.

131{
132 unsigned long ref_umask, umask;
133 int g, s;
134 unsigned int cnt = inp->pfp_event_count;
135 pfmlib_event_t *e = inp->pfp_events;
136 unsigned int i, j;
137
138 /*
139 * XXX: could possibly be optimized
140 */
141 for (i=0; i < cnt; i++) {
142 g = evt_grp(e[i].event);
143 s = evt_set(e[i].event);
144
145 if (g == PFMLIB_ITA2_EVT_NO_GRP) continue;
146
147 ref_umask = evt_umask(e[i].event);
148
149 for (j=i+1; j < cnt; j++) {
150 if (evt_grp(e[j].event) != g) continue;
151 if (evt_set(e[j].event) != s) return PFMLIB_ERR_EVTSET;
152
153 /* only care about L2 cache group */
154 if (g != PFMLIB_ITA2_EVT_L2_CACHE_GRP || (s == 1 || s == 2)) continue;
155
156 umask = evt_umask(e[j].event);
157 /*
158 * there is no assignement possible if the event in PMC4
159 * has a umask (ref_umask) and an event (from the same
160 * set) also has a umask AND it is different. For some
161 * sets, the umasks are shared, therefore the value
162 * programmed into PMC4 determines the umask for all
163 * the other events (with umask) from the set.
164 */
165 if (umask && ref_umask != umask) return PFMLIB_ERR_NOASSIGN;
166 }
167 }
168 return PFMLIB_SUCCESS;
169}
double s
Definition: byte_profile.c:36
#define PFMLIB_ERR_EVTSET
Definition: pfmlib.h:293
#define PFMLIB_ERR_NOASSIGN
Definition: pfmlib.h:288
#define evt_set(e)
#define evt_grp(e)
#define evt_umask(e)
#define PFMLIB_ITA2_EVT_L2_CACHE_GRP
#define PFMLIB_ITA2_EVT_NO_GRP
Here is the caller graph for this function:

◆ check_fine_mode_possible()

static int check_fine_mode_possible ( pfmlib_ita2_input_rr_t rr,
int  n 
)
static

Definition at line 264 of file pfmlib_itanium2.c.

265{
267 int i;
268
269 for(i=0; i < n; i++) {
270 if ((lim[i].rr_start & FINE_MODE_MASK) != (lim[i].rr_end & FINE_MODE_MASK))
271 return 0;
272 }
273 return 1;
274}
#define FINE_MODE_MASK
pfmlib_ita2_input_rr_desc_t rr_limits[4]
Here is the caller graph for this function:

◆ check_inst_retired_events()

static unsigned int check_inst_retired_events ( pfmlib_input_param_t inp,
unsigned long retired_mask 
)
static

Definition at line 229 of file pfmlib_itanium2.c.

230{
231 int code;
232 int c, ret;
233 unsigned int i, count, found = 0;
234 unsigned long umask, mask;
235
237
238 count = inp->pfp_event_count;
239 mask = 0;
240 for(i=0; i < count; i++) {
241 ret = pfm_get_event_code(inp->pfp_events[i].event, &c);
242 if (c == code) {
243 ret = pfm_ita2_get_event_umask(inp->pfp_events[i].event, &umask);
244 if (ret != PFMLIB_SUCCESS)
245 break;
246 switch(umask) {
247 case 0: mask |= 1;
248 break;
249 case 1: mask |= 2;
250 break;
251 case 2: mask |= 4;
252 break;
253 case 3: mask |= 8;
254 break;
255 }
256 found++;
257 }
258 }
259 if (retired_mask) *retired_mask = mask;
260 return found;
261}
#define PME_ITA2_IA64_INST_RETIRED_THIS
static double c[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:40
int pfm_ita2_get_event_umask(unsigned int i, unsigned long *umask)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_intervals()

static int check_intervals ( pfmlib_ita2_input_rr_t irr,
int  mode,
unsigned int n_intervals 
)
static

Definition at line 281 of file pfmlib_itanium2.c.

282{
283 unsigned int i;
285
286 for(i=0; i < 4; i++) {
287 /* end marker */
288 if (lim[i].rr_start == 0 && lim[i].rr_end == 0) break;
289
290 /* invalid entry */
291 if (lim[i].rr_start >= lim[i].rr_end) return PFMLIB_ERR_IRRINVAL;
292
293 if (mode == 0 && (lim[i].rr_start & 0xf || lim[i].rr_end & 0xf))
294 return PFMLIB_ERR_IRRALIGN;
295 }
296 *n_intervals = i;
297 return PFMLIB_SUCCESS;
298}
#define PFMLIB_ERR_IRRALIGN
Definition: pfmlib.h:304
#define PFMLIB_ERR_IRRINVAL
Definition: pfmlib.h:299
Here is the caller graph for this function:

◆ check_prefetch_events()

static int check_prefetch_events ( pfmlib_input_param_t inp)
static

Definition at line 196 of file pfmlib_itanium2.c.

197{
198 int code;
199 int prefetch_codes[NPREFETCH_EVENTS];
200 unsigned int i, j, count;
201 int c;
202 int found = 0;
203
204 for(i=0; i < NPREFETCH_EVENTS; i++) {
206 prefetch_codes[i] = code;
207 }
208 count = inp->pfp_event_count;
209 for(i=0; i < count; i++) {
211 for(j=0; j < NPREFETCH_EVENTS; j++) {
212 if (c == prefetch_codes[j]) found++;
213 }
214 }
215 return found;
216}
#define NPREFETCH_EVENTS
static int prefetch_events[]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_qualifier_constraints()

static int check_qualifier_constraints ( pfmlib_input_param_t inp,
pfmlib_ita2_input_param_t mod_in 
)
static

Definition at line 1789 of file pfmlib_itanium2.c.

1790{
1791 pfmlib_ita2_input_param_t *param = mod_in;
1792 pfmlib_event_t *e = inp->pfp_events;
1793 unsigned int i, count;
1794
1795
1796 count = inp->pfp_event_count;
1797 for(i=0; i < count; i++) {
1798 /*
1799 * skip check for counter which requested it. Use at your own risk.
1800 * No all counters have necessarily been validated for use with
1801 * qualifiers. Typically the event is counted as if no constraint
1802 * existed.
1803 */
1805
1806
1807 if (evt_use_irange(param) && has_iarr(e[i].event) == 0) return PFMLIB_ERR_FEATCOMB;
1808 if (evt_use_drange(param) && has_darr(e[i].event) == 0) return PFMLIB_ERR_FEATCOMB;
1809 if (evt_use_opcm(param) && has_opcm(e[i].event) == 0) return PFMLIB_ERR_FEATCOMB;
1810 }
1811 return PFMLIB_SUCCESS;
1812}
#define PFMLIB_ERR_FEATCOMB
Definition: pfmlib.h:292
#define evt_use_opcm(e)
#define has_darr(i)
#define has_opcm(i)
#define has_iarr(i)
#define evt_use_irange(e)
#define evt_use_drange(e)
#define PFMLIB_ITA2_FL_EVT_NO_QUALCHECK
pfmlib_ita2_counter_t pfp_ita2_counters[PMU_ITA2_NUM_COUNTERS]
Here is the caller graph for this function:

◆ check_range_plm()

static int check_range_plm ( pfmlib_input_param_t inp,
pfmlib_ita2_input_param_t mod_in 
)
static

Definition at line 1815 of file pfmlib_itanium2.c.

1816{
1817 pfmlib_ita2_input_param_t *param = mod_in;
1818 unsigned int i, count;
1819
1820 if (param->pfp_ita2_drange.rr_used == 0 && param->pfp_ita2_irange.rr_used == 0) return PFMLIB_SUCCESS;
1821
1822 /*
1823 * range restriction applies to all events, therefore we must have a consistent
1824 * set of plm and they must match the pfp_dfl_plm which is used to setup the debug
1825 * registers
1826 */
1827 count = inp->pfp_event_count;
1828 for(i=0; i < count; i++) {
1829 if (inp->pfp_events[i].plm && inp->pfp_events[i].plm != inp->pfp_dfl_plm) return PFMLIB_ERR_FEATCOMB;
1830 }
1831 return PFMLIB_SUCCESS;
1832}
unsigned int plm
Definition: pfmlib.h:87
unsigned int pfp_dfl_plm
Definition: pfmlib.h:110
pfmlib_ita2_input_rr_t pfp_ita2_drange
pfmlib_ita2_input_rr_t pfp_ita2_irange
Here is the caller graph for this function:

◆ compute_fine_rr()

static int compute_fine_rr ( pfmlib_ita2_input_rr_t irr,
int  dfl_plm,
int  n,
int base_idx,
pfmlib_ita2_output_rr_t orr 
)
static

Definition at line 1229 of file pfmlib_itanium2.c.

1230{
1231 int i;
1232 pfmlib_reg_t *br;
1235 unsigned long addr;
1236 int reg_idx;
1237 dbreg_t db;
1238
1239 in_rr = irr->rr_limits;
1240 out_rr = orr->rr_infos;
1241 br = orr->rr_br+orr->rr_nbr_used;
1242 reg_idx = *base_idx;
1243
1244 db.val = 0;
1246
1247 if (n > 2) return PFMLIB_ERR_IRRTOOMANY;
1248
1249 for (i=0; i < n; i++, reg_idx += 2, in_rr++, br+= 4) {
1250 /*
1251 * setup lower limit pair
1252 *
1253 * because of the PMU bug, we must align down to the closest bundle-pair
1254 * aligned address. 5 => 32-byte aligned address
1255 */
1256 addr = has_fine_mode_bug ? ALIGN_DOWN(in_rr->rr_start, 5) : in_rr->rr_start;
1257 out_rr->rr_soff = in_rr->rr_start - addr;
1258
1259 /*
1260 * adjust plm for each range
1261 */
1262 db.db.db_plm = in_rr->rr_plm ? in_rr->rr_plm : (unsigned long)dfl_plm;
1263
1264 br[0].reg_num = reg_idx;
1265 br[0].reg_value = addr;
1266 br[0].reg_addr = br[0].reg_alt_addr = reg_idx;
1267 br[1].reg_num = reg_idx+1;
1268 br[1].reg_value = db.val;
1269 br[1].reg_addr = br[1].reg_alt_addr = reg_idx+1;
1270
1271 /*
1272 * setup upper limit pair
1273 *
1274 *
1275 * In fine mode, the bundle address stored in the upper limit debug
1276 * registers is included in the count, so we substract 0x10 to exclude it.
1277 *
1278 * because of the PMU bug, we align the (corrected) end to the nearest
1279 * 32-byte aligned address + 0x10. With this correction and depending
1280 * on the correction, we may count one
1281 *
1282 *
1283 */
1284
1285 addr = in_rr->rr_end - 0x10;
1286
1287 if (has_fine_mode_bug && (addr & 0x1f) == 0) addr += 0x10;
1288 out_rr->rr_eoff = addr - in_rr->rr_end + 0x10;
1289
1290 br[2].reg_num = reg_idx+4;
1291 br[2].reg_value = addr;
1292 br[2].reg_addr = br[2].reg_alt_addr = reg_idx+4;
1293
1294 br[3].reg_num = reg_idx+5;
1295 br[3].reg_value = db.val;
1296 br[3].reg_addr = br[3].reg_alt_addr = reg_idx+5;
1297
1298 if (PFMLIB_VERBOSE()) print_one_range(in_rr, out_rr, br, 0, 2, 1, irr->rr_flags);
1299 }
1300 orr->rr_nbr_used += i<<2;
1301
1302 /* update base_idx, for subsequent calls */
1303 *base_idx = reg_idx;
1304
1305 return PFMLIB_SUCCESS;
1306}
#define PFMLIB_ERR_IRRTOOMANY
Definition: pfmlib.h:300
static int has_fine_mode_bug
static void print_one_range(pfmlib_ita2_input_rr_desc_t *in_rr, pfmlib_ita2_output_rr_desc_t *out_rr, pfmlib_reg_t *dbr, int base_idx, int n_pairs, int fine_mode, unsigned int rr_flags)
#define PFMLIB_VERBOSE()
Definition: pfmlib_priv.h:77
#define ALIGN_DOWN(a, p)
Definition: pfmlib_priv.h:99
long long int long long
Definition: sde_internal.h:85
unsigned long db_mask
unsigned long db_plm
pfmlib_ita2_output_rr_desc_t rr_infos[4]
unsigned long val
br_mask_reg_t db
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_normal_rr()

static int compute_normal_rr ( pfmlib_ita2_input_rr_t irr,
int  dfl_plm,
int  n,
int base_idx,
pfmlib_ita2_output_rr_t orr 
)
static

Definition at line 1385 of file pfmlib_itanium2.c.

1386{
1389 unsigned long r_end;
1390 pfmlib_reg_t *br;
1391 dbreg_t d;
1392 int i, j;
1393 int br_index, reg_idx, prev_index;
1394
1395 in_rr = irr->rr_limits;
1396 out_rr = orr->rr_infos;
1397 br = orr->rr_br+orr->rr_nbr_used;
1398 reg_idx = *base_idx;
1399 br_index = 0;
1400
1401 for (i=0; i < n; i++, in_rr++, out_rr++) {
1402 /*
1403 * running out of registers
1404 */
1405 if (br_index == 8) break;
1406
1407 prev_index = br_index;
1408
1409 do_normal_rr( in_rr->rr_start,
1410 in_rr->rr_end,
1411 br,
1412 4 - (reg_idx>>1), /* how many pairs available */
1413 0,
1414 &br_index,
1415 &reg_idx, in_rr->rr_plm ? in_rr->rr_plm : dfl_plm);
1416
1417 DPRINT("br_index=%d reg_idx=%d\n", br_index, reg_idx);
1418
1419 /*
1420 * compute offsets
1421 */
1422 out_rr->rr_soff = out_rr->rr_eoff = 0;
1423
1424 for(j=prev_index; j < br_index; j+=2) {
1425
1426 d.val = br[j+1].reg_value;
1427 r_end = br[j].reg_value+((~(d.db.db_mask)+1) & ~(0xffUL << 56));
1428
1429 if (br[j].reg_value <= in_rr->rr_start)
1430 out_rr->rr_soff = in_rr->rr_start - br[j].reg_value;
1431
1432 if (r_end >= in_rr->rr_end)
1433 out_rr->rr_eoff = r_end - in_rr->rr_end;
1434 }
1435
1436 if (PFMLIB_VERBOSE()) print_one_range(in_rr, out_rr, br, prev_index, (br_index-prev_index)>>1, 0, irr->rr_flags);
1437 }
1438
1439 /* do not have enough registers to cover all the ranges */
1440 if (br_index == 8 && i < n) return PFMLIB_ERR_TOOMANY;
1441
1442 orr->rr_nbr_used += br_index;
1443
1444 /* update base_idx, for subsequent calls */
1445 *base_idx = reg_idx;
1446
1447 return PFMLIB_SUCCESS;
1448}
#define PFMLIB_ERR_TOOMANY
Definition: pfmlib.h:295
static void do_normal_rr(unsigned long start, unsigned long end, pfmlib_reg_t *br, int nbr, int dir, int *idx, int *reg_idx, int plm)
#define DPRINT(fmt, a...)
Definition: pfmlib_priv.h:90
unsigned long long reg_value
Definition: pfmlib.h:98
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_single_rr()

static int compute_single_rr ( pfmlib_ita2_input_rr_t irr,
int  dfl_plm,
int base_idx,
pfmlib_ita2_output_rr_t orr 
)
static

Definition at line 1312 of file pfmlib_itanium2.c.

1313{
1314 unsigned long size, end, start;
1315 unsigned long p_start, p_end;
1318 pfmlib_reg_t *br;
1319 dbreg_t db;
1320 int reg_idx;
1321 int l, m;
1322
1323 in_rr = irr->rr_limits;
1324 out_rr = orr->rr_infos;
1325 br = orr->rr_br+orr->rr_nbr_used;
1326 start = in_rr->rr_start;
1327 end = in_rr->rr_end;
1328 size = end - start;
1329 reg_idx = *base_idx;
1330
1331 l = pfm_ia64_fls(size);
1332
1333 m = l;
1334 if (size & ((1UL << l)-1)) {
1335 if (l>62) {
1336 printf("range: [0x%lx-0x%lx] too big\n", start, end);
1337 return PFMLIB_ERR_IRRTOOBIG;
1338 }
1339 m++;
1340 }
1341
1342 DPRINT("size=%ld, l=%d m=%d, internal: 0x%lx full: 0x%lx\n",
1343 size,
1344 l, m,
1345 1UL << l,
1346 1UL << m);
1347
1348 for (; m < 64; m++) {
1349 p_start = ALIGN_DOWN(start, m);
1350 p_end = p_start+(1UL<<m);
1351 if (p_end >= end) goto found;
1352 }
1353 return PFMLIB_ERR_IRRINVAL;
1354found:
1355 DPRINT("m=%d p_start=0x%lx p_end=0x%lx\n", m, p_start,p_end);
1356
1357 /* when the event is not IA64_INST_RETIRED, then we MUST use ibrp0 */
1358 br[0].reg_num = reg_idx;
1359 br[0].reg_value = p_start;
1360 br[0].reg_addr = br[0].reg_alt_addr = reg_idx;
1361
1362 db.val = 0;
1363 db.db.db_mask = ~((1UL << m)-1);
1364 db.db.db_plm = in_rr->rr_plm ? in_rr->rr_plm : (unsigned long)dfl_plm;
1365
1366
1367 br[1].reg_num = reg_idx + 1;
1368 br[1].reg_value = db.val;
1369 br[1].reg_addr = br[1].reg_alt_addr = reg_idx + 1;
1370
1371 out_rr->rr_soff = start - p_start;
1372 out_rr->rr_eoff = p_end - end;
1373
1374 if (PFMLIB_VERBOSE()) print_one_range(in_rr, out_rr, br, 0, 1, 0, irr->rr_flags);
1375
1376 orr->rr_nbr_used += 2;
1377
1378 /* update base_idx, for subsequent calls */
1379 *base_idx = reg_idx;
1380
1381 return PFMLIB_SUCCESS;
1382}
static struct timeval start
#define PFMLIB_ERR_IRRTOOBIG
Definition: pfmlib.h:297
static int pfm_ia64_fls(unsigned long x)
unsigned int reg_num
Definition: pfmlib.h:100
unsigned long reg_alt_addr
Definition: pfmlib.h:102
unsigned long long reg_addr
Definition: pfmlib.h:99
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_normal_rr()

static void do_normal_rr ( unsigned long  start,
unsigned long  end,
pfmlib_reg_t br,
int  nbr,
int  dir,
int idx,
int reg_idx,
int  plm 
)
static

Definition at line 1066 of file pfmlib_itanium2.c.

1068{
1069 unsigned long size, l_addr, c;
1070 unsigned long l_offs = 0, r_offs = 0;
1071 unsigned long l_size, r_size;
1072 dbreg_t db;
1073 int p2;
1074
1075 if (nbr < 1 || end <= start) return;
1076
1077 size = end - start;
1078
1079 DPRINT("start=0x%016lx end=0x%016lx size=0x%lx bytes (%lu bundles) nbr=%d dir=%d\n",
1080 start, end, size, size >> 4, nbr, dir);
1081
1082 p2 = pfm_ia64_fls(size);
1083
1084 c = ALIGN_DOWN(end, p2);
1085
1086 DPRINT("largest power of two possible: 2^%d=0x%lx, crossing=0x%016lx\n",
1087 p2,
1088 1UL << p2, c);
1089
1090 if ((c - (1UL<<p2)) >= start) {
1091 l_addr = c - (1UL << p2);
1092 } else {
1093 p2--;
1094
1095 if ((c + (1UL<<p2)) <= end) {
1096 l_addr = c;
1097 } else {
1098 l_addr = c - (1UL << p2);
1099 }
1100 }
1101 l_size = l_addr - start;
1102 r_size = end - l_addr-(1UL<<p2);
1103
1104 if (PFMLIB_DEBUG()) {
1105 printf("largest chunk: 2^%d=0x%lx @0x%016lx-0x%016lx\n", p2, 1UL<<p2, l_addr, l_addr+(1UL<<p2));
1106 if (l_size) printf("before: 0x%016lx-0x%016lx\n", start, l_addr);
1107 if (r_size) printf("after : 0x%016lx-0x%016lx\n", l_addr+(1UL<<p2), end);
1108 }
1109
1110 if (dir == 0 && l_size != 0 && nbr == 1) {
1111 p2++;
1112 l_addr = end - (1UL << p2);
1113 if (PFMLIB_DEBUG()) {
1114 l_offs = start - l_addr;
1115 printf(">>l_offs: 0x%lx\n", l_offs);
1116 }
1117 } else if (dir == 1 && r_size != 0 && nbr == 1) {
1118 p2++;
1119 l_addr = start;
1120 if (PFMLIB_DEBUG()) {
1121 r_offs = l_addr+(1UL<<p2) - end;
1122 printf(">>r_offs: 0x%lx\n", r_offs);
1123 }
1124 }
1125 l_size = l_addr - start;
1126 r_size = end - l_addr-(1UL<<p2);
1127
1128 if (PFMLIB_DEBUG()) {
1129 printf(">>largest chunk: 2^%d @0x%016lx-0x%016lx\n", p2, l_addr, l_addr+(1UL<<p2));
1130 if (l_size && !l_offs) printf(">>before: 0x%016lx-0x%016lx\n", start, l_addr);
1131 if (r_size && !r_offs) printf(">>after : 0x%016lx-0x%016lx\n", l_addr+(1UL<<p2), end);
1132 }
1133
1134 /*
1135 * we initialize the mask to full 0 and
1136 * only update the mask field. the rest is left
1137 * to zero, except for the plm.
1138 * in the case of ibr, the x-field must be 0. For dbr
1139 * the value of r-field and w-field is ignored.
1140 */
1141
1142 db.val = 0;
1143 db.db.db_mask = ~((1UL << p2)-1);
1144 /*
1145 * we always use default privilege level.
1146 * plm is ignored for DBRs.
1147 */
1148 db.db.db_plm = plm;
1149
1150
1151 br[*idx].reg_num = *reg_idx;
1152 br[*idx].reg_value = l_addr;
1153 br[*idx].reg_addr = br[*idx].reg_alt_addr = *reg_idx;
1154
1155 br[*idx+1].reg_num = *reg_idx+1;
1156 br[*idx+1].reg_value = db.val;
1157 br[*idx+1].reg_addr = br[*idx+1].reg_alt_addr = *reg_idx+1;
1158
1159 *idx += 2;
1160 *reg_idx += 2;
1161
1162 nbr--;
1163 if (nbr) {
1164 int r_nbr, l_nbr;
1165
1166 r_nbr = l_nbr = nbr >>1;
1167
1168 if (nbr & 0x1) {
1169 /*
1170 * our simple heuristic is:
1171 * we assign the largest number of registers to the largest
1172 * of the two chunks
1173 */
1174 if (l_size > r_size) {
1175 l_nbr++;
1176 } else {
1177 r_nbr++;
1178 }
1179
1180 }
1181 do_normal_rr(start, l_addr, br, l_nbr, 0, idx, reg_idx, plm);
1182 do_normal_rr(l_addr+(1UL<<p2), end, br, r_nbr, 1, idx, reg_idx, plm);
1183 }
1184}
#define PFMLIB_DEBUG()
Definition: pfmlib_priv.h:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_dispatch_btb()

static int pfm_dispatch_btb ( pfmlib_input_param_t inp,
pfmlib_ita2_input_param_t mod_in,
pfmlib_output_param_t outp 
)
static

Definition at line 916 of file pfmlib_itanium2.c.

917{
918 pfmlib_event_t *e= inp->pfp_events;
920 pfmlib_ita2_input_param_t *param = mod_in;
921 pfmlib_reg_t *pc, *pd;
922 pfmlib_ita2_input_param_t fake_param;
923 int found_btb = 0, found_bad_dear = 0;
924 int has_btb_param;
925 unsigned int i, pos1, pos2;
926 unsigned int count;
927
928 pc = outp->pfp_pmcs;
929 pd = outp->pfp_pmds;
930 pos1 = outp->pfp_pmc_count;
931 pos2 = outp->pfp_pmd_count;
932
933
934 /*
935 * explicit BTB settings
936 */
937 has_btb_param = param && param->pfp_ita2_btb.btb_used;
938
939 reg.pmc_val = 0UL;
940
941 /*
942 * we need to scan all events looking for DEAR ALAT/TLB due to incompatibility
943 */
944 count = inp->pfp_event_count;
945 for (i=0; i < count; i++) {
946
947 if (is_btb(e[i].event)) found_btb = 1;
948
949 /*
950 * keep track of the first BTB event
951 */
952
953 /* look only for DEAR TLB */
954 if (is_dear(e[i].event) && (is_ear_tlb(e[i].event) || is_ear_alat(e[i].event))) {
955 found_bad_dear = 1;
956 }
957 }
958
959 DPRINT("found_btb=%d found_bar_dear=%d\n", found_btb, found_bad_dear);
960
961 /*
962 * did not find D-EAR TLB/ALAT event, need to check param structure
963 */
964 if (found_bad_dear == 0 && param && param->pfp_ita2_dear.ear_used == 1) {
967 found_bad_dear = 1;
968 }
969
970 /*
971 * no explicit BTB event and no special case to deal with (cover part of case 3)
972 */
973 if (found_btb == 0 && has_btb_param == 0 && found_bad_dear == 0) return PFMLIB_SUCCESS;
974
975 if (has_btb_param == 0) {
976
977 /*
978 * case 3: no BTB event, btb_used=0 but found_bad_dear=1, need to cleanup PMC12
979 */
980 if (found_btb == 0) goto assign_zero;
981
982 /*
983 * case 1: we have a BTB event but no param, default setting is to capture
984 * all branches.
985 */
986 memset(&fake_param, 0, sizeof(fake_param));
987 param = &fake_param;
988
989 param->pfp_ita2_btb.btb_ds = 0; /* capture branch targets */
990 param->pfp_ita2_btb.btb_tm = 0x3; /* all branches */
991 param->pfp_ita2_btb.btb_ptm = 0x3; /* all branches */
992 param->pfp_ita2_btb.btb_ppm = 0x3; /* all branches */
993 param->pfp_ita2_btb.btb_brt = 0x0; /* all branches */
994
995 DPRINT("BTB event with no info\n");
996 }
997
998 /*
999 * case 2: BTB event in the list, param provided
1000 * case 4: no BTB event, param provided (free running mode)
1001 */
1004 reg.pmc12_ita2_reg.btbc_ds = param->pfp_ita2_btb.btb_ds & 0x1;
1005 reg.pmc12_ita2_reg.btbc_tm = param->pfp_ita2_btb.btb_tm & 0x3;
1006 reg.pmc12_ita2_reg.btbc_ptm = param->pfp_ita2_btb.btb_ptm & 0x3;
1007 reg.pmc12_ita2_reg.btbc_ppm = param->pfp_ita2_btb.btb_ppm & 0x3;
1008 reg.pmc12_ita2_reg.btbc_brt = param->pfp_ita2_btb.btb_brt & 0x3;
1009
1010 /*
1011 * if DEAR-ALAT or DEAR-TLB is set then PMC12 must be set to zero (see documentation p. 87)
1012 *
1013 * D-EAR ALAT/TLB and BTB cannot be used at the same time.
1014 * From documentation: PMC12 must be zero in this mode; else the wrong IP for misses
1015 * coming right after a mispredicted branch.
1016 *
1017 * D-EAR cache is fine.
1018 */
1019assign_zero:
1020 if (found_bad_dear && reg.pmc_val != 0UL) return PFMLIB_ERR_EVTINCOMP;
1021
1022 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 12))
1023 return PFMLIB_ERR_NOASSIGN;
1024
1025 memset(pc+pos1, 0, sizeof(pfmlib_reg_t));
1026
1027 pc[pos1].reg_num = 12;
1028 pc[pos1].reg_value = reg.pmc_val;
1029 pc[pos1].reg_addr = pc[pos1].reg_alt_addr = 12;
1030 pos1++;
1031
1032 __pfm_vbprintf("[PMC12(pmc12)=0x%lx plm=%d pm=%d ds=%d tm=%d ptm=%d ppm=%d brt=%d]\n",
1033 reg.pmc_val,
1041 /*
1042 * only add BTB PMD when actually using BTB.
1043 * Not needed when dealing with D-EAR TLB and DEAR-ALAT
1044 * PMC12 restriction
1045 */
1046 if (found_btb || has_btb_param) {
1047 /*
1048 * PMD16 is included in list of used PMD
1049 */
1050 for(i=8; i < 17; i++, pos2++) {
1051 pd[pos2].reg_num = i;
1052 pd[pos2].reg_addr = pd[pos2].reg_alt_addr = i;
1053 __pfm_vbprintf("[PMD%u(pmd%u)]\n", pd[pos2].reg_num, pd[pos2].reg_num);
1054 }
1055 }
1056
1057
1058 /* update final number of entries used */
1059 outp->pfp_pmc_count = pos1;
1060 outp->pfp_pmd_count = pos2;
1061
1062 return PFMLIB_SUCCESS;
1063}
#define PFMLIB_ERR_EVTINCOMP
Definition: pfmlib.h:294
static int pfm_regmask_isset(pfmlib_regmask_t *h, unsigned int b)
Definition: pfmlib.h:313
#define PFMLIB_PFP_SYSTEMWIDE
Definition: pfmlib.h:121
#define is_ear_alat(i)
#define is_ear_tlb(i)
#define is_btb(i)
#define is_dear(i)
@ PFMLIB_ITA2_EAR_TLB_MODE
@ PFMLIB_ITA2_EAR_ALAT_MODE
void __pfm_vbprintf(const char *fmt,...)
Definition: pfmlib_priv.c:52
pfmlib_regmask_t pfp_unavail_pmcs
Definition: pfmlib.h:114
unsigned int pfp_flags
Definition: pfmlib.h:111
unsigned char btb_ds
unsigned char btb_brt
unsigned char btb_ptm
unsigned char btb_used
unsigned char btb_tm
unsigned char btb_ppm
unsigned int btb_plm
pfmlib_ita2_ear_mode_t ear_mode
unsigned char ear_used
pfmlib_ita2_ear_t pfp_ita2_dear
pfmlib_ita2_btb_t pfp_ita2_btb
pfmlib_reg_t pfp_pmds[PFMLIB_MAX_PMDS]
Definition: pfmlib.h:130
pfmlib_reg_t pfp_pmcs[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:129
unsigned int pfp_pmc_count
Definition: pfmlib.h:127
unsigned int pfp_pmd_count
Definition: pfmlib.h:128
unsigned long btbc_pm
unsigned long pmc_val
unsigned long btbc_plm
unsigned long btbc_brt
unsigned long btbc_ppm
unsigned long btbc_tm
unsigned long btbc_ds
unsigned long btbc_ptm
struct pfm_ita2_pmc_reg_t::@49 pmc12_ita2_reg
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_dispatch_dear()

static int pfm_dispatch_dear ( pfmlib_input_param_t inp,
pfmlib_ita2_input_param_t mod_in,
pfmlib_output_param_t outp 
)
static

Definition at line 687 of file pfmlib_itanium2.c.

688{
690 pfmlib_ita2_input_param_t *param = mod_in;
691 pfmlib_reg_t *pc, *pd;
692 pfmlib_ita2_input_param_t fake_param;
693 unsigned int pos1, pos2;
694 unsigned int i, count;
695
696 pc = outp->pfp_pmcs;
697 pd = outp->pfp_pmds;
698 pos1 = outp->pfp_pmc_count;
699 pos2 = outp->pfp_pmd_count;
700 count = inp->pfp_event_count;
701
702 for (i=0; i < count; i++) {
703 if (is_dear(inp->pfp_events[i].event)) break;
704 }
705
706 if (param == NULL || param->pfp_ita2_dear.ear_used == 0) {
707
708 /*
709 * case 3: no D-EAR event, no (or nothing) in param->pfp_ita2_dear.ear_used
710 */
711 if (i == count) return PFMLIB_SUCCESS;
712
713 memset(&fake_param, 0, sizeof(fake_param));
714 param = &fake_param;
715
716 /*
717 * case 1: extract all information for event (name)
718 */
720
722 param->pfp_ita2_dear.ear_ism = PFMLIB_ITA2_ISM_BOTH; /* force both instruction sets */
723
724 DPRINT("D-EAR event with no info\n");
725 }
726
727 /* sanity check on the mode */
731 return PFMLIB_ERR_INVAL;
732
733 /*
734 * case 2: ear_used=1, event is defined, we use the param info as it is more precise
735 * case 4: ear_used=1, no event (free running D-EAR), use param info
736 */
737 reg.pmc_val = 0;
738
739 /* if plm is 0, then assume not specified per-event and use default */
745
746 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 11))
747 return PFMLIB_ERR_NOASSIGN;
748
749 pc[pos1].reg_num = 11; /* PMC11 is D-EAR config register */
750 pc[pos1].reg_value = reg.pmc_val;
751 pc[pos1].reg_addr = pc[pos1].reg_alt_addr = 11;
752 pos1++;
753 pd[pos2].reg_num = 2;
754 pd[pos2].reg_addr = pd[pos2].reg_alt_addr = 2;
755 pos2++;
756 pd[pos2].reg_num = 3;
757 pd[pos2].reg_addr = pd[pos2].reg_alt_addr = 3;
758 pos2++;
759 pd[pos2].reg_num = 17;
760 pd[pos2].reg_addr = pd[pos2].reg_alt_addr = 17;
761 pos2++;
762
763 __pfm_vbprintf("[PMC11(pmc11)=0x%lx mode=%s plm=%d pm=%d ism=0x%x umask=0x%x]\n",
764 reg.pmc_val,
765 reg.pmc11_ita2_reg.dear_mode == 0 ? "L1D" :
766 (reg.pmc11_ita2_reg.dear_mode == 1 ? "L1DTLB" : "ALAT"),
771 __pfm_vbprintf("[PMD2(pmd2)]\n[PMD3(pmd3)\nPMD17(pmd17)\n");
772
773
774 /* update final number of entries used */
775 outp->pfp_pmc_count = pos1;
776 outp->pfp_pmd_count = pos2;
777
778 return PFMLIB_SUCCESS;
779}
int pfm_ita2_get_ear_mode(unsigned int i, pfmlib_ita2_ear_mode_t *m)
@ PFMLIB_ITA2_EAR_CACHE_MODE
@ PFMLIB_ITA2_ISM_BOTH
pfmlib_ita2_ism_t ear_ism
unsigned long ear_umask
unsigned int ear_plm
unsigned long dear_umask
unsigned long dear_plm
struct pfm_ita2_pmc_reg_t::@48 pmc11_ita2_reg
unsigned long dear_mode
unsigned long dear_pm
unsigned long dear_ism
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_dispatch_drange()

static int pfm_dispatch_drange ( pfmlib_input_param_t inp,
pfmlib_ita2_input_param_t mod_in,
pfmlib_output_param_t outp,
pfmlib_ita2_output_param_t mod_out 
)
static

Definition at line 1632 of file pfmlib_itanium2.c.

1633{
1634 pfmlib_ita2_input_param_t *param = mod_in;
1635 pfmlib_reg_t *pc = outp->pfp_pmcs;
1637 pfmlib_ita2_output_rr_t *orr, *orr2;
1638 pfm_ita2_pmc_reg_t pmc13;
1639 pfm_ita2_pmc_reg_t pmc14;
1640 unsigned int i, pos = outp->pfp_pmc_count;
1641 int iod_codes[4], dfl_val_pmc8, dfl_val_pmc9;
1642 unsigned int n_intervals;
1643 int ret;
1644 int base_idx = 0;
1645 int fine_mode = 0;
1646#define DR_USED 0x1 /* data range is used */
1647#define OP_USED 0x2 /* opcode matching is used */
1648#define IR_USED 0x4 /* code range is used */
1649
1650 if (param == NULL) return PFMLIB_SUCCESS;
1651 /*
1652 * if only pmc8/pmc9 opcode matching is used, we do not need to change
1653 * the default value of pmc13 regardless of the events being measured.
1654 */
1655 if ( param->pfp_ita2_drange.rr_used == 0
1656 && param->pfp_ita2_irange.rr_used == 0) return PFMLIB_SUCCESS;
1657
1658 /*
1659 * it seems like the ignored bits need to have special values
1660 * otherwise this does not work.
1661 */
1662 pmc13.pmc_val = 0x2078fefefefe;
1663
1664 /*
1665 * initialize iod codes
1666 */
1667 iod_codes[0] = iod_codes[1] = iod_codes[2] = iod_codes[3] = 0;
1668
1669 /*
1670 * setup default iod value, we need to separate because
1671 * if drange is used we do not know in advance which DBR will be used
1672 * therefore we need to apply dfl_val later
1673 */
1674 dfl_val_pmc8 = param->pfp_ita2_pmc8.opcm_used ? OP_USED : 0;
1675 dfl_val_pmc9 = param->pfp_ita2_pmc9.opcm_used ? OP_USED : 0;
1676
1677 if (param->pfp_ita2_drange.rr_used == 1) {
1678
1679 if (mod_out == NULL) return PFMLIB_ERR_INVAL;
1680
1681 irr = &param->pfp_ita2_drange;
1682 orr = &mod_out->pfp_ita2_drange;
1683
1684 ret = check_intervals(irr, 1, &n_intervals);
1685 if (ret != PFMLIB_SUCCESS) return ret;
1686
1687 if (n_intervals < 1) return PFMLIB_ERR_DRRINVAL;
1688
1689 ret = compute_normal_rr(irr, inp->pfp_dfl_plm, n_intervals, &base_idx, orr);
1690 if (ret != PFMLIB_SUCCESS) {
1691 return ret == PFMLIB_ERR_TOOMANY ? PFMLIB_ERR_DRRTOOMANY : ret;
1692 }
1693
1694 /*
1695 * Update iod_codes to reflect the use of the DBR constraint.
1696 */
1697 for (i=0; i < orr->rr_nbr_used; i++) {
1698 if (orr->rr_br[i].reg_num == 0) iod_codes[0] |= DR_USED | dfl_val_pmc8;
1699 if (orr->rr_br[i].reg_num == 2) iod_codes[1] |= DR_USED | dfl_val_pmc9;
1700 if (orr->rr_br[i].reg_num == 4) iod_codes[2] |= DR_USED | dfl_val_pmc8;
1701 if (orr->rr_br[i].reg_num == 6) iod_codes[3] |= DR_USED | dfl_val_pmc9;
1702 }
1703
1704 }
1705
1706 /*
1707 * XXX: assume dispatch_irange executed before calling this function
1708 */
1709 if (param->pfp_ita2_irange.rr_used == 1) {
1710
1711 orr2 = &mod_out->pfp_ita2_irange;
1712
1713 if (mod_out == NULL) return PFMLIB_ERR_INVAL;
1714
1715 /*
1716 * we need to find out whether or not the irange is using
1717 * fine mode. If this is the case, then we only need to
1718 * program pmc13 for the ibr pairs which designate the lower
1719 * bounds of a range. For instance, if IBRP0/IBRP2 are used,
1720 * then we only need to program pmc13.cfg_dbrp0 and pmc13.ena_dbrp0,
1721 * the PMU will automatically use IBRP2, even though pmc13.ena_dbrp2=0.
1722 */
1723 for(i=0; i <= pos; i++) {
1724 if (pc[i].reg_num == 14) {
1725 pmc14.pmc_val = pc[i].reg_value;
1726 if (pmc14.pmc14_ita2_reg.iarc_fine == 1) fine_mode = 1;
1727 break;
1728 }
1729 }
1730
1731 /*
1732 * Update to reflect the use of the IBR constraint
1733 */
1734 for (i=0; i < orr2->rr_nbr_used; i++) {
1735 if (orr2->rr_br[i].reg_num == 0) iod_codes[0] |= IR_USED | dfl_val_pmc8;
1736 if (orr2->rr_br[i].reg_num == 2) iod_codes[1] |= IR_USED | dfl_val_pmc9;
1737 if (fine_mode == 0 && orr2->rr_br[i].reg_num == 4) iod_codes[2] |= IR_USED | dfl_val_pmc8;
1738 if (fine_mode == 0 && orr2->rr_br[i].reg_num == 6) iod_codes[3] |= IR_USED | dfl_val_pmc9;
1739 }
1740 }
1741
1742 if (param->pfp_ita2_irange.rr_used == 0 && param->pfp_ita2_drange.rr_used ==0) {
1743 iod_codes[0] = iod_codes[2] = dfl_val_pmc8;
1744 iod_codes[1] = iod_codes[3] = dfl_val_pmc9;
1745 }
1746
1747 /*
1748 * update the cfg dbrpX field. If we put a constraint on a cfg dbrp, then
1749 * we must enable it in the corresponding ena_dbrpX
1750 */
1751 pmc13.pmc13_ita2_reg.darc_ena_dbrp0 = iod_codes[0] ? 1 : 0;
1752 pmc13.pmc13_ita2_reg.darc_cfg_dbrp0 = iod_tab[iod_codes[0]];
1753
1754 pmc13.pmc13_ita2_reg.darc_ena_dbrp1 = iod_codes[1] ? 1 : 0;
1755 pmc13.pmc13_ita2_reg.darc_cfg_dbrp1 = iod_tab[iod_codes[1]];
1756
1757 pmc13.pmc13_ita2_reg.darc_ena_dbrp2 = iod_codes[2] ? 1 : 0;
1758 pmc13.pmc13_ita2_reg.darc_cfg_dbrp2 = iod_tab[iod_codes[2]];
1759
1760 pmc13.pmc13_ita2_reg.darc_ena_dbrp3 = iod_codes[3] ? 1 : 0;
1761 pmc13.pmc13_ita2_reg.darc_cfg_dbrp3 = iod_tab[iod_codes[3]];
1762
1763
1764 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 13))
1765 return PFMLIB_ERR_NOASSIGN;
1766
1767 pc[pos].reg_num = 13;
1768 pc[pos].reg_value = pmc13.pmc_val;
1769 pc[pos].reg_addr = pc[pos].reg_alt_addr = 13;
1770 pos++;
1771
1772 __pfm_vbprintf("[PMC13(pmc13)=0x%lx cfg_dbrp0=%d cfg_dbrp1=%d cfg_dbrp2=%d cfg_dbrp3=%d ena_dbrp0=%d ena_dbrp1=%d ena_dbrp2=%d ena_dbrp3=%d]\n",
1773 pmc13.pmc_val,
1782
1783 outp->pfp_pmc_count = pos;
1784
1785 return PFMLIB_SUCCESS;
1786}
#define PFMLIB_ERR_DRRTOOMANY
Definition: pfmlib.h:302
#define PFMLIB_ERR_DRRINVAL
Definition: pfmlib.h:301
static const unsigned long iod_tab[8]
#define DR_USED
#define OP_USED
#define IR_USED
static int check_intervals(pfmlib_ita2_input_rr_t *irr, int mode, unsigned int *n_intervals)
static int compute_normal_rr(pfmlib_ita2_input_rr_t *irr, int dfl_plm, int n, int *base_idx, pfmlib_ita2_output_rr_t *orr)
pfmlib_ita2_opcm_t pfp_ita2_pmc9
pfmlib_ita2_opcm_t pfp_ita2_pmc8
unsigned char opcm_used
pfmlib_ita2_output_rr_t pfp_ita2_irange
pfmlib_ita2_output_rr_t pfp_ita2_drange
unsigned long darc_ena_dbrp0
unsigned long darc_ena_dbrp2
unsigned long iarc_fine
struct pfm_ita2_pmc_reg_t::@51 pmc14_ita2_reg
unsigned long darc_cfg_dbrp2
unsigned long darc_ena_dbrp3
unsigned long darc_cfg_dbrp3
unsigned long darc_cfg_dbrp0
struct pfm_ita2_pmc_reg_t::@50 pmc13_ita2_reg
unsigned long darc_cfg_dbrp1
unsigned long darc_ena_dbrp1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_dispatch_iear()

static int pfm_dispatch_iear ( pfmlib_input_param_t inp,
pfmlib_ita2_input_param_t mod_in,
pfmlib_output_param_t outp 
)
static

Definition at line 583 of file pfmlib_itanium2.c.

584{
586 pfmlib_ita2_input_param_t *param = mod_in;
587 pfmlib_reg_t *pc, *pd;
588 pfmlib_ita2_input_param_t fake_param;
589 unsigned int pos1, pos2;
590 unsigned int i, count;
591
592 pc = outp->pfp_pmcs;
593 pd = outp->pfp_pmds;
594 pos1 = outp->pfp_pmc_count;
595 pos2 = outp->pfp_pmd_count;
596 count = inp->pfp_event_count;
597
598 for (i=0; i < count; i++) {
599 if (is_iear(inp->pfp_events[i].event)) break;
600 }
601
602 if (param == NULL || param->pfp_ita2_iear.ear_used == 0) {
603
604 /*
605 * case 3: no I-EAR event, no (or nothing) in param->pfp_ita2_iear.ear_used
606 */
607 if (i == count) return PFMLIB_SUCCESS;
608
609 memset(&fake_param, 0, sizeof(fake_param));
610 param = &fake_param;
611
612 /*
613 * case 1: extract all information for event (name)
614 */
616
618 param->pfp_ita2_iear.ear_ism = PFMLIB_ITA2_ISM_BOTH; /* force both instruction sets */
619
620 DPRINT("I-EAR event with no info\n");
621 }
622
623 /*
624 * case 2: ear_used=1, event is defined, we use the param info as it is more precise
625 * case 4: ear_used=1, no event (free running I-EAR), use param info
626 */
627 reg.pmc_val = 0;
628
630 /* if plm is 0, then assume not specified per-event and use default */
633 reg.pmc10_ita2_tlb_reg.iear_ct = 0x0;
637 /* if plm is 0, then assume not specified per-event and use default */
643 } else {
644 DPRINT("ALAT mode not supported in I-EAR mode\n");
645 return PFMLIB_ERR_INVAL;
646 }
647
648 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 10))
649 return PFMLIB_ERR_NOASSIGN;
650
651 pc[pos1].reg_num = 10; /* PMC10 is I-EAR config register */
652 pc[pos1].reg_value = reg.pmc_val;
653 pc[pos1].reg_addr = pc[pos1].reg_alt_addr = 10;
654 pos1++;
655 pd[pos2].reg_num = 0;
656 pd[pos2].reg_addr = pd[pos2].reg_alt_addr= 0;
657 pos2++;
658 pd[pos2].reg_num = 1;
659 pd[pos2].reg_addr = pd[pos2].reg_alt_addr = 1;
660 pos2++;
661
663 __pfm_vbprintf("[PMC10(pmc10)=0x%lx ctb=tlb plm=%d pm=%d ism=0x%x umask=0x%x]\n",
664 reg.pmc_val,
669 } else {
670 __pfm_vbprintf("[PMC10(pmc10)=0x%lx ctb=cache plm=%d pm=%d ism=0x%x umask=0x%x]\n",
671 reg.pmc_val,
676 }
677 __pfm_vbprintf("[PMD0(pmd0)]\n[PMD1(pmd1)\n");
678
679 /* update final number of entries used */
680 outp->pfp_pmc_count = pos1;
681 outp->pfp_pmd_count = pos2;
682
683 return PFMLIB_SUCCESS;
684}
#define is_iear(i)
pfmlib_ita2_ear_t pfp_ita2_iear
struct pfm_ita2_pmc_reg_t::@46 pmc10_ita2_cache_reg
unsigned long iear_plm
unsigned long iear_umask
unsigned long iear_ism
struct pfm_ita2_pmc_reg_t::@47 pmc10_ita2_tlb_reg
unsigned long iear_ct
unsigned long iear_pm
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_dispatch_irange()

static int pfm_dispatch_irange ( pfmlib_input_param_t inp,
pfmlib_ita2_input_param_t mod_in,
pfmlib_output_param_t outp,
pfmlib_ita2_output_param_t mod_out 
)
static

Definition at line 1452 of file pfmlib_itanium2.c.

1453{
1455 pfmlib_ita2_input_param_t *param = mod_in;
1458 pfmlib_reg_t *pc = outp->pfp_pmcs;
1459 unsigned int i, pos = outp->pfp_pmc_count, count;
1460 int ret;
1461 unsigned int retired_only, retired_count, fine_mode, prefetch_count;
1462 unsigned int n_intervals;
1463 int base_idx = 0;
1464 unsigned long retired_mask;
1465
1466 if (param == NULL) return PFMLIB_SUCCESS;
1467
1468 if (param->pfp_ita2_irange.rr_used == 0) return PFMLIB_SUCCESS;
1469
1470 if (mod_out == NULL) return PFMLIB_ERR_INVAL;
1471
1472 irr = &param->pfp_ita2_irange;
1473 orr = &mod_out->pfp_ita2_irange;
1474
1475 ret = check_intervals(irr, 0, &n_intervals);
1476 if (ret != PFMLIB_SUCCESS) return ret;
1477
1478 if (n_intervals < 1) return PFMLIB_ERR_IRRINVAL;
1479
1480 retired_count = check_inst_retired_events(inp, &retired_mask);
1481 retired_only = retired_count == inp->pfp_event_count;
1482 prefetch_count = check_prefetch_events(inp);
1483 fine_mode = irr->rr_flags & PFMLIB_ITA2_RR_NO_FINE_MODE ?
1484 0 : check_fine_mode_possible(irr, n_intervals);
1485
1486 DPRINT("n_intervals=%d retired_only=%d retired_count=%d prefetch_count=%d fine_mode=%d\n",
1487 n_intervals, retired_only, retired_count, prefetch_count, fine_mode);
1488
1489 /*
1490 * On Itanium2, there are more constraints on what can be measured with irange.
1491 *
1492 * - The fine mode is the best because you directly set the lower and upper limits of
1493 * the range. This uses 2 ibr pairs for range (ibrp0/ibrp2 and ibp1/ibrp3). Therefore
1494 * at most 2 fine mode ranges can be defined. There is a limit on the size and alignment
1495 * of the range to allow fine mode: the range must be less than 4KB in size AND the lower
1496 * and upper limits must NOT cross a 4KB page boundary. The fine mode works will all events.
1497 *
1498 * - if the fine mode fails, then for all events, except IA64_TAGGED_INST_RETIRED_*, only
1499 * the first pair of ibr is available: ibrp0. This imposes some severe restrictions on the
1500 * size and alignement of the range. It can be bigger than 4KB and must be properly aligned
1501 * on its size. The library relaxes these constraints by allowing the covered areas to be
1502 * larger than the expected range. It may start before and end after. You can determine how
1503 * far off the range is in either direction for each range by looking at the rr_soff (start
1504 * offset) and rr_eoff (end offset).
1505 *
1506 * - if the events include certain prefetch events then only IBRP1 can be used in fine mode
1507 * See 10.3.5.1 Exception 1.
1508 *
1509 * - Finally, when the events are ONLY IA64_TAGGED_INST_RETIRED_* then all IBR pairs can be used
1510 * to cover the range giving us more flexibility to approximate the range when it is not
1511 * properly aligned on its size (see 10.3.5.2 Exception 2).
1512 */
1513
1514 if (fine_mode == 0 && retired_only == 0 && n_intervals > 1) return PFMLIB_ERR_IRRTOOMANY;
1515
1516 /* we do not default to non-fine mode to support more ranges */
1517 if (n_intervals > 2 && fine_mode == 1) return PFMLIB_ERR_IRRTOOMANY;
1518
1519 if (fine_mode == 0) {
1520 if (retired_only) {
1521 ret = compute_normal_rr(irr, inp->pfp_dfl_plm, n_intervals, &base_idx, orr);
1522 } else {
1523 /* unless we have only prefetch and instruction retired events,
1524 * we cannot satisfy the request because the other events cannot
1525 * be measured on anything but IBRP0.
1526 */
1527 if (prefetch_count && (prefetch_count+retired_count) != inp->pfp_event_count)
1528 return PFMLIB_ERR_FEATCOMB;
1529
1530 base_idx = prefetch_count ? 2 : 0;
1531
1532 ret = compute_single_rr(irr, inp->pfp_dfl_plm, &base_idx, orr);
1533 }
1534 } else {
1535 if (prefetch_count && n_intervals != 1) return PFMLIB_ERR_IRRTOOMANY;
1536
1537 base_idx = prefetch_count ? 2 : 0;
1538 ret = compute_fine_rr(irr, inp->pfp_dfl_plm, n_intervals, &base_idx, orr);
1539 }
1540
1541 if (ret != PFMLIB_SUCCESS) {
1542 return ret == PFMLIB_ERR_TOOMANY ? PFMLIB_ERR_IRRTOOMANY : ret;
1543 }
1544
1545 reg.pmc_val = 0xdb6; /* default value */
1546
1547 count = orr->rr_nbr_used;
1548 for (i=0; i < count; i++) {
1549 switch(orr->rr_br[i].reg_num) {
1550 case 0:
1551 reg.pmc14_ita2_reg.iarc_ibrp0 = 0;
1552 break;
1553 case 2:
1554 reg.pmc14_ita2_reg.iarc_ibrp1 = 0;
1555 break;
1556 case 4:
1557 reg.pmc14_ita2_reg.iarc_ibrp2 = 0;
1558 break;
1559 case 6:
1560 reg.pmc14_ita2_reg.iarc_ibrp3 = 0;
1561 break;
1562 }
1563 }
1564
1565 if (retired_only && (param->pfp_ita2_pmc8.opcm_used ||param->pfp_ita2_pmc9.opcm_used)) {
1566 /*
1567 * PMC8 + IA64_INST_RETIRED only works if irange on IBRP0 and/or IBRP2
1568 * PMC9 + IA64_INST_RETIRED only works if irange on IBRP1 and/or IBRP3
1569 */
1570 count = orr->rr_nbr_used;
1571 for (i=0; i < count; i++) {
1572 if (orr->rr_br[i].reg_num == 0 && param->pfp_ita2_pmc9.opcm_used) return PFMLIB_ERR_FEATCOMB;
1573 if (orr->rr_br[i].reg_num == 2 && param->pfp_ita2_pmc8.opcm_used) return PFMLIB_ERR_FEATCOMB;
1574 if (orr->rr_br[i].reg_num == 4 && param->pfp_ita2_pmc9.opcm_used) return PFMLIB_ERR_FEATCOMB;
1575 if (orr->rr_br[i].reg_num == 6 && param->pfp_ita2_pmc8.opcm_used) return PFMLIB_ERR_FEATCOMB;
1576 }
1577 }
1578
1579 if (fine_mode) {
1580 reg.pmc14_ita2_reg.iarc_fine = 1;
1581 } else if (retired_only) {
1582 /*
1583 * we need to check that the user provided all the events needed to cover
1584 * all the ibr pairs used to cover the range
1585 */
1586 if ((retired_mask & 0x1) == 0 && reg.pmc14_ita2_reg.iarc_ibrp0 == 0) return PFMLIB_ERR_IRRINVAL;
1587 if ((retired_mask & 0x2) == 0 && reg.pmc14_ita2_reg.iarc_ibrp1 == 0) return PFMLIB_ERR_IRRINVAL;
1588 if ((retired_mask & 0x4) == 0 && reg.pmc14_ita2_reg.iarc_ibrp2 == 0) return PFMLIB_ERR_IRRINVAL;
1589 if ((retired_mask & 0x8) == 0 && reg.pmc14_ita2_reg.iarc_ibrp3 == 0) return PFMLIB_ERR_IRRINVAL;
1590 }
1591
1592 /* initialize pmc request slot */
1593 memset(pc+pos, 0, sizeof(pfmlib_reg_t));
1594
1595 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 14))
1596 return PFMLIB_ERR_NOASSIGN;
1597
1598 pc[pos].reg_num = 14;
1599 pc[pos].reg_value = reg.pmc_val;
1600 pc[pos].reg_addr = pc[pos].reg_alt_addr = 14;
1601 pos++;
1602
1603 __pfm_vbprintf("[PMC14(pmc14)=0x%lx ibrp0=%d ibrp1=%d ibrp2=%d ibrp3=%d fine=%d]\n",
1604 reg.pmc_val,
1610
1611 outp->pfp_pmc_count = pos;
1612
1613 return PFMLIB_SUCCESS;
1614}
static int check_fine_mode_possible(pfmlib_ita2_input_rr_t *rr, int n)
static int compute_single_rr(pfmlib_ita2_input_rr_t *irr, int dfl_plm, int *base_idx, pfmlib_ita2_output_rr_t *orr)
static unsigned int check_inst_retired_events(pfmlib_input_param_t *inp, unsigned long *retired_mask)
static int check_prefetch_events(pfmlib_input_param_t *inp)
static int compute_fine_rr(pfmlib_ita2_input_rr_t *irr, int dfl_plm, int n, int *base_idx, pfmlib_ita2_output_rr_t *orr)
#define PFMLIB_ITA2_RR_NO_FINE_MODE
unsigned long iarc_ibrp2
unsigned long iarc_ibrp0
unsigned long iarc_ibrp3
unsigned long iarc_ibrp1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_dispatch_opcm()

static int pfm_dispatch_opcm ( pfmlib_input_param_t inp,
pfmlib_ita2_input_param_t mod_in,
pfmlib_output_param_t outp,
pfmlib_ita2_output_param_t mod_out 
)
static

Definition at line 782 of file pfmlib_itanium2.c.

783{
784 pfmlib_ita2_input_param_t *param = mod_in;
785 pfmlib_reg_t *pc = outp->pfp_pmcs;
786 pfm_ita2_pmc_reg_t reg, pmc15;
787 unsigned int i, has_1st_pair, has_2nd_pair, count;
788 unsigned int pos = outp->pfp_pmc_count;
789
790 if (param == NULL) return PFMLIB_SUCCESS;
791
792 /* not constrained by PMC8 nor PMC9 */
793 pmc15.pmc_val = 0xffffffff; /* XXX: use PAL instead. PAL value is 0xfffffff0 */
794
795 if (param->pfp_ita2_irange.rr_used && mod_out == NULL) return PFMLIB_ERR_INVAL;
796
797 if (param->pfp_ita2_pmc8.opcm_used || (param->pfp_ita2_irange.rr_used && mod_out->pfp_ita2_irange.rr_nbr_used!=0) ) {
798
799 reg.pmc_val = param->pfp_ita2_pmc8.opcm_used ? param->pfp_ita2_pmc8.pmc_val : 0xffffffff3fffffff;
800
801 if (param->pfp_ita2_irange.rr_used) {
804 } else {
805 /* clear range restriction fields when none is used */
808 }
809
810 /* force bit 2 to 1 */
812
814 return PFMLIB_ERR_NOASSIGN;
815
816 pc[pos].reg_num = 8;
817 pc[pos].reg_value = reg.pmc_val;
818 pc[pos].reg_addr = pc[pos].reg_alt_addr = 8;
819 pos++;
820
821 /*
822 * will be constrained by PMC8
823 */
824 if (param->pfp_ita2_pmc8.opcm_used) {
825 has_1st_pair = has_2nd_pair = 0;
826 count = inp->pfp_event_count;
827 for(i=0; i < count; i++) {
830 }
831 if (has_1st_pair || has_2nd_pair == 0) pmc15.pmc15_ita2_reg.opcmc_ibrp0_pmc8 = 0;
832 if (has_2nd_pair || has_1st_pair == 0) pmc15.pmc15_ita2_reg.opcmc_ibrp2_pmc8 = 0;
833 }
834
835 __pfm_vbprintf("[PMC8(pmc8)=0x%lx m=%d i=%d f=%d b=%d match=0x%x mask=0x%x inv=%d ig_ad=%d]\n",
836 reg.pmc_val,
845 }
846
847 if (param->pfp_ita2_pmc9.opcm_used) {
848 /*
849 * PMC9 can only be used to qualify IA64_INST_RETIRED_* events
850 */
852
853 reg.pmc_val = param->pfp_ita2_pmc9.pmc_val;
854
855 /* ig_ad, inv are ignored for PMC9, to avoid confusion we force default values */
858
859 /* force bit 2 to 1 */
861
863 return PFMLIB_ERR_NOASSIGN;
864
865 pc[pos].reg_num = 9;
866 pc[pos].reg_value = reg.pmc_val;
867 pc[pos].reg_addr = pc[pos].reg_alt_addr = 9;
868 pos++;
869
870 /*
871 * will be constrained by PMC9
872 */
873 has_1st_pair = has_2nd_pair = 0;
874
875 count = inp->pfp_event_count;
876 for(i=0; i < count; i++) {
879 }
880 if (has_1st_pair || has_2nd_pair == 0) pmc15.pmc15_ita2_reg.opcmc_ibrp1_pmc9 = 0;
881 if (has_2nd_pair || has_1st_pair == 0) pmc15.pmc15_ita2_reg.opcmc_ibrp3_pmc9 = 0;
882
883 __pfm_vbprintf("[PMC9(pmc9)=0x%lx m=%d i=%d f=%d b=%d match=0x%x mask=0x%x]\n",
884 reg.pmc_val,
891
892 }
893
894 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 15))
895 return PFMLIB_ERR_NOASSIGN;
896
897 pc[pos].reg_num = 15;
898 pc[pos].reg_value = pmc15.pmc_val;
899 pc[pos].reg_addr = pc[pos].reg_alt_addr = 15;
900 pos++;
901
902 __pfm_vbprintf("[PMC15(pmc15)=0x%lx ibrp0_pmc8=%d ibrp1_pmc9=%d ibrp2_pmc8=%d ibrp3_pmc9=%d]\n",
903 pmc15.pmc_val,
908
909 outp->pfp_pmc_count = pos;
910
911 return PFMLIB_SUCCESS;
912}
#define PME_ITA2_IA64_TAGGED_INST_RETIRED_IBRP2_PMC8
#define PME_ITA2_IA64_TAGGED_INST_RETIRED_IBRP1_PMC9
#define PME_ITA2_IA64_TAGGED_INST_RETIRED_IBRP0_PMC8
#define PME_ITA2_IA64_TAGGED_INST_RETIRED_IBRP3_PMC9
#define PFMLIB_ITA2_RR_INV
unsigned long pmc_val
unsigned long opcm_b
unsigned long opcm_ig_ad
unsigned long opcmc_ibrp0_pmc8
unsigned long opcm_mask
unsigned long opcm_inv
unsigned long opcm_f
unsigned long opcm_bit2
unsigned long opcm_match
struct pfm_ita2_pmc_reg_t::@45 pmc8_9_ita2_reg
unsigned long opcm_i
unsigned long opcm_m
struct pfm_ita2_pmc_reg_t::@52 pmc15_ita2_reg
unsigned long opcmc_ibrp2_pmc8
unsigned long opcmc_ibrp1_pmc9
unsigned long opcmc_ibrp3_pmc9
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_ita2_detect()

static int pfm_ita2_detect ( void  )
static

Definition at line 103 of file pfmlib_itanium2.c.

104{
105 int tmp;
106 int ret = PFMLIB_ERR_NOTSUPP;
107
109 if (tmp == 0x1f) {
111 ret = PFMLIB_SUCCESS;
112 }
113 return ret;
114}
double tmp
#define PFMLIB_ERR_NOTSUPP
Definition: pfmlib.h:284
static int pfm_ia64_get_cpu_family(void)
Here is the call graph for this function:

◆ pfm_ita2_dispatch_counters()

static int pfm_ita2_dispatch_counters ( pfmlib_input_param_t inp,
pfmlib_ita2_input_param_t mod_in,
pfmlib_output_param_t outp 
)
static

Definition at line 463 of file pfmlib_itanium2.c.

464{
465#define has_counter(e,b) (itanium2_pe[e].pme_counters & (1 << (b)) ? (b) : 0)
466 pfmlib_ita2_input_param_t *param = mod_in;
469 pfmlib_reg_t *pc, *pd;
470 pfmlib_regmask_t *r_pmcs;
471 unsigned int i,j,k,l;
472 int ret;
473 unsigned int max_l0, max_l1, max_l2, max_l3;
474 unsigned int assign[PMU_ITA2_NUM_COUNTERS];
475 unsigned int m, cnt;
476
477 e = inp->pfp_events;
478 pc = outp->pfp_pmcs;
479 pd = outp->pfp_pmds;
480 cnt = inp->pfp_event_count;
481 r_pmcs = &inp->pfp_unavail_pmcs;
482
483 if (PFMLIB_DEBUG())
484 for (m=0; m < cnt; m++) {
485 DPRINT("ev[%d]=%s counters=0x%lx\n", m, itanium2_pe[e[m].event].pme_name,
486 itanium2_pe[e[m].event].pme_counters);
487 }
488
490
492 if (ret != PFMLIB_SUCCESS) return ret;
493
494 ret = check_cancel_events(inp);
495 if (ret != PFMLIB_SUCCESS) return ret;
496
501
502 DPRINT("max_l0=%u max_l1=%u max_l2=%u max_l3=%u\n", max_l0, max_l1, max_l2, max_l3);
503 /*
504 * For now, worst case in the loop nest: 4! (factorial)
505 */
506 for (i=PMU_ITA2_FIRST_COUNTER; i < max_l0; i++) {
507
508 assign[0] = has_counter(e[0].event,i);
509
510 if (max_l1 == PMU_ITA2_FIRST_COUNTER && valid_assign(e, assign, r_pmcs, cnt) == PFMLIB_SUCCESS) goto done;
511
512 for (j=PMU_ITA2_FIRST_COUNTER; j < max_l1; j++) {
513
514 if (j == i) continue;
515
516 assign[1] = has_counter(e[1].event,j);
517
518 if (max_l2 == PMU_ITA2_FIRST_COUNTER && valid_assign(e, assign, r_pmcs, cnt) == PFMLIB_SUCCESS) goto done;
519
520 for (k=PMU_ITA2_FIRST_COUNTER; k < max_l2; k++) {
521
522 if(k == i || k == j) continue;
523
524 assign[2] = has_counter(e[2].event,k);
525
526 if (max_l3 == PMU_ITA2_FIRST_COUNTER && valid_assign(e, assign, r_pmcs, cnt) == PFMLIB_SUCCESS) goto done;
527 for (l=PMU_ITA2_FIRST_COUNTER; l < max_l3; l++) {
528
529 if(l == i || l == j || l == k) continue;
530
531 assign[3] = has_counter(e[3].event,l);
532
533 if (valid_assign(e, assign, r_pmcs, cnt) == PFMLIB_SUCCESS) goto done;
534 }
535 }
536 }
537 }
538 /* we cannot satisfy the constraints */
539 return PFMLIB_ERR_NOASSIGN;
540done:
541 for (j=0; j < cnt ; j++ ) {
542 reg.pmc_val = 0; /* clear all, bits 26-27 must be zero for proper operations */
543 /* if plm is 0, then assume not specified per-event and use default */
544 reg.pmc_plm = inp->pfp_events[j].plm ? inp->pfp_events[j].plm : inp->pfp_dfl_plm;
545 reg.pmc_oi = 1; /* overflow interrupt */
546 reg.pmc_pm = inp->pfp_flags & PFMLIB_PFP_SYSTEMWIDE ? 1 : 0;
547 reg.pmc_thres = param ? param->pfp_ita2_counters[j].thres: 0;
548 reg.pmc_ism = param ? param->pfp_ita2_counters[j].ism : PFMLIB_ITA2_ISM_BOTH;
549 reg.pmc_umask = is_ear(e[j].event) ? 0x0 : itanium2_pe[e[j].event].pme_umask;
550 reg.pmc_es = itanium2_pe[e[j].event].pme_code;
551
552 /*
553 * Note that we don't force PMC4.pmc_ena = 1 because the kernel takes care of this for us.
554 * This way we don't have to program something in PMC4 even when we don't use it
555 */
556 pc[j].reg_num = assign[j];
557 pc[j].reg_value = reg.pmc_val;
558 pc[j].reg_addr = pc[j].reg_alt_addr = assign[j];
559
560 pd[j].reg_num = assign[j];
561 pd[j].reg_addr = pd[j].reg_alt_addr = assign[j];
562
563 __pfm_vbprintf("[PMC%u(pmc%u)=0x%06lx thres=%d es=0x%02x plm=%d umask=0x%x pm=%d ism=0x%x oi=%d] %s\n",
564 assign[j],
565 assign[j],
566 reg.pmc_val,
567 reg.pmc_thres,
568 reg.pmc_es,reg.pmc_plm,
569 reg.pmc_umask, reg.pmc_pm,
570 reg.pmc_ism,
571 reg.pmc_oi,
572 itanium2_pe[e[j].event].pme_name);
573 __pfm_vbprintf("[PMD%u(pmd%u)]\n", pd[j].reg_num, pd[j].reg_num);
574 }
575 /* number of PMC registers programmed */
576 outp->pfp_pmc_count = cnt;
577 outp->pfp_pmd_count = cnt;
578
579 return PFMLIB_SUCCESS;
580}
static pme_ita2_entry_t itanium2_pe[]
static int valid_assign(pfmlib_event_t *e, unsigned int *as, pfmlib_regmask_t *r_pmcs, unsigned int cnt)
static int check_cross_groups_and_umasks(pfmlib_input_param_t *inp)
#define has_counter(e, b)
#define is_ear(i)
static int check_cancel_events(pfmlib_input_param_t *inp)
#define PMU_ITA2_FIRST_COUNTER
#define PMU_ITA2_NUM_COUNTERS
pfmlib_ita2_ism_t ism
char * pme_name
unsigned long pmc_pm
unsigned long pmc_oi
unsigned long pmc_es
unsigned long pmc_thres
unsigned long pmc_umask
unsigned long pmc_ism
unsigned long pmc_plm
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_ita2_dispatch_events()

static int pfm_ita2_dispatch_events ( pfmlib_input_param_t inp,
void *  model_in,
pfmlib_output_param_t outp,
void *  model_out 
)
static

Definition at line 1836 of file pfmlib_itanium2.c.

1837{
1838 int ret;
1841
1842 /*
1843 * nothing will come out of this combination
1844 */
1845 if (mod_out && mod_in == NULL) return PFMLIB_ERR_INVAL;
1846
1847 /* check opcode match, range restriction qualifiers */
1848 if (mod_in && check_qualifier_constraints(inp, mod_in) != PFMLIB_SUCCESS) return PFMLIB_ERR_FEATCOMB;
1849
1850 /* check for problems with raneg restriction and per-event plm */
1851 if (mod_in && check_range_plm(inp, mod_in) != PFMLIB_SUCCESS) return PFMLIB_ERR_FEATCOMB;
1852
1853 ret = pfm_ita2_dispatch_counters(inp, mod_in, outp);
1854 if (ret != PFMLIB_SUCCESS) return ret;
1855
1856 /* now check for I-EAR */
1857 ret = pfm_dispatch_iear(inp, mod_in, outp);
1858 if (ret != PFMLIB_SUCCESS) return ret;
1859
1860 /* now check for D-EAR */
1861 ret = pfm_dispatch_dear(inp, mod_in, outp);
1862 if (ret != PFMLIB_SUCCESS) return ret;
1863
1864 /* XXX: must be done before dispatch_opcm() and dispatch_drange() */
1865 ret = pfm_dispatch_irange(inp, mod_in, outp, mod_out);;
1866 if (ret != PFMLIB_SUCCESS) return ret;
1867
1868 ret = pfm_dispatch_drange(inp, mod_in, outp, mod_out);;
1869 if (ret != PFMLIB_SUCCESS) return ret;
1870
1871 /* now check for Opcode matchers */
1872 ret = pfm_dispatch_opcm(inp, mod_in, outp, mod_out);
1873 if (ret != PFMLIB_SUCCESS) return ret;
1874
1875 ret = pfm_dispatch_btb(inp, mod_in, outp);
1876
1877 return ret;
1878}
static int pfm_dispatch_btb(pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp)
static int pfm_dispatch_irange(pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita2_output_param_t *mod_out)
static int pfm_ita2_dispatch_counters(pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp)
static int check_qualifier_constraints(pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in)
static int pfm_dispatch_iear(pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp)
static int pfm_dispatch_opcm(pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita2_output_param_t *mod_out)
static int pfm_dispatch_dear(pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp)
static int pfm_dispatch_drange(pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita2_output_param_t *mod_out)
static int check_range_plm(pfmlib_input_param_t *inp, pfmlib_ita2_input_param_t *mod_in)
Here is the call graph for this function:

◆ pfm_ita2_get_cycle_event()

static int pfm_ita2_get_cycle_event ( pfmlib_event_t e)
static

Definition at line 2122 of file pfmlib_itanium2.c.

2123{
2125 return PFMLIB_SUCCESS;
2126
2127}
#define PME_ITA2_CPU_CYCLES

◆ pfm_ita2_get_ear_mode()

int pfm_ita2_get_ear_mode ( unsigned int  i,
pfmlib_ita2_ear_mode_t m 
)

Definition at line 1965 of file pfmlib_itanium2.c.

1966{
1968
1969 if (!is_ear(i) || m == NULL) return PFMLIB_ERR_INVAL;
1970
1972 if (is_ear_tlb(i)) goto done;
1973
1975 if (is_ear_cache(i)) goto done;
1976
1978 if (is_ear_alat(i)) goto done;
1979
1980 return PFMLIB_ERR_INVAL;
1981done:
1982 *m = r;
1983 return PFMLIB_SUCCESS;
1984}
#define is_ear_cache(i)
pfmlib_ita2_ear_mode_t
Here is the caller graph for this function:

◆ pfm_ita2_get_event_code()

static int pfm_ita2_get_event_code ( unsigned int  i,
unsigned int  cnt,
int code 
)
static

Definition at line 1987 of file pfmlib_itanium2.c.

1988{
1989 if (cnt != PFMLIB_CNT_FIRST && (cnt < 4 || cnt > 7))
1990 return PFMLIB_ERR_INVAL;
1991
1992 *code = (int)itanium2_pe[i].pme_code;
1993
1994 return PFMLIB_SUCCESS;
1995}
#define pme_code
#define PFMLIB_CNT_FIRST
Definition: pfmlib_priv.h:62
int
Definition: sde_internal.h:89

◆ pfm_ita2_get_event_counters()

static void pfm_ita2_get_event_counters ( unsigned int  j,
pfmlib_regmask_t counters 
)
static

Definition at line 2058 of file pfmlib_itanium2.c.

2059{
2060 unsigned int i;
2061 unsigned long m;
2062
2063 memset(counters, 0, sizeof(*counters));
2064
2066 for(i=0; m ; i++, m>>=1) {
2067 if (m & 0x1)
2068 pfm_regmask_set(counters, i);
2069 }
2070}
static int pfm_regmask_set(pfmlib_regmask_t *h, unsigned int b)
Definition: pfmlib.h:321
unsigned long pme_counters
Here is the call graph for this function:

◆ pfm_ita2_get_event_description()

static int pfm_ita2_get_event_description ( unsigned int  ev,
char **  str 
)
static

Definition at line 2109 of file pfmlib_itanium2.c.

2110{
2111 char *s;
2112 s = itanium2_pe[ev].pme_desc;
2113 if (s) {
2114 *str = strdup(s);
2115 } else {
2116 *str = NULL;
2117 }
2118 return PFMLIB_SUCCESS;
2119}
char * pme_desc

◆ pfm_ita2_get_event_group()

int pfm_ita2_get_event_group ( unsigned int  i,
int grp 
)

Definition at line 2009 of file pfmlib_itanium2.c.

2010{
2011 if (i >= PME_ITA2_EVENT_COUNT || grp == NULL) return PFMLIB_ERR_INVAL;
2012 *grp = evt_grp(i);
2013 return PFMLIB_SUCCESS;
2014}
#define PME_ITA2_EVENT_COUNT

◆ pfm_ita2_get_event_maxincr()

int pfm_ita2_get_event_maxincr ( unsigned int  i,
unsigned int maxincr 
)

Definition at line 1883 of file pfmlib_itanium2.c.

1884{
1885 if (i >= PME_ITA2_EVENT_COUNT || maxincr == NULL) return PFMLIB_ERR_INVAL;
1886 *maxincr = itanium2_pe[i].pme_maxincr;
1887 return PFMLIB_SUCCESS;
1888}
unsigned int pme_maxincr

◆ pfm_ita2_get_event_name()

static char * pfm_ita2_get_event_name ( unsigned int  i)
static

Definition at line 2052 of file pfmlib_itanium2.c.

2053{
2054 return itanium2_pe[i].pme_name;
2055}
Here is the caller graph for this function:

◆ pfm_ita2_get_event_set()

int pfm_ita2_get_event_set ( unsigned int  i,
int set 
)

Definition at line 2017 of file pfmlib_itanium2.c.

2018{
2019 if (i >= PME_ITA2_EVENT_COUNT || set == NULL) return PFMLIB_ERR_INVAL;
2020 *set = evt_set(i) == 0xf ? PFMLIB_ITA2_EVT_NO_SET : evt_set(i);
2021 return PFMLIB_SUCCESS;
2022}
#define PFMLIB_ITA2_EVT_NO_SET

◆ pfm_ita2_get_event_umask()

int pfm_ita2_get_event_umask ( unsigned int  i,
unsigned long umask 
)

Definition at line 2001 of file pfmlib_itanium2.c.

2002{
2003 if (i >= PME_ITA2_EVENT_COUNT || umask == NULL) return PFMLIB_ERR_INVAL;
2004 *umask = evt_umask(i);
2005 return PFMLIB_SUCCESS;
2006}
Here is the caller graph for this function:

◆ pfm_ita2_get_hw_counter_width()

static void pfm_ita2_get_hw_counter_width ( unsigned int width)
static

Definition at line 2103 of file pfmlib_itanium2.c.

2104{
2105 *width = PMU_ITA2_COUNTER_WIDTH;
2106}
#define PMU_ITA2_COUNTER_WIDTH

◆ pfm_ita2_get_impl_counters()

static void pfm_ita2_get_impl_counters ( pfmlib_regmask_t impl_counters)
static

Definition at line 2093 of file pfmlib_itanium2.c.

2094{
2095 unsigned int i = 0;
2096
2097 /* counting pmds are contiguous */
2098 for(i=4; i < 8; i++)
2099 pfm_regmask_set(impl_counters, i);
2100}
Here is the call graph for this function:

◆ pfm_ita2_get_impl_pmcs()

static void pfm_ita2_get_impl_pmcs ( pfmlib_regmask_t impl_pmcs)
static

Definition at line 2073 of file pfmlib_itanium2.c.

2074{
2075 unsigned int i = 0;
2076
2077 /* all pmcs are contiguous */
2078 for(i=0; i < PMU_ITA2_NUM_PMCS; i++)
2079 pfm_regmask_set(impl_pmcs, i);
2080}
#define PMU_ITA2_NUM_PMCS
Here is the call graph for this function:

◆ pfm_ita2_get_impl_pmds()

static void pfm_ita2_get_impl_pmds ( pfmlib_regmask_t impl_pmds)
static

Definition at line 2083 of file pfmlib_itanium2.c.

2084{
2085 unsigned int i = 0;
2086
2087 /* all pmds are contiguous */
2088 for(i=0; i < PMU_ITA2_NUM_PMDS; i++)
2089 pfm_regmask_set(impl_pmds, i);
2090}
#define PMU_ITA2_NUM_PMDS
Here is the call graph for this function:

◆ pfm_ita2_get_inst_retired()

static int pfm_ita2_get_inst_retired ( pfmlib_event_t e)
static

Definition at line 2130 of file pfmlib_itanium2.c.

2131{
2133 return PFMLIB_SUCCESS;
2134}
#define PME_ITA2_IA64_INST_RETIRED

◆ pfm_ita2_irange_is_fine()

int pfm_ita2_irange_is_fine ( pfmlib_output_param_t outp,
pfmlib_ita2_output_param_t mod_out 
)

Definition at line 2026 of file pfmlib_itanium2.c.

2027{
2028 pfmlib_ita2_output_param_t *param = mod_out;
2030 unsigned int i, count;
2031
2032 /* some sanity checks */
2033 if (outp == NULL || param == NULL) return 0;
2034 if (outp->pfp_pmc_count >= PFMLIB_MAX_PMCS) return 0;
2035
2036 if (param->pfp_ita2_irange.rr_nbr_used == 0) return 0;
2037
2038 /*
2039 * we look for pmc14 as it contains the bit indicating if fine mode is used
2040 */
2041 count = outp->pfp_pmc_count;
2042 for(i=0; i < count; i++) {
2043 if (outp->pfp_pmcs[i].reg_num == 14) goto found;
2044 }
2045 return 0;
2046found:
2047 reg.pmc_val = outp->pfp_pmcs[i].reg_value;
2048 return reg.pmc14_ita2_reg.iarc_fine ? 1 : 0;
2049}
#define PFMLIB_MAX_PMCS
Definition: pfmlib.h:41
Here is the caller graph for this function:

◆ pfm_ita2_is_btb()

int pfm_ita2_is_btb ( unsigned int  i)

Definition at line 1939 of file pfmlib_itanium2.c.

1940{
1941 return i < PME_ITA2_EVENT_COUNT && is_btb(i);
1942}
Here is the caller graph for this function:

◆ pfm_ita2_is_dear()

int pfm_ita2_is_dear ( unsigned int  i)

Definition at line 1897 of file pfmlib_itanium2.c.

1898{
1899 return i < PME_ITA2_EVENT_COUNT && is_dear(i);
1900}
Here is the caller graph for this function:

◆ pfm_ita2_is_dear_alat()

int pfm_ita2_is_dear_alat ( unsigned int  i)

Definition at line 1915 of file pfmlib_itanium2.c.

1916{
1917 return i < PME_ITA2_EVENT_COUNT && is_ear_alat(i);
1918}

◆ pfm_ita2_is_dear_cache()

int pfm_ita2_is_dear_cache ( unsigned int  i)

Definition at line 1909 of file pfmlib_itanium2.c.

1910{
1911 return i < PME_ITA2_EVENT_COUNT && is_dear(i) && is_ear_cache(i);
1912}

◆ pfm_ita2_is_dear_tlb()

int pfm_ita2_is_dear_tlb ( unsigned int  i)

Definition at line 1903 of file pfmlib_itanium2.c.

1904{
1905 return i < PME_ITA2_EVENT_COUNT && is_dear(i) && is_ear_tlb(i);
1906}

◆ pfm_ita2_is_ear()

int pfm_ita2_is_ear ( unsigned int  i)

Definition at line 1891 of file pfmlib_itanium2.c.

1892{
1893 return i < PME_ITA2_EVENT_COUNT && is_ear(i);
1894}

◆ pfm_ita2_is_iear()

int pfm_ita2_is_iear ( unsigned int  i)

Definition at line 1921 of file pfmlib_itanium2.c.

1922{
1923 return i < PME_ITA2_EVENT_COUNT && is_iear(i);
1924}
Here is the caller graph for this function:

◆ pfm_ita2_is_iear_cache()

int pfm_ita2_is_iear_cache ( unsigned int  i)

Definition at line 1933 of file pfmlib_itanium2.c.

1934{
1935 return i < PME_ITA2_EVENT_COUNT && is_iear(i) && is_ear_cache(i);
1936}

◆ pfm_ita2_is_iear_tlb()

int pfm_ita2_is_iear_tlb ( unsigned int  i)

Definition at line 1927 of file pfmlib_itanium2.c.

1928{
1929 return i < PME_ITA2_EVENT_COUNT && is_iear(i) && is_ear_tlb(i);
1930}

◆ pfm_ita2_support_darr()

int pfm_ita2_support_darr ( unsigned int  i)

Definition at line 1952 of file pfmlib_itanium2.c.

1953{
1954 return i < PME_ITA2_EVENT_COUNT && has_darr(i);
1955}
Here is the caller graph for this function:

◆ pfm_ita2_support_iarr()

int pfm_ita2_support_iarr ( unsigned int  i)

Definition at line 1945 of file pfmlib_itanium2.c.

1946{
1947 return i < PME_ITA2_EVENT_COUNT && has_iarr(i);
1948}
Here is the caller graph for this function:

◆ pfm_ita2_support_opcm()

int pfm_ita2_support_opcm ( unsigned int  i)

Definition at line 1959 of file pfmlib_itanium2.c.

1960{
1961 return i < PME_ITA2_EVENT_COUNT && has_opcm(i);
1962}
Here is the caller graph for this function:

◆ print_one_range()

static void print_one_range ( pfmlib_ita2_input_rr_desc_t in_rr,
pfmlib_ita2_output_rr_desc_t out_rr,
pfmlib_reg_t dbr,
int  base_idx,
int  n_pairs,
int  fine_mode,
unsigned int  rr_flags 
)
static

Definition at line 1187 of file pfmlib_itanium2.c.

1188{
1189 int j;
1190 dbreg_t d;
1191 unsigned long r_end;
1192
1193 __pfm_vbprintf("[0x%lx-0x%lx): %d register pair(s)%s%s\n",
1194 in_rr->rr_start, in_rr->rr_end,
1195 n_pairs,
1196 fine_mode ? ", fine_mode" : "",
1197 rr_flags & PFMLIB_ITA2_RR_INV ? ", inversed" : "");
1198
1199 __pfm_vbprintf("start offset: -0x%lx end_offset: +0x%lx\n", out_rr->rr_soff, out_rr->rr_eoff);
1200
1201 for (j=0; j < n_pairs; j++, base_idx+=2) {
1202
1203 d.val = dbr[base_idx+1].reg_value;
1204 r_end = dbr[base_idx].reg_value+((~(d.db.db_mask)) & ~(0xffUL << 56));
1205
1206 if (fine_mode)
1207 __pfm_vbprintf("brp%u: db%u: 0x%016lx db%u: plm=0x%x mask=0x%016lx\n",
1208 dbr[base_idx].reg_num>>1,
1209 dbr[base_idx].reg_num,
1210 dbr[base_idx].reg_value,
1211 dbr[base_idx+1].reg_num,
1212 d.db.db_plm, d.db.db_mask);
1213 else
1214 __pfm_vbprintf("brp%u: db%u: 0x%016lx db%u: plm=0x%x mask=0x%016lx end=0x%016lx\n",
1215 dbr[base_idx].reg_num>>1,
1216 dbr[base_idx].reg_num,
1217 dbr[base_idx].reg_value,
1218 dbr[base_idx+1].reg_num,
1219 d.db.db_plm, d.db.db_mask,
1220 r_end);
1221 }
1222}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ valid_assign()

static int valid_assign ( pfmlib_event_t e,
unsigned int as,
pfmlib_regmask_t r_pmcs,
unsigned int  cnt 
)
static

Definition at line 302 of file pfmlib_itanium2.c.

303{
304 unsigned long pmc4_umask = 0, umask;
305 char *name;
306 int l1_grp_present = 0, l2_grp_present = 0;
307 unsigned int i;
308 int c, failure;
309 int need_pmc5, need_pmc4;
310 int pmc5_evt = -1, pmc4_evt = -1;
311
312 if (PFMLIB_DEBUG()) {
313 unsigned int j;
314 for(j=0;j<cnt; j++) {
315 name = pfm_ita2_get_event_name(e[j].event);
316 printf("%-2u (%d,%d): %s\n",
317 as[j],
318 evt_grp(e[j].event) == PFMLIB_ITA2_EVT_NO_GRP ? -1 : evt_grp(e[j].event),
319 evt_set(e[j].event) == 0xf ? -1 : evt_set(e[j].event),
320 name);
321
322 }
323 }
324 failure = 1;
325 /*
326 * first: check that all events have an assigned counter
327 */
328 for(i=0; i < cnt; i++) {
329 if (as[i]==0) goto do_failure;
330 /*
331 * take care of restricted PMC registers
332 */
333 if (pfm_regmask_isset(r_pmcs, as[i]))
334 goto do_failure;
335 }
336
337 /*
338 * second: scan list of events for the presence of groups
339 * at this point, we know that there can be no set crossing per group
340 * because this has been tested earlier.
341 */
342 for(i=0; i < cnt; i++) {
343
344 c = e[i].event;
345
346 if (evt_grp(c) == PFMLIB_ITA2_EVT_L1_CACHE_GRP) l1_grp_present = 1;
347
348 if (evt_grp(c) == PFMLIB_ITA2_EVT_L2_CACHE_GRP) l2_grp_present = 1;
349 }
350
351 /*
352 * third: scan assignements and make sure that there is at least one
353 * member of a special group assigned to either PMC4 or PMC5 depending
354 * on the constraint for that group
355 */
356 if (l1_grp_present || l2_grp_present) {
357
358 need_pmc5 = l1_grp_present;
359 need_pmc4 = l2_grp_present;
360
361 for(i=0; i < cnt; i++) {
362
363 if (need_pmc5 && as[i] == 5 && evt_grp(e[i].event) == PFMLIB_ITA2_EVT_L1_CACHE_GRP) {
364 need_pmc5 = 0;
365 pmc5_evt = e[i].event;
366 }
367
368 if (need_pmc4 && as[i] == 4 && evt_grp(e[i].event) == PFMLIB_ITA2_EVT_L2_CACHE_GRP) {
369 need_pmc4 = 0;
370 pmc4_evt = e[i].event;
371 }
372
373 if (need_pmc4 == 0 && need_pmc5 == 0) break;
374 }
375 failure = 2;
376 if (need_pmc4) goto do_failure;
377
378 failure = 3;
379 if (need_pmc5) goto do_failure;
380 }
381 /*
382 * fourth: for the L2 cache event group, you must make sure that there is no
383 * umask conflict, except for sets 1 and 2 which do not suffer from this restriction.
384 * The umask in PMC4 determines the umask for all the other events in the same set.
385 * It is ignored if the event does no belong to a set or if the event has no
386 * umask (don't care umask).
387 *
388 * XXX: redudant, already checked in check_cross_groups_and_umasks(pfmlib_param_t *evt)
389 */
390 if (l2_grp_present && evt_set(pmc4_evt) != 1 && evt_set(pmc4_evt) != 2) {
391
392 /*
393 * extract the umask of the "key" event
394 */
395 pmc4_umask = evt_umask(pmc4_evt);
396
397 failure = 4;
398
399 for(i=0; i < cnt; i++) {
400
401 umask = evt_umask(e[i].event);
402
403 DPRINT("pmc4_evt=%d pmc4_umask=0x%lx cnt_list[%d]=%d grp=%d umask=0x%lx\n", pmc4_evt, pmc4_umask, i, e[i].event,evt_grp(e[i].event), umask);
404
405 if (as[i] != 4 && evt_grp(e[i].event) == PFMLIB_ITA2_EVT_L2_CACHE_GRP && umask != 0 && umask != pmc4_umask) break;
406 }
407 if (i != cnt) goto do_failure;
408 }
409
410 return PFMLIB_SUCCESS;
411do_failure:
412 DPRINT("%s : failure %d\n", __FUNCTION__, failure);
413 return PFMLIB_ERR_NOASSIGN;
414}
static char * pfm_ita2_get_event_name(unsigned int i)
#define PFMLIB_ITA2_EVT_L1_CACHE_GRP
const char * name
Definition: rocs.c:225
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cancel_events

int cancel_events[]
static
Initial value:
=
{
}
#define PME_ITA2_L2_OZQ_CANCELS2_ACQ
#define PME_ITA2_L2_OZQ_CANCELS1_REL
#define PME_ITA2_L2_OZQ_CANCELS0_ANY

Definition at line 422 of file pfmlib_itanium2.c.

◆ has_fine_mode_bug

int has_fine_mode_bug
static

Definition at line 100 of file pfmlib_itanium2.c.

◆ iod_tab

const unsigned long iod_tab[8]
static
Initial value:
={
3,
2,
3,
0,
1,
0,
1,
0
}

Definition at line 1616 of file pfmlib_itanium2.c.

◆ itanium2_support

pfm_pmu_support_t itanium2_support
Initial value:
={
.pmu_name = "itanium2",
.pmu_type = PFMLIB_ITANIUM2_PMU,
.pme_count = PME_ITA2_EVENT_COUNT,
.pmc_count = PMU_ITA2_NUM_PMCS,
.pmd_count = PMU_ITA2_NUM_PMDS,
.get_event_code = pfm_ita2_get_event_code,
.get_event_name = pfm_ita2_get_event_name,
.get_event_counters = pfm_ita2_get_event_counters,
.dispatch_events = pfm_ita2_dispatch_events,
.pmu_detect = pfm_ita2_detect,
.get_impl_pmcs = pfm_ita2_get_impl_pmcs,
.get_impl_pmds = pfm_ita2_get_impl_pmds,
.get_impl_counters = pfm_ita2_get_impl_counters,
.get_hw_counter_width = pfm_ita2_get_hw_counter_width,
.get_event_desc = pfm_ita2_get_event_description,
.get_cycle_event = pfm_ita2_get_cycle_event,
.get_inst_retired_event = pfm_ita2_get_inst_retired
}
#define PFMLIB_ITANIUM2_PMU
Definition: pfmlib.h:225
static int pfm_ita2_get_event_description(unsigned int ev, char **str)
static int pfm_ita2_get_inst_retired(pfmlib_event_t *e)
static int pfm_ita2_detect(void)
static int pfm_ita2_dispatch_events(pfmlib_input_param_t *inp, void *model_in, pfmlib_output_param_t *outp, void *model_out)
static void pfm_ita2_get_event_counters(unsigned int j, pfmlib_regmask_t *counters)
static int pfm_ita2_get_event_code(unsigned int i, unsigned int cnt, int *code)
static void pfm_ita2_get_impl_counters(pfmlib_regmask_t *impl_counters)
static void pfm_ita2_get_impl_pmds(pfmlib_regmask_t *impl_pmds)
static void pfm_ita2_get_hw_counter_width(unsigned int *width)
static int pfm_ita2_get_cycle_event(pfmlib_event_t *e)
static void pfm_ita2_get_impl_pmcs(pfmlib_regmask_t *impl_pmcs)

Definition at line 2136 of file pfmlib_itanium2.c.

◆ prefetch_events

int prefetch_events[]
static
Initial value:
={
}
#define PME_ITA2_L1I_PREFETCHES
#define PME_ITA2_L2_INST_PREFETCHES
#define PME_ITA2_L1I_STRM_PREFETCHES

Definition at line 188 of file pfmlib_itanium2.c.