Skip to content

Commit 9a3b675

Browse files
Alexander AntonovPeter Zijlstra
authored andcommitted
perf/x86/intel/uncore: Enable UPI topology discovery for Sapphire Rapids
UPI topology discovery on SPR is same as in ICX but UBOX device has different Device ID 0x3250. This patch enables /sys/devices/uncore_upi_*/die* attributes on SPR. Signed-off-by: Alexander Antonov <alexander.antonov@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Kan Liang <kan.liang@linux.intel.com> Link: https://lore.kernel.org/r/20221117122833.3103580-10-alexander.antonov@linux.intel.com
1 parent f680b6e commit 9a3b675

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

arch/x86/events/intel/uncore_snbep.c

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@
458458

459459
/* SPR */
460460
#define SPR_RAW_EVENT_MASK_EXT 0xffffff
461+
#define SPR_UBOX_DID 0x3250
461462

462463
/* SPR CHA */
463464
#define SPR_CHA_PMON_CTL_TID_EN (1 << 16)
@@ -6112,9 +6113,43 @@ static struct intel_uncore_type spr_uncore_m2m = {
61126113
.name = "m2m",
61136114
};
61146115

6116+
static struct attribute_group spr_upi_mapping_group = {
6117+
.is_visible = skx_upi_mapping_visible,
6118+
};
6119+
6120+
static const struct attribute_group *spr_upi_attr_update[] = {
6121+
&uncore_alias_group,
6122+
&spr_upi_mapping_group,
6123+
NULL
6124+
};
6125+
6126+
#define SPR_UPI_REGS_ADDR_DEVICE_LINK0 0x01
6127+
6128+
static int spr_upi_set_mapping(struct intel_uncore_type *type)
6129+
{
6130+
return pmu_upi_set_mapping(type, &spr_upi_mapping_group);
6131+
}
6132+
6133+
static void spr_upi_cleanup_mapping(struct intel_uncore_type *type)
6134+
{
6135+
pmu_cleanup_mapping(type, &spr_upi_mapping_group);
6136+
}
6137+
6138+
static int spr_upi_get_topology(struct intel_uncore_type *type)
6139+
{
6140+
return discover_upi_topology(type, SPR_UBOX_DID, SPR_UPI_REGS_ADDR_DEVICE_LINK0);
6141+
}
6142+
61156143
static struct intel_uncore_type spr_uncore_upi = {
6116-
SPR_UNCORE_PCI_COMMON_FORMAT(),
6144+
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
6145+
.event_mask_ext = SPR_RAW_EVENT_MASK_EXT,
6146+
.format_group = &spr_uncore_raw_format_group,
6147+
.ops = &spr_uncore_pci_ops,
61176148
.name = "upi",
6149+
.attr_update = spr_upi_attr_update,
6150+
.get_topology = spr_upi_get_topology,
6151+
.set_mapping = spr_upi_set_mapping,
6152+
.cleanup_mapping = spr_upi_cleanup_mapping,
61186153
};
61196154

61206155
static struct intel_uncore_type spr_uncore_m3upi = {
@@ -6318,6 +6353,12 @@ static void uncore_type_customized_copy(struct intel_uncore_type *to_type,
63186353
to_type->format_group = from_type->format_group;
63196354
if (from_type->attr_update)
63206355
to_type->attr_update = from_type->attr_update;
6356+
if (from_type->set_mapping)
6357+
to_type->set_mapping = from_type->set_mapping;
6358+
if (from_type->get_topology)
6359+
to_type->get_topology = from_type->get_topology;
6360+
if (from_type->cleanup_mapping)
6361+
to_type->cleanup_mapping = from_type->cleanup_mapping;
63216362
}
63226363

63236364
static struct intel_uncore_type **

0 commit comments

Comments
 (0)