2 * pfmlib_intel_ivb_unc.c : Intel IvyBridge C-Box uncore PMU
4 * Contributed by Stephane Eranian <eranian@gmail.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10 * of the Software, and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
18 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
21 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #include "pfmlib_priv.h"
25 #include "pfmlib_intel_x86_priv.h"
27 #define INTEL_SNB_UNC_ATTRS \
28 (_INTEL_X86_ATTR_I|_INTEL_X86_ATTR_E|_INTEL_X86_ATTR_C)
30 /* same event table as SNB */
31 #include "events/intel_snb_unc_events.h"
34 pfm_ivb_unc_detect(void *this)
38 ret = pfm_intel_x86_detect();
39 if (ret != PFM_SUCCESS)
42 if (pfm_intel_x86_cfg.family != 6)
43 return PFM_ERR_NOTSUPP;
45 switch (pfm_intel_x86_cfg.model) {
46 case 58: /* IvyBridge */
49 return PFM_ERR_NOTSUPP;
54 #define IVB_UNC_CBOX(n, p) \
55 pfmlib_pmu_t intel_ivb_unc_cbo##n##_support={ \
56 .desc = "Intel Ivy Bridge C-box"#n" uncore", \
57 .name = "ivb_unc_cbo"#n, \
58 .perf_name = "uncore_cbox_"#n, \
59 .pmu = PFM_PMU_INTEL_IVB_UNC_CB##n, \
60 .pme_count = LIBPFM_ARRAY_SIZE(intel_snb_unc_##p##_pe), \
61 .type = PFM_PMU_TYPE_UNCORE, \
63 .num_fixed_cntrs = 1, \
65 .pe = intel_snb_unc_##p##_pe, \
66 .atdesc = intel_x86_mods, \
67 .flags = PFMLIB_PMU_FL_RAW_UMASK\
68 | PFMLIB_PMU_FL_NO_SMPL,\
69 .pmu_detect = pfm_ivb_unc_detect, \
70 .get_event_encoding[PFM_OS_NONE] = pfm_intel_x86_get_encoding, \
71 PFMLIB_ENCODE_PERF(pfm_intel_nhm_unc_get_perf_encoding), \
72 PFMLIB_OS_DETECT(pfm_intel_x86_perf_detect), \
73 .get_event_first = pfm_intel_x86_get_event_first, \
74 .get_event_next = pfm_intel_x86_get_event_next, \
75 .event_is_valid = pfm_intel_x86_event_is_valid, \
76 .validate_table = pfm_intel_x86_validate_table, \
77 .get_event_info = pfm_intel_x86_get_event_info, \
78 .get_event_attr_info = pfm_intel_x86_get_event_attr_info, \
79 PFMLIB_VALID_PERF_PATTRS(pfm_intel_x86_perf_validate_pattrs),\
80 .get_event_nattrs = pfm_intel_x86_get_event_nattrs,\
83 IVB_UNC_CBOX(0, cbo0);