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

Go to the source code of this file.

Macros

#define is_ear(i)   event_is_ear(itanium_pe+(i))
 
#define is_ear_tlb(i)   event_is_tlb_ear(itanium_pe+(i))
 
#define is_iear(i)   event_is_iear(itanium_pe+(i))
 
#define is_dear(i)   event_is_dear(itanium_pe+(i))
 
#define is_btb(i)   event_is_btb(itanium_pe+(i))
 
#define has_opcm(i)   event_opcm_ok(itanium_pe+(i))
 
#define has_iarr(i)   event_iarr_ok(itanium_pe+(i))
 
#define has_darr(i)   event_darr_ok(itanium_pe+(i))
 
#define evt_use_opcm(e)   ((e)->pfp_ita_pmc8.opcm_used != 0 || (e)->pfp_ita_pmc9.opcm_used !=0)
 
#define evt_use_irange(e)   ((e)->pfp_ita_irange.rr_used)
 
#define evt_use_drange(e)   ((e)->pfp_ita_drange.rr_used)
 
#define evt_umask(e)   itanium_pe[(e)].pme_umask
 
#define pmc_plm   pmc_ita_count_reg.pmc_plm
 
#define pmc_ev   pmc_ita_count_reg.pmc_ev
 
#define pmc_oi   pmc_ita_count_reg.pmc_oi
 
#define pmc_pm   pmc_ita_count_reg.pmc_pm
 
#define pmc_es   pmc_ita_count_reg.pmc_es
 
#define pmc_umask   pmc_ita_count_reg.pmc_umask
 
#define pmc_thres   pmc_ita_count_reg.pmc_thres
 
#define pmc_ism   pmc_ita_count_reg.pmc_ism
 
#define PFMLIB_ITA_PMC_BASE   0
 
#define has_counter(e, b)   (itanium_pe[e].pme_counters & (1 << (b)) ? (b) : 0)
 

Functions

static int pfm_ita_detect (void)
 
static int valid_assign (unsigned int *as, pfmlib_regmask_t *r_pmcs, unsigned int cnt)
 
static int pfm_ita_dispatch_counters (pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
 
static int pfm_dispatch_iear (pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
 
static int pfm_dispatch_dear (pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
 
static int pfm_dispatch_opcm (pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
 
static int pfm_dispatch_btb (pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
 
static int check_intervals (pfmlib_ita_input_rr_t *irr, int mode, int *n_intervals)
 
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_ita_input_rr_desc_t *in_rr, pfmlib_ita_output_rr_desc_t *out_rr, pfmlib_reg_t *dbr, int base_idx, int n_pairs)
 
static int compute_normal_rr (pfmlib_ita_input_rr_t *irr, int dfl_plm, int n, int *base_idx, pfmlib_ita_output_rr_t *orr)
 
static int pfm_dispatch_irange (pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita_output_param_t *mod_out)
 
static int pfm_dispatch_drange (pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita_output_param_t *mod_out)
 
static int check_qualifier_constraints (pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in)
 
static int check_range_plm (pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in)
 
static int pfm_ita_dispatch_events (pfmlib_input_param_t *inp, void *model_in, pfmlib_output_param_t *outp, void *model_out)
 
int pfm_ita_get_event_maxincr (unsigned int i, unsigned int *maxincr)
 
int pfm_ita_is_ear (unsigned int i)
 
int pfm_ita_is_dear (unsigned int i)
 
int pfm_ita_is_dear_tlb (unsigned int i)
 
int pfm_ita_is_dear_cache (unsigned int i)
 
int pfm_ita_is_iear (unsigned int i)
 
int pfm_ita_is_iear_tlb (unsigned int i)
 
int pfm_ita_is_iear_cache (unsigned int i)
 
int pfm_ita_is_btb (unsigned int i)
 
int pfm_ita_support_iarr (unsigned int i)
 
int pfm_ita_support_darr (unsigned int i)
 
int pfm_ita_support_opcm (unsigned int i)
 
int pfm_ita_get_ear_mode (unsigned int i, pfmlib_ita_ear_mode_t *m)
 
static int pfm_ita_get_event_code (unsigned int i, unsigned int cnt, int *code)
 
int pfm_ita_get_event_umask (unsigned int i, unsigned long *umask)
 
static char * pfm_ita_get_event_name (unsigned int i)
 
static void pfm_ita_get_event_counters (unsigned int j, pfmlib_regmask_t *counters)
 
static void pfm_ita_get_impl_pmcs (pfmlib_regmask_t *impl_pmcs)
 
static void pfm_ita_get_impl_pmds (pfmlib_regmask_t *impl_pmds)
 
static void pfm_ita_get_impl_counters (pfmlib_regmask_t *impl_counters)
 
static void pfm_ita_get_hw_counter_width (unsigned int *width)
 
static int pfm_ita_get_cycle_event (pfmlib_event_t *e)
 
static int pfm_ita_get_inst_retired (pfmlib_event_t *e)
 

Variables

pfm_pmu_support_t itanium_support
 

Macro Definition Documentation

◆ evt_umask

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

Definition at line 51 of file pfmlib_itanium.c.

◆ evt_use_drange

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

Definition at line 49 of file pfmlib_itanium.c.

◆ evt_use_irange

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

Definition at line 48 of file pfmlib_itanium.c.

◆ evt_use_opcm

#define evt_use_opcm (   e)    ((e)->pfp_ita_pmc8.opcm_used != 0 || (e)->pfp_ita_pmc9.opcm_used !=0)

Definition at line 47 of file pfmlib_itanium.c.

◆ has_counter

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

◆ has_darr

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

Definition at line 45 of file pfmlib_itanium.c.

◆ has_iarr

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

Definition at line 44 of file pfmlib_itanium.c.

◆ has_opcm

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

Definition at line 43 of file pfmlib_itanium.c.

◆ is_btb

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

Definition at line 42 of file pfmlib_itanium.c.

◆ is_dear

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

Definition at line 41 of file pfmlib_itanium.c.

◆ is_ear

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

Definition at line 38 of file pfmlib_itanium.c.

◆ is_ear_tlb

#define is_ear_tlb (   i)    event_is_tlb_ear(itanium_pe+(i))

Definition at line 39 of file pfmlib_itanium.c.

◆ is_iear

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

Definition at line 40 of file pfmlib_itanium.c.

◆ PFMLIB_ITA_PMC_BASE

#define PFMLIB_ITA_PMC_BASE   0

Definition at line 84 of file pfmlib_itanium.c.

◆ pmc_es

#define pmc_es   pmc_ita_count_reg.pmc_es

Definition at line 58 of file pfmlib_itanium.c.

◆ pmc_ev

#define pmc_ev   pmc_ita_count_reg.pmc_ev

Definition at line 55 of file pfmlib_itanium.c.

◆ pmc_ism

#define pmc_ism   pmc_ita_count_reg.pmc_ism

Definition at line 61 of file pfmlib_itanium.c.

◆ pmc_oi

#define pmc_oi   pmc_ita_count_reg.pmc_oi

Definition at line 56 of file pfmlib_itanium.c.

◆ pmc_plm

#define pmc_plm   pmc_ita_count_reg.pmc_plm

Definition at line 54 of file pfmlib_itanium.c.

◆ pmc_pm

#define pmc_pm   pmc_ita_count_reg.pmc_pm

Definition at line 57 of file pfmlib_itanium.c.

◆ pmc_thres

#define pmc_thres   pmc_ita_count_reg.pmc_thres

Definition at line 60 of file pfmlib_itanium.c.

◆ pmc_umask

#define pmc_umask   pmc_ita_count_reg.pmc_umask

Definition at line 59 of file pfmlib_itanium.c.

Function Documentation

◆ check_intervals()

static int check_intervals ( pfmlib_ita_input_rr_t irr,
int  mode,
int n_intervals 
)
static

Definition at line 580 of file pfmlib_itanium.c.

581{
582 int i;
584
585 for(i=0; i < 4; i++) {
586 /* end marker */
587 if (lim[i].rr_start == 0 && lim[i].rr_end == 0) break;
588
589 /* invalid entry */
590 if (lim[i].rr_start >= lim[i].rr_end) return PFMLIB_ERR_IRRINVAL;
591
592 if (mode == 0 && (lim[i].rr_start & 0xf || lim[i].rr_end & 0xf))
593 return PFMLIB_ERR_IRRALIGN;
594 }
595 *n_intervals = i;
596 return PFMLIB_SUCCESS;
597}
int i
#define PFMLIB_ERR_IRRALIGN
Definition: pfmlib.h:304
#define PFMLIB_SUCCESS
Definition: pfmlib.h:283
#define PFMLIB_ERR_IRRINVAL
Definition: pfmlib.h:299
pfmlib_ita_input_rr_desc_t rr_limits[4]
Here is the caller graph for this function:

◆ check_qualifier_constraints()

static int check_qualifier_constraints ( pfmlib_input_param_t inp,
pfmlib_ita_input_param_t mod_in 
)
static

Definition at line 928 of file pfmlib_itanium.c.

929{
930 pfmlib_event_t *e = inp->pfp_events;
931 unsigned int i, count;
932
933 count = inp->pfp_event_count;
934 for(i=0; i < count; i++) {
935 /*
936 * skip check for counter which requested it. Use at your own risk.
937 * No all counters have necessarily been validated for use with
938 * qualifiers. Typically the event is counted as if no constraint
939 * existed.
940 */
942
943 if (evt_use_irange(mod_in) && has_iarr(e[i].event) == 0) return PFMLIB_ERR_FEATCOMB;
944 if (evt_use_drange(mod_in) && has_darr(e[i].event) == 0) return PFMLIB_ERR_FEATCOMB;
945 if (evt_use_opcm(mod_in) && has_opcm(e[i].event) == 0) return PFMLIB_ERR_FEATCOMB;
946 }
947 return PFMLIB_SUCCESS;
948}
static long count
#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_ITA_FL_EVT_NO_QUALCHECK
pfmlib_event_t pfp_events[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:113
unsigned int pfp_event_count
Definition: pfmlib.h:109
pfmlib_ita_counter_t pfp_ita_counters[PMU_ITA_NUM_COUNTERS]
Here is the caller graph for this function:

◆ check_range_plm()

static int check_range_plm ( pfmlib_input_param_t inp,
pfmlib_ita_input_param_t mod_in 
)
static

Definition at line 951 of file pfmlib_itanium.c.

952{
953 unsigned int i, count;
954
955 if (mod_in->pfp_ita_drange.rr_used == 0 && mod_in->pfp_ita_irange.rr_used == 0) return PFMLIB_SUCCESS;
956
957 /*
958 * range restriction applies to all events, therefore we must have a consistent
959 * set of plm and they must match the pfp_dfl_plm which is used to setup the debug
960 * registers
961 */
962 count = inp->pfp_event_count;
963 for(i=0; i < count; i++) {
964 if (inp->pfp_events[i].plm && inp->pfp_events[i].plm != inp->pfp_dfl_plm) return PFMLIB_ERR_FEATCOMB;
965 }
966 return PFMLIB_SUCCESS;
967}
unsigned int plm
Definition: pfmlib.h:87
unsigned int pfp_dfl_plm
Definition: pfmlib.h:110
pfmlib_ita_input_rr_t pfp_ita_drange
pfmlib_ita_input_rr_t pfp_ita_irange
Here is the caller graph for this function:

◆ compute_normal_rr()

static int compute_normal_rr ( pfmlib_ita_input_rr_t irr,
int  dfl_plm,
int  n,
int base_idx,
pfmlib_ita_output_rr_t orr 
)
static

Definition at line 746 of file pfmlib_itanium.c.

747{
750 unsigned long r_end;
751 pfmlib_reg_t *br;
752 dbreg_t d;
753 int i, j, br_index, reg_idx, prev_index;
754
755 in_rr = irr->rr_limits;
756 out_rr = orr->rr_infos;
757 br = orr->rr_br;
758 reg_idx = *base_idx;
759 br_index = 0;
760
761 for (i=0; i < n; i++, in_rr++, out_rr++) {
762 /*
763 * running out of registers
764 */
765 if (br_index == 8) break;
766
767 prev_index = br_index;
768
769 do_normal_rr( in_rr->rr_start,
770 in_rr->rr_end,
771 br,
772 4 - (reg_idx>>1), /* how many pairs available */
773 0,
774 &br_index,
775 &reg_idx, in_rr->rr_plm ? in_rr->rr_plm : dfl_plm);
776
777 DPRINT("br_index=%d reg_idx=%d\n", br_index, reg_idx);
778 /*
779 * compute offsets
780 */
781 out_rr->rr_soff = out_rr->rr_eoff = 0;
782
783 for(j=prev_index; j < br_index; j+=2) {
784
785 d.val = br[j+1].reg_value;
786 r_end = br[j].reg_value+((~(d.db.db_mask)+1) & ~(0xffUL << 56));
787
788 if (br[j].reg_value <= in_rr->rr_start)
789 out_rr->rr_soff = in_rr->rr_start - br[j].reg_value;
790
791 if (r_end >= in_rr->rr_end)
792 out_rr->rr_eoff = r_end - in_rr->rr_end;
793 }
794
795 if (PFMLIB_VERBOSE()) print_one_range(in_rr, out_rr, br, prev_index, (br_index-prev_index)>>1);
796
797
798 }
799
800 /* do not have enough registers to cover all the ranges */
801 if (br_index == 8 && i < n) return PFMLIB_ERR_TOOMANY;
802
803 orr->rr_nbr_used = br_index;
804
805 return PFMLIB_SUCCESS;
806}
#define PFMLIB_ERR_TOOMANY
Definition: pfmlib.h:295
static void print_one_range(pfmlib_ita_input_rr_desc_t *in_rr, pfmlib_ita_output_rr_desc_t *out_rr, pfmlib_reg_t *dbr, int base_idx, int n_pairs)
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 PFMLIB_VERBOSE()
Definition: pfmlib_priv.h:77
#define DPRINT(fmt, a...)
Definition: pfmlib_priv.h:90
unsigned long db_mask
pfmlib_reg_t rr_br[8]
pfmlib_ita_output_rr_desc_t rr_infos[4]
unsigned long long reg_value
Definition: pfmlib.h:98
unsigned long val
br_mask_reg_t db
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 600 of file pfmlib_itanium.c.

602{
603 unsigned long size, l_addr, c;
604 unsigned long l_offs = 0, r_offs = 0;
605 unsigned long l_size, r_size;
606 dbreg_t db;
607 int p2;
608
609 if (nbr < 1 || end <= start) return;
610
611 size = end - start;
612
613 DPRINT("start=0x%016lx end=0x%016lx size=0x%lx bytes (%lu bundles) nbr=%d dir=%d\n",
614 start, end, size, size >> 4, nbr, dir);
615
616 p2 = pfm_ia64_fls(size);
617
618 c = ALIGN_DOWN(end, p2);
619
620 DPRINT("largest power of two possible: 2^%d=0x%lx, crossing=0x%016lx\n",
621 p2,
622 1UL << p2, c);
623
624 if ((c - (1UL<<p2)) >= start) {
625 l_addr = c - (1UL << p2);
626 } else {
627 p2--;
628
629 if ((c + (1UL<<p2)) <= end) {
630 l_addr = c;
631 } else {
632 l_addr = c - (1UL << p2);
633 }
634 }
635 l_size = l_addr - start;
636 r_size = end - l_addr-(1UL<<p2);
637
638 DPRINT("largest chunk: 2^%d=0x%lx @0x%016lx-0x%016lx\n", p2, 1UL<<p2, l_addr, l_addr+(1UL<<p2));
639 if (l_size) DPRINT("before: 0x%016lx-0x%016lx\n", start, l_addr);
640 if (r_size) DPRINT("after : 0x%016lx-0x%016lx\n", l_addr+(1UL<<p2), end);
641
642 if (dir == 0 && l_size != 0 && nbr == 1) {
643 p2++;
644 l_addr = end - (1UL << p2);
645 if (PFMLIB_DEBUG()) {
646 l_offs = start - l_addr;
647 DPRINT(">>l_offs: 0x%lx\n", l_offs);
648 }
649 } else if (dir == 1 && r_size != 0 && nbr == 1) {
650 p2++;
651 l_addr = start;
652 if (PFMLIB_DEBUG()) {
653 r_offs = l_addr+(1UL<<p2) - end;
654 DPRINT(">>r_offs: 0x%lx\n", r_offs);
655 }
656 }
657 l_size = l_addr - start;
658 r_size = end - l_addr-(1UL<<p2);
659
660 DPRINT(">>largest chunk: 2^%d @0x%016lx-0x%016lx\n", p2, l_addr, l_addr+(1UL<<p2));
661 if (l_size && !l_offs) DPRINT(">>before: 0x%016lx-0x%016lx\n", start, l_addr);
662 if (r_size && !r_offs) DPRINT(">>after : 0x%016lx-0x%016lx\n", l_addr+(1UL<<p2), end);
663
664 /*
665 * we initialize the mask to full 0 and
666 * only update the mask field. the rest is left
667 * to zero, except for the plm.
668 * in the case of ibr, the x-field must be 0. For dbr
669 * the value of r-field and w-field is ignored.
670 */
671
672 db.val = 0;
673 db.db.db_mask = ~((1UL << p2)-1);
674 /*
675 * we always use default privilege level.
676 * plm is ignored for DBRs.
677 */
678 db.db.db_plm = plm;
679
680
681 br[*idx].reg_num = *reg_idx;
682 br[*idx].reg_value = l_addr;
683 br[*idx].reg_addr = *reg_idx;
684 br[*idx].reg_alt_addr= *reg_idx;
685
686 br[*idx+1].reg_num = *reg_idx+1;
687 br[*idx+1].reg_value = db.val;
688 br[*idx+1].reg_addr = *reg_idx+1;
689 br[*idx+1].reg_alt_addr = *reg_idx+1;
690
691 *idx += 2;
692 *reg_idx += 2;
693
694 nbr--;
695 if (nbr) {
696 int r_nbr, l_nbr;
697
698 r_nbr = l_nbr = nbr >>1;
699
700 if (nbr & 0x1) {
701 /*
702 * our simple heuristic is:
703 * we assign the largest number of registers to the largest
704 * of the two chunks
705 */
706 if (l_size > r_size) {
707 l_nbr++;
708 } else {
709 r_nbr++;
710 }
711
712 }
713 do_normal_rr(start, l_addr, br, l_nbr, 0, idx, reg_idx, plm);
714 do_normal_rr(l_addr+(1UL<<p2), end, br, r_nbr, 1, idx, reg_idx, plm);
715 }
716}
static struct timeval start
static double c[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:40
#define ALIGN_DOWN(a, p)
Definition: pfmlib_priv.h:99
#define PFMLIB_DEBUG()
Definition: pfmlib_priv.h:76
static int pfm_ia64_fls(unsigned long x)
unsigned long db_plm
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:

◆ pfm_dispatch_btb()

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

Definition at line 479 of file pfmlib_itanium.c.

480{
482 pfmlib_ita_input_param_t *param = mod_in;
483 pfmlib_ita_input_param_t fake_param;
484 pfmlib_reg_t *pc, *pd;
485 int found_btb=0;
486 unsigned int i, count;
487 unsigned int pos1, pos2;
488
489 reg.pmc_val = 0;
490
491 pc = outp->pfp_pmcs;
492 pd = outp->pfp_pmds;
493 pos1 = outp->pfp_pmc_count;
494 pos2 = outp->pfp_pmd_count;
495
496 count = inp->pfp_event_count;
497 for (i=0; i < count; i++) {
498 if (is_btb(inp->pfp_events[i].event)) found_btb = 1;
499 }
500
501 if (param == NULL || param->pfp_ita_btb.btb_used == 0) {
502
503 /*
504 * case 3: no BTB event, no param
505 */
506 if (found_btb == 0) return PFMLIB_SUCCESS;
507
508 /*
509 * case 1: BTB event, no param, capture all branches
510 */
511 memset(&fake_param, 0, sizeof(fake_param));
512 param = &fake_param;
513
514 param->pfp_ita_btb.btb_tar = 0x1; /* capture TAR */
515 param->pfp_ita_btb.btb_tm = 0x3; /* all branches */
516 param->pfp_ita_btb.btb_ptm = 0x3; /* all branches */
517 param->pfp_ita_btb.btb_ppm = 0x3; /* all branches */
518 param->pfp_ita_btb.btb_tac = 0x1; /* capture TAC */
519 param->pfp_ita_btb.btb_bac = 0x1; /* capture BAC */
520
521 DPRINT("BTB event with no info\n");
522 }
523
524 /*
525 * case 2: BTB event, param
526 * case 4: no BTB event, param (free running mode)
527 */
528
529 /* if plm is 0, then assume not specified per-event and use default */
532 reg.pmc12_ita_reg.btbc_tar = param->pfp_ita_btb.btb_tar & 0x1;
533 reg.pmc12_ita_reg.btbc_tm = param->pfp_ita_btb.btb_tm & 0x3;
534 reg.pmc12_ita_reg.btbc_ptm = param->pfp_ita_btb.btb_ptm & 0x3;
535 reg.pmc12_ita_reg.btbc_ppm = param->pfp_ita_btb.btb_ppm & 0x3;
536 reg.pmc12_ita_reg.btbc_bpt = param->pfp_ita_btb.btb_tac & 0x1;
537 reg.pmc12_ita_reg.btbc_bac = param->pfp_ita_btb.btb_bac & 0x1;
538
539 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 12))
540 return PFMLIB_ERR_NOASSIGN;
541
542 pc[pos1].reg_num = 12;
543 pc[pos1].reg_value = reg.pmc_val;
544 pc[pos1].reg_value = 12;
545 pos1++;
546
547 __pfm_vbprintf("[PMC12(pmc12)=0x%lx plm=%d pm=%d tar=%d tm=%d ptm=%d ppm=%d bpt=%d bac=%d]\n",
548 reg.pmc_val,
557
558 /*
559 * PMD16 is included in list of used PMD
560 */
561 for(i=8; i < 17; i++, pos2++) {
562 pd[pos2].reg_num = i;
563 pd[pos2].reg_addr = i;
564 pd[pos2].reg_alt_addr = i;
565 __pfm_vbprintf("[PMD%u(pmd%u)]\n", pd[pos2].reg_num, pd[pos2].reg_num);
566 }
567
568 /* update final number of entries used */
569 outp->pfp_pmc_count = pos1;
570 outp->pfp_pmd_count = pos2;
571
572 return PFMLIB_SUCCESS;
573}
static int pfm_regmask_isset(pfmlib_regmask_t *h, unsigned int b)
Definition: pfmlib.h:313
#define PFMLIB_ERR_NOASSIGN
Definition: pfmlib.h:288
#define PFMLIB_PFP_SYSTEMWIDE
Definition: pfmlib.h:121
#define is_btb(i)
void __pfm_vbprintf(const char *fmt,...)
Definition: pfmlib_priv.c:52
unsigned int event
Definition: pfmlib.h:86
pfmlib_regmask_t pfp_unavail_pmcs
Definition: pfmlib.h:114
unsigned int pfp_flags
Definition: pfmlib.h:111
unsigned char btb_used
unsigned char btb_tm
unsigned int btb_plm
unsigned char btb_ppm
unsigned char btb_ptm
unsigned char btb_tar
unsigned char btb_bac
unsigned char btb_tac
pfmlib_ita_btb_t pfp_ita_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_tm
struct pfm_ita_pmc_reg_t::@34 pmc12_ita_reg
unsigned long btbc_tar
unsigned long btbc_ppm
unsigned long btbc_pm
unsigned long btbc_bac
unsigned long pmc_val
unsigned long btbc_bpt
unsigned long btbc_ptm
unsigned long btbc_plm
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_ita_input_param_t mod_in,
pfmlib_output_param_t outp 
)
static

Definition at line 323 of file pfmlib_itanium.c.

324{
326 pfmlib_ita_input_param_t *param = mod_in;
327 pfmlib_ita_input_param_t fake_param;
328 pfmlib_reg_t *pc, *pd;
329 unsigned int pos1, pos2;
330 int dear_idx = -1;
331 unsigned int i, count;
332
333 pc = outp->pfp_pmcs;
334 pd = outp->pfp_pmds;
335 pos1 = outp->pfp_pmc_count;
336 pos2 = outp->pfp_pmd_count;
337 count = inp->pfp_event_count;
338
339 for (i=0; i < count; i++) {
340 if (is_dear(inp->pfp_events[i].event)) dear_idx = i;
341 }
342
343 if (param == NULL || param->pfp_ita_dear.ear_used == 0) {
344
345 /*
346 * case 3: no D-EAR event, no (or nothing) in param->pfp_ita2_dear.ear_used
347 */
348 if (dear_idx == -1) return PFMLIB_SUCCESS;
349
350 memset(&fake_param, 0, sizeof(fake_param));
351 param = &fake_param;
352
354
355 param->pfp_ita_dear.ear_umask = evt_umask(inp->pfp_events[dear_idx].event);
356 param->pfp_ita_dear.ear_ism = PFMLIB_ITA_ISM_BOTH; /* force both instruction sets */
357
358 DPRINT("D-EAR event with no info\n");
359 }
360
361
362 /* sanity check on the mode */
363 if (param->pfp_ita_dear.ear_mode > 2) return PFMLIB_ERR_INVAL;
364
365 /*
366 * case 2: ear_used=1, event is defined, we use the param info as it is more precise
367 * case 4: ear_used=1, no event (free running D-EAR), use param info
368 */
369 reg.pmc_val = 0;
370
371 /* if plm is 0, then assume not specified per-event and use default */
377 reg.pmc11_ita_reg.dear_pt = param->pfp_ita_drange.rr_used ? 0: 1;
378
379 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 11))
380 return PFMLIB_ERR_NOASSIGN;
381
382 pc[pos1].reg_num = 11; /* PMC11 is D-EAR config register */
383 pc[pos1].reg_value = reg.pmc_val;
384 pc[pos1].reg_addr = 11;
385 pos1++;
386 pd[pos2].reg_num = 2;
387 pd[pos2].reg_addr = 2;
388 pd[pos2].reg_alt_addr = 2;
389 pos2++;
390 pd[pos2].reg_num = 3;
391 pd[pos2].reg_addr = 3;
392 pd[pos2].reg_alt_addr = 3;
393 pos2++;
394 pd[pos2].reg_num = 17;
395 pd[pos2].reg_addr = 17;
396 pd[pos2].reg_alt_addr = 17;
397 pos2++;
398
399 __pfm_vbprintf("[PMC11(pmc11)=0x%lx tlb=%s plm=%d pm=%d ism=0x%x umask=0x%x pt=%d]\n",
400 reg.pmc_val,
401 reg.pmc11_ita_reg.dear_tlb ? "Yes" : "No",
407 __pfm_vbprintf("[PMD2(pmd2)]\n[PMD3(pmd3)\nPMD17(pmd17)\n");
408
409 /* update final number of entries used */
410 outp->pfp_pmc_count = pos1;
411 outp->pfp_pmd_count = pos2;
412
413 return PFMLIB_SUCCESS;
414}
#define PFMLIB_ERR_INVAL
Definition: pfmlib.h:285
int pfm_ita_get_ear_mode(unsigned int i, pfmlib_ita_ear_mode_t *m)
#define evt_umask(e)
#define is_dear(i)
@ PFMLIB_ITA_ISM_BOTH
pfmlib_ita_ism_t ear_ism
unsigned long ear_umask
pfmlib_ita_ear_mode_t ear_mode
unsigned char ear_used
unsigned int ear_plm
pfmlib_ita_ear_t pfp_ita_dear
unsigned long dear_tlb
struct pfm_ita_pmc_reg_t::@33 pmc11_ita_reg
unsigned long dear_pm
unsigned long dear_umask
unsigned long dear_ism
unsigned long dear_pt
unsigned long dear_plm
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_ita_input_param_t mod_in,
pfmlib_output_param_t outp,
pfmlib_ita_output_param_t mod_out 
)
static

Definition at line 860 of file pfmlib_itanium.c.

861{
862 pfmlib_ita_input_param_t *param = mod_in;
863 pfmlib_event_t *e = inp->pfp_events;
864 pfmlib_reg_t *pc = outp->pfp_pmcs;
868 unsigned int i, count;
869 int pos = outp->pfp_pmc_count;
870 int ret, base_idx = 0;
871 int n_intervals;
872
873 if (param == NULL || param->pfp_ita_drange.rr_used == 0) return PFMLIB_SUCCESS;
874
875 if (mod_out == NULL) return PFMLIB_ERR_INVAL;
876
877 irr = &param->pfp_ita_drange;
878 orr = &mod_out->pfp_ita_drange;
879
880 ret = check_intervals(irr, 1 , &n_intervals);
881 if (ret != PFMLIB_SUCCESS) return ret;
882
883 if (n_intervals < 1) return PFMLIB_ERR_DRRINVAL;
884
885 DPRINT("n_intervals=%d\n", n_intervals);
886
887 ret = compute_normal_rr(irr, inp->pfp_dfl_plm, n_intervals, &base_idx, orr);
888 if (ret != PFMLIB_SUCCESS) {
889 return ret == PFMLIB_ERR_TOOMANY ? PFMLIB_ERR_DRRTOOMANY : ret;
890 }
891 count = inp->pfp_event_count;
892 for (i=0; i < count; i++) {
893 if (is_dear(e[i].event)) return PFMLIB_SUCCESS; /* will be done there */
894 }
895
896 reg.pmc_val = 0UL;
897 /*
898 * here we have no other choice but to use the default priv level as there is no
899 * specific D-EAR event provided
900 */
902
903 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 11))
904 return PFMLIB_ERR_NOASSIGN;
905
906 pc[pos].reg_num = 11;
907 pc[pos].reg_value = reg.pmc_val;
908 pc[pos].reg_addr = 11;
909 pc[pos].reg_alt_addr= 11;
910 pos++;
911
912 __pfm_vbprintf("[PMC11(pmc11)=0x%lx tlb=%s plm=%d pm=%d ism=0x%x umask=0x%x pt=%d]\n",
913 reg.pmc_val,
914 reg.pmc11_ita_reg.dear_tlb ? "Yes" : "No",
920
921
922 outp->pfp_pmc_count = pos;
923
924 return PFMLIB_SUCCESS;
925}
#define PFMLIB_ERR_DRRTOOMANY
Definition: pfmlib.h:302
#define PFMLIB_ERR_DRRINVAL
Definition: pfmlib.h:301
static int check_intervals(pfmlib_ita_input_rr_t *irr, int mode, int *n_intervals)
static int compute_normal_rr(pfmlib_ita_input_rr_t *irr, int dfl_plm, int n, int *base_idx, pfmlib_ita_output_rr_t *orr)
pfmlib_ita_output_rr_t pfp_ita_drange
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_ita_input_param_t mod_in,
pfmlib_output_param_t outp 
)
static

Definition at line 235 of file pfmlib_itanium.c.

236{
238 pfmlib_ita_input_param_t *param = mod_in;
239 pfmlib_ita_input_param_t fake_param;
240 pfmlib_reg_t *pc, *pd;
241 unsigned int pos1, pos2;
242 int iear_idx = -1;
243 unsigned int i, count;
244
245 pc = outp->pfp_pmcs;
246 pd = outp->pfp_pmds;
247 pos1 = outp->pfp_pmc_count;
248 pos2 = outp->pfp_pmd_count;
249 count = inp->pfp_event_count;
250
251 for (i=0; i < count; i++) {
252 if (is_iear(inp->pfp_events[i].event)) iear_idx = i;
253 }
254
255 if (param == NULL || mod_in->pfp_ita_iear.ear_used == 0) {
256
257 /*
258 * case 3: no I-EAR event, no (or nothing) in param->pfp_ita2_iear.ear_used
259 */
260 if (iear_idx == -1) return PFMLIB_SUCCESS;
261
262 memset(&fake_param, 0, sizeof(fake_param));
263 param = &fake_param;
264
266
267 param->pfp_ita_iear.ear_umask = evt_umask(inp->pfp_events[iear_idx].event);
268 param->pfp_ita_iear.ear_ism = PFMLIB_ITA_ISM_BOTH; /* force both instruction sets */
269
270 DPRINT("I-EAR event with no info\n");
271 }
272
273 /* sanity check on the mode */
274 if (param->pfp_ita_iear.ear_mode < 0 || param->pfp_ita_iear.ear_mode > 2) return PFMLIB_ERR_INVAL;
275
276 /*
277 * case 2: ear_used=1, event is defined, we use the param info as it is more precise
278 * case 4: ear_used=1, no event (free running I-EAR), use param info
279 */
280 reg.pmc_val = 0;
281
282 /* if plm is 0, then assume not specified per-event and use default */
288
289 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 10))
290 return PFMLIB_ERR_NOASSIGN;
291
292 pc[pos1].reg_num = 10; /* PMC10 is I-EAR config register */
293 pc[pos1].reg_value = reg.pmc_val;
294 pc[pos1].reg_addr = 10;
295 pc[pos1].reg_alt_addr= 10;
296 pos1++;
297 pd[pos2].reg_num = 0;
298 pd[pos2].reg_addr = 0;
299 pd[pos2].reg_alt_addr = 0;
300 pos2++;
301 pd[pos2].reg_num = 1;
302 pd[pos2].reg_addr = 1;
303 pd[pos2].reg_alt_addr = 1;
304 pos2++;
305
306 __pfm_vbprintf("[PMC10(pmc10)=0x%lx tlb=%s plm=%d pm=%d ism=0x%x umask=0x%x]\n",
307 reg.pmc_val,
308 reg.pmc10_ita_reg.iear_tlb ? "Yes" : "No",
313 __pfm_vbprintf("[PMD0(pmd0)]\n[PMD1(pmd1)\n");
314
315 /* update final number of entries used */
316 outp->pfp_pmc_count = pos1;
317 outp->pfp_pmd_count = pos2;
318
319 return PFMLIB_SUCCESS;
320}
#define is_iear(i)
pfmlib_ita_ear_t pfp_ita_iear
struct pfm_ita_pmc_reg_t::@32 pmc10_ita_reg
unsigned long iear_plm
unsigned long iear_pm
unsigned long iear_umask
unsigned long iear_ism
unsigned long iear_tlb
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_ita_input_param_t mod_in,
pfmlib_output_param_t outp,
pfmlib_ita_output_param_t mod_out 
)
static

Definition at line 810 of file pfmlib_itanium.c.

811{
813 pfmlib_ita_input_param_t *param = mod_in;
814 pfmlib_reg_t *pc = outp->pfp_pmcs;
817 int pos = outp->pfp_pmc_count;
818 int ret, base_idx = 0;
819 int n_intervals;
820
821 if (param == NULL || param->pfp_ita_irange.rr_used == 0) return PFMLIB_SUCCESS;
822
823 if (mod_out == NULL) return PFMLIB_ERR_INVAL;
824
825 irr = &param->pfp_ita_irange;
826 orr = &mod_out->pfp_ita_irange;
827
828 ret = check_intervals(irr, 0, &n_intervals);
829 if (ret != PFMLIB_SUCCESS) return ret;
830
831 if (n_intervals < 1) return PFMLIB_ERR_IRRINVAL;
832
833 DPRINT("n_intervals=%d\n", n_intervals);
834
835 ret = compute_normal_rr(irr, inp->pfp_dfl_plm, n_intervals, &base_idx, orr);
836 if (ret != PFMLIB_SUCCESS) {
837 return ret == PFMLIB_ERR_TOOMANY ? PFMLIB_ERR_IRRTOOMANY : ret;
838 }
839 reg.pmc_val = 0;
840
841 reg.pmc13_ita_reg.irange_ta = 0x0;
842
843 if (pfm_regmask_isset(&inp->pfp_unavail_pmcs, 13))
844 return PFMLIB_ERR_NOASSIGN;
845
846 pc[pos].reg_num = 13;
847 pc[pos].reg_value = reg.pmc_val;
848 pc[pos].reg_addr = 13;
849 pc[pos].reg_alt_addr= 13;
850 pos++;
851
852 __pfm_vbprintf("[PMC13(pmc13)=0x%lx ta=%d]\n", reg.pmc_val, reg.pmc13_ita_reg.irange_ta);
853
854 outp->pfp_pmc_count = pos;
855
856 return PFMLIB_SUCCESS;
857}
#define PFMLIB_ERR_IRRTOOMANY
Definition: pfmlib.h:300
pfmlib_ita_output_rr_t pfp_ita_irange
unsigned long irange_ta
struct pfm_ita_pmc_reg_t::@35 pmc13_ita_reg
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_ita_input_param_t mod_in,
pfmlib_output_param_t outp 
)
static

Definition at line 417 of file pfmlib_itanium.c.

418{
419 pfmlib_ita_input_param_t *param = mod_in;
421 pfmlib_reg_t *pc = outp->pfp_pmcs;
422 int pos = outp->pfp_pmc_count;
423
424 if (param == NULL) return PFMLIB_SUCCESS;
425
426 if (param->pfp_ita_pmc8.opcm_used) {
427
428 reg.pmc_val = param->pfp_ita_pmc8.pmc_val;
429
431 return PFMLIB_ERR_NOASSIGN;
432
433 pc[pos].reg_num = 8;
434 pc[pos].reg_value = reg.pmc_val;
435 pc[pos].reg_addr = 8;
436 pc[pos].reg_alt_addr = 8;
437 pos++;
438
439
440 __pfm_vbprintf("[PMC8(pmc8)=0x%lx m=%d i=%d f=%d b=%d match=0x%x mask=0x%x]\n",
441 reg.pmc_val,
442 reg.pmc8_9_ita_reg.m,
443 reg.pmc8_9_ita_reg.i,
444 reg.pmc8_9_ita_reg.f,
445 reg.pmc8_9_ita_reg.b,
447 reg.pmc8_9_ita_reg.mask);
448 }
449
450 if (param->pfp_ita_pmc9.opcm_used) {
451
452 reg.pmc_val = param->pfp_ita_pmc9.pmc_val;
453
455 return PFMLIB_ERR_NOASSIGN;
456
457 pc[pos].reg_num = 9;
458 pc[pos].reg_value = reg.pmc_val;
459 pc[pos].reg_addr = 9;
460 pc[pos].reg_alt_addr = 9;
461 pos++;
462
463
464 __pfm_vbprintf("[PMC9(pmc9)=0x%lx m=%d i=%d f=%d b=%d match=0x%x mask=0x%x]\n",
465 reg.pmc_val,
466 reg.pmc8_9_ita_reg.m,
467 reg.pmc8_9_ita_reg.i,
468 reg.pmc8_9_ita_reg.f,
469 reg.pmc8_9_ita_reg.b,
471 reg.pmc8_9_ita_reg.mask);
472 }
473 outp->pfp_pmc_count = pos;
474 return PFMLIB_SUCCESS;
475}
pfmlib_ita_opcm_t pfp_ita_pmc9
pfmlib_ita_opcm_t pfp_ita_pmc8
unsigned long pmc_val
unsigned char opcm_used
unsigned long match
unsigned long i
unsigned long b
unsigned long m
unsigned long f
unsigned long mask
struct pfm_ita_pmc_reg_t::@31 pmc8_9_ita_reg
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_ita_detect()

static int pfm_ita_detect ( void  )
static

Definition at line 88 of file pfmlib_itanium.c.

89{
90 int ret = PFMLIB_ERR_NOTSUPP;
91
92 /*
93 * we support all chips (there is only one!) in the Itanium family
94 */
95 if (pfm_ia64_get_cpu_family() == 0x07) ret = PFMLIB_SUCCESS;
96 return ret;
97}
#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_ita_dispatch_counters()

static int pfm_ita_dispatch_counters ( pfmlib_input_param_t inp,
pfmlib_ita_input_param_t mod_in,
pfmlib_output_param_t outp 
)
static

Definition at line 121 of file pfmlib_itanium.c.

122{
123#define has_counter(e,b) (itanium_pe[e].pme_counters & (1 << (b)) ? (b) : 0)
124 pfmlib_ita_input_param_t *param = mod_in;
127 pfmlib_reg_t *pc, *pd;
128 pfmlib_regmask_t *r_pmcs;
129 unsigned int i,j,k,l, m;
130 unsigned int max_l0, max_l1, max_l2, max_l3;
131 unsigned int assign[PMU_ITA_NUM_COUNTERS];
132 unsigned int cnt;
133
134 e = inp->pfp_events;
135 pc = outp->pfp_pmcs;
136 pd = outp->pfp_pmds;
137 cnt = inp->pfp_event_count;
138 r_pmcs = &inp->pfp_unavail_pmcs;
139
140 if (PFMLIB_DEBUG()) {
141 for (m=0; m < cnt; m++) {
142 DPRINT("ev[%d]=%s counters=0x%lx\n", m, itanium_pe[e[m].event].pme_name,
143 itanium_pe[e[m].event].pme_counters);
144 }
145 }
147
152
153 DPRINT("max_l0=%u max_l1=%u max_l2=%u max_l3=%u\n", max_l0, max_l1, max_l2, max_l3);
154 /*
155 * This code needs fixing. It is not very pretty and
156 * won't handle more than 4 counters if more become
157 * available !
158 * For now, worst case in the loop nest: 4! (factorial)
159 */
160 for (i=PMU_ITA_FIRST_COUNTER; i < max_l0; i++) {
161
162 assign[0]= has_counter(e[0].event,i);
163
164 if (max_l1 == PMU_ITA_FIRST_COUNTER && valid_assign(assign, r_pmcs, cnt) == PFMLIB_SUCCESS) goto done;
165
166 for (j=PMU_ITA_FIRST_COUNTER; j < max_l1; j++) {
167
168 if (j == i) continue;
169
170 assign[1] = has_counter(e[1].event,j);
171
172 if (max_l2 == PMU_ITA_FIRST_COUNTER && valid_assign(assign, r_pmcs, cnt) == PFMLIB_SUCCESS) goto done;
173
174 for (k=PMU_ITA_FIRST_COUNTER; k < max_l2; k++) {
175
176 if(k == i || k == j) continue;
177
178 assign[2] = has_counter(e[2].event,k);
179
180 if (max_l3 == PMU_ITA_FIRST_COUNTER && valid_assign(assign, r_pmcs, cnt) == PFMLIB_SUCCESS) goto done;
181 for (l=PMU_ITA_FIRST_COUNTER; l < max_l3; l++) {
182
183 if(l == i || l == j || l == k) continue;
184
185 assign[3] = has_counter(e[3].event,l);
186
187 if (valid_assign(assign, r_pmcs, cnt) == PFMLIB_SUCCESS) goto done;
188 }
189 }
190 }
191 }
192 /* we cannot satisfy the constraints */
193 return PFMLIB_ERR_NOASSIGN;
194done:
195 for (j=0; j < cnt ; j++ ) {
196 reg.pmc_val = 0; /* clear all */
197 /* if plm is 0, then assume not specified per-event and use default */
198 reg.pmc_plm = e[j].plm ? e[j].plm : inp->pfp_dfl_plm;
199 reg.pmc_oi = 1; /* overflow interrupt */
200 reg.pmc_pm = inp->pfp_flags & PFMLIB_PFP_SYSTEMWIDE ? 1 : 0;
201 reg.pmc_thres = param ? param->pfp_ita_counters[j].thres: 0;
202 reg.pmc_ism = param ? param->pfp_ita_counters[j].ism : PFMLIB_ITA_ISM_BOTH;
203 reg.pmc_umask = is_ear(e[j].event) ? 0x0 : evt_umask(e[j].event);
204 reg.pmc_es = itanium_pe[e[j].event].pme_code;
205
206 pc[j].reg_num = assign[j];
207 pc[j].reg_value = reg.pmc_val;
208 pc[j].reg_addr = assign[j];
209 pc[j].reg_alt_addr= assign[j];
210
211 pd[j].reg_num = assign[j];
212 pd[j].reg_addr = assign[j];
213 pd[j].reg_alt_addr = assign[j];
214
215 __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",
216 assign[j],
217 assign[j],
218 reg.pmc_val,
219 reg.pmc_thres,
220 reg.pmc_es,reg.pmc_plm,
221 reg.pmc_umask, reg.pmc_pm,
222 reg.pmc_ism,
223 reg.pmc_oi,
224 itanium_pe[e[j].event].pme_name);
225 __pfm_vbprintf("[PMD%u(pmd%u)]\n", pd[j].reg_num, pd[j].reg_num);
226 }
227 /* number of PMC registers programmed */
228 outp->pfp_pmc_count = cnt;
229 outp->pfp_pmd_count = cnt;
230
231 return PFMLIB_SUCCESS;
232}
static pme_ita_entry_t itanium_pe[]
#define has_counter(e, b)
#define is_ear(i)
static int valid_assign(unsigned int *as, pfmlib_regmask_t *r_pmcs, unsigned int cnt)
#define PMU_ITA_NUM_COUNTERS
#define PMU_ITA_FIRST_COUNTER
pfmlib_ita_ism_t ism
char * pme_name
unsigned long pmc_umask
unsigned long pmc_plm
unsigned long pmc_thres
unsigned long pmc_oi
unsigned long pmc_es
unsigned long pmc_pm
unsigned long pmc_ism
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfm_ita_dispatch_events()

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

Definition at line 970 of file pfmlib_itanium.c.

971{
972 int ret;
975
976 /*
977 * nothing will come out of this combination
978 */
979 if (mod_out && mod_in == NULL) return PFMLIB_ERR_INVAL;
980
981 /* check opcode match, range restriction qualifiers */
982 if (mod_in && check_qualifier_constraints(inp, mod_in) != PFMLIB_SUCCESS) return PFMLIB_ERR_FEATCOMB;
983
984 /* check for problems with raneg restriction and per-event plm */
985 if (mod_in && check_range_plm(inp, mod_in) != PFMLIB_SUCCESS) return PFMLIB_ERR_FEATCOMB;
986
987 ret = pfm_ita_dispatch_counters(inp, mod_in, outp);
988 if (ret != PFMLIB_SUCCESS) return ret;
989
990 /* now check for I-EAR */
991 ret = pfm_dispatch_iear(inp, mod_in, outp);
992 if (ret != PFMLIB_SUCCESS) return ret;
993
994 /* now check for D-EAR */
995 ret = pfm_dispatch_dear(inp, mod_in, outp);
996 if (ret != PFMLIB_SUCCESS) return ret;
997
998 /* now check for Opcode matchers */
999 ret = pfm_dispatch_opcm(inp, mod_in, outp);
1000 if (ret != PFMLIB_SUCCESS) return ret;
1001
1002 ret = pfm_dispatch_btb(inp, mod_in, outp);
1003 if (ret != PFMLIB_SUCCESS) return ret;
1004
1005 ret = pfm_dispatch_irange(inp, mod_in, outp, mod_out);;
1006 if (ret != PFMLIB_SUCCESS) return ret;
1007
1008 ret = pfm_dispatch_drange(inp, mod_in, outp, mod_out);;
1009
1010 return ret;
1011}
static int pfm_dispatch_iear(pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
static int pfm_dispatch_opcm(pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
static int pfm_dispatch_irange(pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita_output_param_t *mod_out)
static int check_qualifier_constraints(pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in)
static int pfm_dispatch_drange(pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp, pfmlib_ita_output_param_t *mod_out)
static int check_range_plm(pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in)
static int pfm_ita_dispatch_counters(pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
static int pfm_dispatch_btb(pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
static int pfm_dispatch_dear(pfmlib_input_param_t *inp, pfmlib_ita_input_param_t *mod_in, pfmlib_output_param_t *outp)
Here is the call graph for this function:

◆ pfm_ita_get_cycle_event()

static int pfm_ita_get_cycle_event ( pfmlib_event_t e)
static

Definition at line 1181 of file pfmlib_itanium.c.

1182{
1184 return PFMLIB_SUCCESS;
1185
1186}
#define PME_ITA_CPU_CYCLES

◆ pfm_ita_get_ear_mode()

int pfm_ita_get_ear_mode ( unsigned int  i,
pfmlib_ita_ear_mode_t m 
)

Definition at line 1091 of file pfmlib_itanium.c.

1092{
1093 if (!is_ear(i) || m == NULL) return PFMLIB_ERR_INVAL;
1094
1096
1097 return PFMLIB_SUCCESS;
1098}
#define is_ear_tlb(i)
@ PFMLIB_ITA_EAR_TLB_MODE
@ PFMLIB_ITA_EAR_CACHE_MODE
Here is the caller graph for this function:

◆ pfm_ita_get_event_code()

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

Definition at line 1102 of file pfmlib_itanium.c.

1103{
1104 if (cnt != PFMLIB_CNT_FIRST && (cnt < 4 || cnt > 7))
1105 return PFMLIB_ERR_INVAL;
1106
1107 *code = (int)itanium_pe[i].pme_code;
1108
1109 return PFMLIB_SUCCESS;
1110}
#define pme_code
#define PFMLIB_CNT_FIRST
Definition: pfmlib_priv.h:62
int
Definition: sde_internal.h:89

◆ pfm_ita_get_event_counters()

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

Definition at line 1130 of file pfmlib_itanium.c.

1131{
1132 unsigned int i;
1133 unsigned long m;
1134
1135 memset(counters, 0, sizeof(*counters));
1136
1138 for(i=0; m ; i++, m>>=1) {
1139 if (m & 0x1)
1140 pfm_regmask_set(counters, i);
1141 }
1142}
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_ita_get_event_maxincr()

int pfm_ita_get_event_maxincr ( unsigned int  i,
unsigned int maxincr 
)

Definition at line 1015 of file pfmlib_itanium.c.

1016{
1017 if (i >= PME_ITA_EVENT_COUNT || maxincr == NULL) return PFMLIB_ERR_INVAL;
1018 *maxincr = itanium_pe[i].pme_maxincr;
1019 return PFMLIB_SUCCESS;
1020}
#define PME_ITA_EVENT_COUNT
unsigned int pme_maxincr

◆ pfm_ita_get_event_name()

static char * pfm_ita_get_event_name ( unsigned int  i)
static

Definition at line 1124 of file pfmlib_itanium.c.

1125{
1126 return itanium_pe[i].pme_name;
1127}

◆ pfm_ita_get_event_umask()

int pfm_ita_get_event_umask ( unsigned int  i,
unsigned long umask 
)

Definition at line 1116 of file pfmlib_itanium.c.

1117{
1118 if (i >= PME_ITA_EVENT_COUNT || umask == NULL) return PFMLIB_ERR_INVAL;
1119 *umask = evt_umask(i);
1120 return PFMLIB_SUCCESS;
1121}

◆ pfm_ita_get_hw_counter_width()

static void pfm_ita_get_hw_counter_width ( unsigned int width)
static

Definition at line 1175 of file pfmlib_itanium.c.

1176{
1177 *width = PMU_ITA_COUNTER_WIDTH;
1178}
#define PMU_ITA_COUNTER_WIDTH

◆ pfm_ita_get_impl_counters()

static void pfm_ita_get_impl_counters ( pfmlib_regmask_t impl_counters)
static

Definition at line 1165 of file pfmlib_itanium.c.

1166{
1167 unsigned int i = 0;
1168
1169 /* counting pmds are contiguous */
1170 for(i=4; i < 8; i++)
1171 pfm_regmask_set(impl_counters, i);
1172}
Here is the call graph for this function:

◆ pfm_ita_get_impl_pmcs()

static void pfm_ita_get_impl_pmcs ( pfmlib_regmask_t impl_pmcs)
static

Definition at line 1145 of file pfmlib_itanium.c.

1146{
1147 unsigned int i = 0;
1148
1149 /* all pmcs are contiguous */
1150 for(i=0; i < PMU_ITA_NUM_PMCS; i++)
1151 pfm_regmask_set(impl_pmcs, i);
1152}
#define PMU_ITA_NUM_PMCS
Here is the call graph for this function:

◆ pfm_ita_get_impl_pmds()

static void pfm_ita_get_impl_pmds ( pfmlib_regmask_t impl_pmds)
static

Definition at line 1155 of file pfmlib_itanium.c.

1156{
1157 unsigned int i = 0;
1158
1159 /* all pmds are contiguous */
1160 for(i=0; i < PMU_ITA_NUM_PMDS; i++)
1161 pfm_regmask_set(impl_pmds, i);
1162}
#define PMU_ITA_NUM_PMDS
Here is the call graph for this function:

◆ pfm_ita_get_inst_retired()

static int pfm_ita_get_inst_retired ( pfmlib_event_t e)
static

Definition at line 1189 of file pfmlib_itanium.c.

1190{
1192 return PFMLIB_SUCCESS;
1193}
#define PME_ITA_IA64_INST_RETIRED

◆ pfm_ita_is_btb()

int pfm_ita_is_btb ( unsigned int  i)

Definition at line 1065 of file pfmlib_itanium.c.

1066{
1067 return i >= PME_ITA_EVENT_COUNT || ! is_btb(i) ? 0 : 1;
1068}
Here is the caller graph for this function:

◆ pfm_ita_is_dear()

int pfm_ita_is_dear ( unsigned int  i)

Definition at line 1029 of file pfmlib_itanium.c.

1030{
1031 return i >= PME_ITA_EVENT_COUNT || ! is_dear(i) ? 0 : 1;
1032}
Here is the caller graph for this function:

◆ pfm_ita_is_dear_cache()

int pfm_ita_is_dear_cache ( unsigned int  i)

Definition at line 1041 of file pfmlib_itanium.c.

1042{
1043 return i >= PME_ITA_EVENT_COUNT || ! (is_dear(i) && !is_ear_tlb(i)) ? 0 : 1;
1044}

◆ pfm_ita_is_dear_tlb()

int pfm_ita_is_dear_tlb ( unsigned int  i)

Definition at line 1035 of file pfmlib_itanium.c.

1036{
1037 return i >= PME_ITA_EVENT_COUNT || ! (is_dear(i) && is_ear_tlb(i)) ? 0 : 1;
1038}

◆ pfm_ita_is_ear()

int pfm_ita_is_ear ( unsigned int  i)

Definition at line 1023 of file pfmlib_itanium.c.

1024{
1025 return i >= PME_ITA_EVENT_COUNT || ! is_ear(i) ? 0 : 1;
1026}

◆ pfm_ita_is_iear()

int pfm_ita_is_iear ( unsigned int  i)

Definition at line 1047 of file pfmlib_itanium.c.

1048{
1049 return i >= PME_ITA_EVENT_COUNT || ! is_iear(i) ? 0 : 1;
1050}
Here is the caller graph for this function:

◆ pfm_ita_is_iear_cache()

int pfm_ita_is_iear_cache ( unsigned int  i)

Definition at line 1059 of file pfmlib_itanium.c.

1060{
1061 return i >= PME_ITA_EVENT_COUNT || ! (is_iear(i) && !is_ear_tlb(i)) ? 0 : 1;
1062}

◆ pfm_ita_is_iear_tlb()

int pfm_ita_is_iear_tlb ( unsigned int  i)

Definition at line 1053 of file pfmlib_itanium.c.

1054{
1055 return i >= PME_ITA_EVENT_COUNT || ! (is_iear(i) && is_ear_tlb(i)) ? 0 : 1;
1056}

◆ pfm_ita_support_darr()

int pfm_ita_support_darr ( unsigned int  i)

Definition at line 1078 of file pfmlib_itanium.c.

1079{
1080 return i >= PME_ITA_EVENT_COUNT || ! has_darr(i) ? 0 : 1;
1081}
Here is the caller graph for this function:

◆ pfm_ita_support_iarr()

int pfm_ita_support_iarr ( unsigned int  i)

Definition at line 1071 of file pfmlib_itanium.c.

1072{
1073 return i >= PME_ITA_EVENT_COUNT || ! has_iarr(i) ? 0 : 1;
1074}
Here is the caller graph for this function:

◆ pfm_ita_support_opcm()

int pfm_ita_support_opcm ( unsigned int  i)

Definition at line 1085 of file pfmlib_itanium.c.

1086{
1087 return i >= PME_ITA_EVENT_COUNT || ! has_opcm(i) ? 0 : 1;
1088}
Here is the caller graph for this function:

◆ print_one_range()

static void print_one_range ( pfmlib_ita_input_rr_desc_t in_rr,
pfmlib_ita_output_rr_desc_t out_rr,
pfmlib_reg_t dbr,
int  base_idx,
int  n_pairs 
)
static

Definition at line 720 of file pfmlib_itanium.c.

721{
722 int j;
723 dbreg_t d;
724 unsigned long r_end;
725
726 __pfm_vbprintf("[0x%lx-0x%lx): %d register pair(s)\n", in_rr->rr_start, in_rr->rr_end, n_pairs);
727 __pfm_vbprintf("start offset: -0x%lx end_offset: +0x%lx\n", out_rr->rr_soff, out_rr->rr_eoff);
728
729 for (j=0; j < n_pairs; j++, base_idx += 2) {
730
731 d.val = dbr[base_idx+1].reg_value;
732 r_end = dbr[base_idx].reg_value+((~(d.db.db_mask)) & ~(0xffUL << 56));
733
734 __pfm_vbprintf("brp%u: db%u: 0x%016lx db%u: plm=0x%x mask=0x%016lx end=0x%016lx\n",
735 dbr[base_idx].reg_num>>1,
736 dbr[base_idx].reg_num,
737 dbr[base_idx].reg_value,
738 dbr[base_idx+1].reg_num,
739 d.db.db_plm,
740 (unsigned long) d.db.db_mask,
741 r_end);
742 }
743}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ valid_assign()

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

Definition at line 103 of file pfmlib_itanium.c.

104{
105 unsigned int i;
106 for(i=0; i < cnt; i++) {
107 if (as[i]==0) return PFMLIB_ERR_NOASSIGN;
108 /*
109 * take care of restricted PMC registers
110 */
111 if (pfm_regmask_isset(r_pmcs, as[i]))
112 return PFMLIB_ERR_NOASSIGN;
113 }
114 return PFMLIB_SUCCESS;
115}
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ itanium_support

pfm_pmu_support_t itanium_support
Initial value:
={
.pmu_name = "itanium",
.pmu_type = PFMLIB_ITANIUM_PMU,
.pme_count = PME_ITA_EVENT_COUNT,
.pmc_count = PMU_ITA_NUM_PMCS,
.pmd_count = PMU_ITA_NUM_PMDS,
.get_event_code = pfm_ita_get_event_code,
.get_event_name = pfm_ita_get_event_name,
.get_event_counters = pfm_ita_get_event_counters,
.dispatch_events = pfm_ita_dispatch_events,
.pmu_detect = pfm_ita_detect,
.get_impl_pmcs = pfm_ita_get_impl_pmcs,
.get_impl_pmds = pfm_ita_get_impl_pmds,
.get_impl_counters = pfm_ita_get_impl_counters,
.get_hw_counter_width = pfm_ita_get_hw_counter_width,
.get_cycle_event = pfm_ita_get_cycle_event,
.get_inst_retired_event = pfm_ita_get_inst_retired
}
#define PFMLIB_ITANIUM_PMU
Definition: pfmlib.h:224
static int pfm_ita_detect(void)
static void pfm_ita_get_event_counters(unsigned int j, pfmlib_regmask_t *counters)
static void pfm_ita_get_hw_counter_width(unsigned int *width)
static char * pfm_ita_get_event_name(unsigned int i)
static int pfm_ita_dispatch_events(pfmlib_input_param_t *inp, void *model_in, pfmlib_output_param_t *outp, void *model_out)
static void pfm_ita_get_impl_pmds(pfmlib_regmask_t *impl_pmds)
static int pfm_ita_get_inst_retired(pfmlib_event_t *e)
static int pfm_ita_get_cycle_event(pfmlib_event_t *e)
static int pfm_ita_get_event_code(unsigned int i, unsigned int cnt, int *code)
static void pfm_ita_get_impl_pmcs(pfmlib_regmask_t *impl_pmcs)
static void pfm_ita_get_impl_counters(pfmlib_regmask_t *impl_counters)

Definition at line 1195 of file pfmlib_itanium.c.