Skip to content

Commit 4d47d64

Browse files
Kan LiangIngo Molnar
authored andcommitted
perf/x86/intel/uncore: Support CoffeeLake 8th CBOX
Coffee Lake has 8 core products which has 8 Cboxes. The 8th CBOX is mapped into different MSR space. Increase the num_boxes to 8 to handle the new products. It will not impact the previous platforms, SkyLake, KabyLake and earlier CoffeeLake. Because the num_boxes will be recalculated in uncore_cpu_init and doesn't exceed the x86_max_cores. Introduce a new box flag bit to indicate the 8th CBOX. Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent c10a8de commit 4d47d64

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

arch/x86/events/intel/uncore.h

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,15 @@ struct intel_uncore_box {
129129
struct intel_uncore_extra_reg shared_regs[0];
130130
};
131131

132-
#define UNCORE_BOX_FLAG_INITIATED 0
133-
#define UNCORE_BOX_FLAG_CTL_OFFS8 1 /* event config registers are 8-byte apart */
132+
/* CFL uncore 8th cbox MSRs */
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
134141

135142
struct uncore_event_desc {
136143
struct kobj_attribute attr;
@@ -297,17 +304,27 @@ unsigned int uncore_freerunning_counter(struct intel_uncore_box *box,
297304
static inline
298305
unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx)
299306
{
300-
return box->pmu->type->event_ctl +
301-
(box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) +
302-
uncore_msr_box_offset(box);
307+
if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) {
308+
return CFL_UNC_CBO_7_PERFEVTSEL0 +
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+
}
303315
}
304316

305317
static inline
306318
unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx)
307319
{
308-
return box->pmu->type->perf_ctr +
309-
(box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) +
310-
uncore_msr_box_offset(box);
320+
if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) {
321+
return CFL_UNC_CBO_7_PER_CTR0 +
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+
}
311328
}
312329

313330
static inline

arch/x86/events/intel/uncore_snb.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ static void skl_uncore_msr_init_box(struct intel_uncore_box *box)
221221
wrmsrl(SKL_UNC_PERF_GLOBAL_CTL,
222222
SNB_UNC_GLOBAL_CTL_EN | SKL_UNC_GLOBAL_CTL_CORE_ALL);
223223
}
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);
224228
}
225229

226230
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 = {
247251
static struct intel_uncore_type skl_uncore_cbox = {
248252
.name = "cbox",
249253
.num_counters = 4,
250-
.num_boxes = 5,
254+
.num_boxes = 8,
251255
.perf_ctr_bits = 44,
252256
.fixed_ctr_bits = 48,
253257
.perf_ctr = SNB_UNC_CBO_0_PER_CTR0,

0 commit comments

Comments
 (0)