Skip to content

Commit cf35791

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf/x86/intel/uncore: Generic uncore_get_uncores and MMIO format of SPR
Factor out SPR_UNCORE_MMIO_COMMON_FORMAT which can be reused by Granite Rapids in the following patch. Granite Rapids have more uncore units than Sapphire Rapids. Add new parameters to support adjustable uncore units. No functional change. Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Ammy Yi <ammy.yi@intel.com> Link: https://lore.kernel.org/r/20231117163939.2468007-1-kan.liang@linux.intel.com
1 parent 388a1fb commit cf35791

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

arch/x86/events/intel/uncore_snbep.c

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6079,13 +6079,16 @@ static struct uncore_event_desc spr_uncore_imc_events[] = {
60796079
{ /* end: all zeroes */ },
60806080
};
60816081

6082+
#define SPR_UNCORE_MMIO_COMMON_FORMAT() \
6083+
SPR_UNCORE_COMMON_FORMAT(), \
6084+
.ops = &spr_uncore_mmio_ops
6085+
60826086
static struct intel_uncore_type spr_uncore_imc = {
6083-
SPR_UNCORE_COMMON_FORMAT(),
6087+
SPR_UNCORE_MMIO_COMMON_FORMAT(),
60846088
.name = "imc",
60856089
.fixed_ctr_bits = 48,
60866090
.fixed_ctr = SNR_IMC_MMIO_PMON_FIXED_CTR,
60876091
.fixed_ctl = SNR_IMC_MMIO_PMON_FIXED_CTL,
6088-
.ops = &spr_uncore_mmio_ops,
60896092
.event_descs = spr_uncore_imc_events,
60906093
};
60916094

@@ -6412,7 +6415,8 @@ static void uncore_type_customized_copy(struct intel_uncore_type *to_type,
64126415

64136416
static struct intel_uncore_type **
64146417
uncore_get_uncores(enum uncore_access_type type_id, int num_extra,
6415-
struct intel_uncore_type **extra)
6418+
struct intel_uncore_type **extra, int max_num_types,
6419+
struct intel_uncore_type **uncores)
64166420
{
64176421
struct intel_uncore_type **types, **start_types;
64186422
int i;
@@ -6421,9 +6425,9 @@ uncore_get_uncores(enum uncore_access_type type_id, int num_extra,
64216425

64226426
/* Only copy the customized features */
64236427
for (; *types; types++) {
6424-
if ((*types)->type_id >= UNCORE_SPR_NUM_UNCORE_TYPES)
6428+
if ((*types)->type_id >= max_num_types)
64256429
continue;
6426-
uncore_type_customized_copy(*types, spr_uncores[(*types)->type_id]);
6430+
uncore_type_customized_copy(*types, uncores[(*types)->type_id]);
64276431
}
64286432

64296433
for (i = 0; i < num_extra; i++, types++)
@@ -6470,7 +6474,9 @@ void spr_uncore_cpu_init(void)
64706474

64716475
uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR,
64726476
UNCORE_SPR_MSR_EXTRA_UNCORES,
6473-
spr_msr_uncores);
6477+
spr_msr_uncores,
6478+
UNCORE_SPR_NUM_UNCORE_TYPES,
6479+
spr_uncores);
64746480

64756481
type = uncore_find_type_by_id(uncore_msr_uncores, UNCORE_SPR_CHA);
64766482
if (type) {
@@ -6552,20 +6558,26 @@ int spr_uncore_pci_init(void)
65526558
spr_update_device_location(UNCORE_SPR_M3UPI);
65536559
uncore_pci_uncores = uncore_get_uncores(UNCORE_ACCESS_PCI,
65546560
UNCORE_SPR_PCI_EXTRA_UNCORES,
6555-
spr_pci_uncores);
6561+
spr_pci_uncores,
6562+
UNCORE_SPR_NUM_UNCORE_TYPES,
6563+
spr_uncores);
65566564
return 0;
65576565
}
65586566

65596567
void spr_uncore_mmio_init(void)
65606568
{
65616569
int ret = snbep_pci2phy_map_init(0x3250, SKX_CPUNODEID, SKX_GIDNIDMAP, true);
65626570

6563-
if (ret)
6564-
uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, 0, NULL);
6565-
else {
6571+
if (ret) {
6572+
uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, 0, NULL,
6573+
UNCORE_SPR_NUM_UNCORE_TYPES,
6574+
spr_uncores);
6575+
} else {
65666576
uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO,
65676577
UNCORE_SPR_MMIO_EXTRA_UNCORES,
6568-
spr_mmio_uncores);
6578+
spr_mmio_uncores,
6579+
UNCORE_SPR_NUM_UNCORE_TYPES,
6580+
spr_uncores);
65696581

65706582
spr_uncore_imc_free_running.num_boxes = uncore_type_max_boxes(uncore_mmio_uncores, UNCORE_SPR_IMC) / 2;
65716583
}

0 commit comments

Comments
 (0)