Skip to content

Commit f8a86a9

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf/x86/intel/uncore: Support HBM and CXL PMON counters
Unknown uncore PMON types can be found in both SPR and EMR with HBM or CXL. $ls /sys/devices/ | grep type uncore_type_12_16 uncore_type_12_18 uncore_type_12_2 uncore_type_12_4 uncore_type_12_6 uncore_type_12_8 uncore_type_13_17 uncore_type_13_19 uncore_type_13_3 uncore_type_13_5 uncore_type_13_7 uncore_type_13_9 The unknown PMON types are HBM and CXL PMON. Except for the name, the other information regarding the HBM and CXL PMON counters can be retrieved via the discovery table. Add them into the uncores tables for SPR and EMR. The event config registers for all CXL related units are 8-byte apart. Add SPR_UNCORE_MMIO_OFFS8_COMMON_FORMAT to specially handle it. Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Yunying Sun <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 15a4bd5 commit f8a86a9

File tree

1 file changed

+53
-2
lines changed

1 file changed

+53
-2
lines changed

arch/x86/events/intel/uncore_snbep.c

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6163,7 +6163,55 @@ static struct intel_uncore_type spr_uncore_mdf = {
61636163
.name = "mdf",
61646164
};
61656165

6166-
#define UNCORE_SPR_NUM_UNCORE_TYPES 12
6166+
static void spr_uncore_mmio_offs8_init_box(struct intel_uncore_box *box)
6167+
{
6168+
__set_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags);
6169+
intel_generic_uncore_mmio_init_box(box);
6170+
}
6171+
6172+
static struct intel_uncore_ops spr_uncore_mmio_offs8_ops = {
6173+
.init_box = spr_uncore_mmio_offs8_init_box,
6174+
.exit_box = uncore_mmio_exit_box,
6175+
.disable_box = intel_generic_uncore_mmio_disable_box,
6176+
.enable_box = intel_generic_uncore_mmio_enable_box,
6177+
.disable_event = intel_generic_uncore_mmio_disable_event,
6178+
.enable_event = spr_uncore_mmio_enable_event,
6179+
.read_counter = uncore_mmio_read_counter,
6180+
};
6181+
6182+
#define SPR_UNCORE_MMIO_OFFS8_COMMON_FORMAT() \
6183+
SPR_UNCORE_COMMON_FORMAT(), \
6184+
.ops = &spr_uncore_mmio_offs8_ops
6185+
6186+
static struct event_constraint spr_uncore_cxlcm_constraints[] = {
6187+
UNCORE_EVENT_CONSTRAINT(0x02, 0x0f),
6188+
UNCORE_EVENT_CONSTRAINT(0x05, 0x0f),
6189+
UNCORE_EVENT_CONSTRAINT(0x40, 0xf0),
6190+
UNCORE_EVENT_CONSTRAINT(0x41, 0xf0),
6191+
UNCORE_EVENT_CONSTRAINT(0x42, 0xf0),
6192+
UNCORE_EVENT_CONSTRAINT(0x43, 0xf0),
6193+
UNCORE_EVENT_CONSTRAINT(0x4b, 0xf0),
6194+
UNCORE_EVENT_CONSTRAINT(0x52, 0xf0),
6195+
EVENT_CONSTRAINT_END
6196+
};
6197+
6198+
static struct intel_uncore_type spr_uncore_cxlcm = {
6199+
SPR_UNCORE_MMIO_OFFS8_COMMON_FORMAT(),
6200+
.name = "cxlcm",
6201+
.constraints = spr_uncore_cxlcm_constraints,
6202+
};
6203+
6204+
static struct intel_uncore_type spr_uncore_cxldp = {
6205+
SPR_UNCORE_MMIO_OFFS8_COMMON_FORMAT(),
6206+
.name = "cxldp",
6207+
};
6208+
6209+
static struct intel_uncore_type spr_uncore_hbm = {
6210+
SPR_UNCORE_COMMON_FORMAT(),
6211+
.name = "hbm",
6212+
};
6213+
6214+
#define UNCORE_SPR_NUM_UNCORE_TYPES 15
61676215
#define UNCORE_SPR_CHA 0
61686216
#define UNCORE_SPR_IIO 1
61696217
#define UNCORE_SPR_IMC 6
@@ -6187,6 +6235,9 @@ static struct intel_uncore_type *spr_uncores[UNCORE_SPR_NUM_UNCORE_TYPES] = {
61876235
NULL,
61886236
NULL,
61896237
&spr_uncore_mdf,
6238+
&spr_uncore_cxlcm,
6239+
&spr_uncore_cxldp,
6240+
&spr_uncore_hbm,
61906241
};
61916242

61926243
/*
@@ -6656,7 +6707,7 @@ static struct intel_uncore_type gnr_uncore_b2cmi = {
66566707
};
66576708

66586709
static struct intel_uncore_type gnr_uncore_b2cxl = {
6659-
SPR_UNCORE_MMIO_COMMON_FORMAT(),
6710+
SPR_UNCORE_MMIO_OFFS8_COMMON_FORMAT(),
66606711
.name = "b2cxl",
66616712
};
66626713

0 commit comments

Comments
 (0)