diff options
| -rw-r--r-- | arch/x86/events/intel/uncore.h | 33 | ||||
| -rw-r--r-- | arch/x86/events/intel/uncore_snb.c | 6 |
2 files changed, 30 insertions, 9 deletions
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index e17ab885b1e9..cb46d602a6b8 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h | |||
| @@ -129,8 +129,15 @@ struct intel_uncore_box { | |||
| 129 | struct intel_uncore_extra_reg shared_regs[0]; | 129 | struct intel_uncore_extra_reg shared_regs[0]; |
| 130 | }; | 130 | }; |
| 131 | 131 | ||
| 132 | #define UNCORE_BOX_FLAG_INITIATED 0 | 132 | /* CFL uncore 8th cbox MSRs */ |
| 133 | #define UNCORE_BOX_FLAG_CTL_OFFS8 1 /* event config registers are 8-byte apart */ | 133 | #define CFL_UNC_CBO_7_PERFEVTSEL0 0xf70 |
| 134 | #define CFL_UNC_CBO_7_PER_CTR0 0xf76 | ||
| 135 | |||
| 136 | #define UNCORE_BOX_FLAG_INITIATED 0 | ||
| 137 | /* event config registers are 8-byte apart */ | ||
| 138 | #define UNCORE_BOX_FLAG_CTL_OFFS8 1 | ||
| 139 | /* CFL 8th CBOX has different MSR space */ | ||
| 140 | #define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS 2 | ||
| 134 | 141 | ||
| 135 | struct uncore_event_desc { | 142 | struct uncore_event_desc { |
| 136 | struct kobj_attribute attr; | 143 | struct kobj_attribute attr; |
| @@ -297,17 +304,27 @@ unsigned int uncore_freerunning_counter(struct intel_uncore_box *box, | |||
| 297 | static inline | 304 | static inline |
| 298 | unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx) | 305 | unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx) |
| 299 | { | 306 | { |
| 300 | return box->pmu->type->event_ctl + | 307 | if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) { |
| 301 | (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + | 308 | return CFL_UNC_CBO_7_PERFEVTSEL0 + |
| 302 | uncore_msr_box_offset(box); | 309 | (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); |
| 310 | } else { | ||
| 311 | return box->pmu->type->event_ctl + | ||
| 312 | (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + | ||
| 313 | uncore_msr_box_offset(box); | ||
| 314 | } | ||
| 303 | } | 315 | } |
| 304 | 316 | ||
| 305 | static inline | 317 | static inline |
| 306 | unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx) | 318 | unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx) |
| 307 | { | 319 | { |
| 308 | return box->pmu->type->perf_ctr + | 320 | if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) { |
| 309 | (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + | 321 | return CFL_UNC_CBO_7_PER_CTR0 + |
| 310 | uncore_msr_box_offset(box); | 322 | (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx); |
| 323 | } else { | ||
| 324 | return box->pmu->type->perf_ctr + | ||
| 325 | (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + | ||
| 326 | uncore_msr_box_offset(box); | ||
| 327 | } | ||
| 311 | } | 328 | } |
| 312 | 329 | ||
| 313 | static inline | 330 | static inline |
diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c index bfa25814fe5f..2593b0d7aeee 100644 --- a/arch/x86/events/intel/uncore_snb.c +++ b/arch/x86/events/intel/uncore_snb.c | |||
| @@ -221,6 +221,10 @@ static void skl_uncore_msr_init_box(struct intel_uncore_box *box) | |||
| 221 | wrmsrl(SKL_UNC_PERF_GLOBAL_CTL, | 221 | wrmsrl(SKL_UNC_PERF_GLOBAL_CTL, |
| 222 | SNB_UNC_GLOBAL_CTL_EN | SKL_UNC_GLOBAL_CTL_CORE_ALL); | 222 | SNB_UNC_GLOBAL_CTL_EN | SKL_UNC_GLOBAL_CTL_CORE_ALL); |
| 223 | } | 223 | } |
| 224 | |||
| 225 | /* The 8th CBOX has different MSR space */ | ||
| 226 | if (box->pmu->pmu_idx == 7) | ||
| 227 | __set_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags); | ||
| 224 | } | 228 | } |
| 225 | 229 | ||
| 226 | static void skl_uncore_msr_enable_box(struct intel_uncore_box *box) | 230 | static void skl_uncore_msr_enable_box(struct intel_uncore_box *box) |
| @@ -247,7 +251,7 @@ static struct intel_uncore_ops skl_uncore_msr_ops = { | |||
| 247 | static struct intel_uncore_type skl_uncore_cbox = { | 251 | static struct intel_uncore_type skl_uncore_cbox = { |
| 248 | .name = "cbox", | 252 | .name = "cbox", |
| 249 | .num_counters = 4, | 253 | .num_counters = 4, |
| 250 | .num_boxes = 5, | 254 | .num_boxes = 8, |
| 251 | .perf_ctr_bits = 44, | 255 | .perf_ctr_bits = 44, |
| 252 | .fixed_ctr_bits = 48, | 256 | .fixed_ctr_bits = 48, |
| 253 | .perf_ctr = SNB_UNC_CBO_0_PER_CTR0, | 257 | .perf_ctr = SNB_UNC_CBO_0_PER_CTR0, |
