Skip to content

Commit 632c4bf

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf/x86/intel/uncore: Support Granite Rapids
The same as Sapphire Rapids, Granite Rapids also supports the discovery table feature. All the basic uncore PMON information can be retrieved from the discovery table which resides in the BIOS. There are 4 new units are added on Granite Rapids, b2cmi, b2cxl, ubox, and mdf_sbo. The layout of the counters is exactly the same as the generic uncore counters. Only add a name for the new units. All the details can be retrieved from the discovery table. The description of the new units can be found at https://www.intel.com/content/www/us/en/secure/content-details/772943/content-details.html The other units, e.g., cha, iio, irp, pcu, and imc, are the same as Sapphire Rapids. Ignore the upi and b2upi units in the discovery table, which are broken for now. 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-3-kan.liang@linux.intel.com
1 parent b560e0c commit 632c4bf

3 files changed

Lines changed: 101 additions & 0 deletions

File tree

arch/x86/events/intel/uncore.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,6 +1814,14 @@ static const struct intel_uncore_init_fun spr_uncore_init __initconst = {
18141814
.uncore_units_ignore = spr_uncore_units_ignore,
18151815
};
18161816

1817+
static const struct intel_uncore_init_fun gnr_uncore_init __initconst = {
1818+
.cpu_init = gnr_uncore_cpu_init,
1819+
.pci_init = gnr_uncore_pci_init,
1820+
.mmio_init = gnr_uncore_mmio_init,
1821+
.use_discovery = true,
1822+
.uncore_units_ignore = gnr_uncore_units_ignore,
1823+
};
1824+
18171825
static const struct intel_uncore_init_fun generic_uncore_init __initconst = {
18181826
.cpu_init = intel_uncore_generic_uncore_cpu_init,
18191827
.pci_init = intel_uncore_generic_uncore_pci_init,
@@ -1865,6 +1873,8 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {
18651873
X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, &mtl_uncore_init),
18661874
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &spr_uncore_init),
18671875
X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &spr_uncore_init),
1876+
X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_X, &gnr_uncore_init),
1877+
X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_D, &gnr_uncore_init),
18681878
X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &snr_uncore_init),
18691879
X86_MATCH_INTEL_FAM6_MODEL(ATOM_GRACEMONT, &adl_uncore_init),
18701880
{},

arch/x86/events/intel/uncore.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ extern struct list_head pci2phy_map_head;
593593
extern struct pci_extra_dev *uncore_extra_pci_dev;
594594
extern struct event_constraint uncore_constraint_empty;
595595
extern int spr_uncore_units_ignore[];
596+
extern int gnr_uncore_units_ignore[];
596597

597598
/* uncore_snb.c */
598599
int snb_uncore_pci_init(void);
@@ -634,6 +635,9 @@ void icx_uncore_mmio_init(void);
634635
int spr_uncore_pci_init(void);
635636
void spr_uncore_cpu_init(void);
636637
void spr_uncore_mmio_init(void);
638+
int gnr_uncore_pci_init(void);
639+
void gnr_uncore_cpu_init(void);
640+
void gnr_uncore_mmio_init(void);
637641

638642
/* uncore_nhmex.c */
639643
void nhmex_uncore_cpu_init(void);

arch/x86/events/intel/uncore_snbep.c

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6584,3 +6584,90 @@ void spr_uncore_mmio_init(void)
65846584
}
65856585

65866586
/* end of SPR uncore support */
6587+
6588+
/* GNR uncore support */
6589+
6590+
#define UNCORE_GNR_NUM_UNCORE_TYPES 23
6591+
#define UNCORE_GNR_TYPE_15 15
6592+
#define UNCORE_GNR_B2UPI 18
6593+
#define UNCORE_GNR_TYPE_21 21
6594+
#define UNCORE_GNR_TYPE_22 22
6595+
6596+
int gnr_uncore_units_ignore[] = {
6597+
UNCORE_SPR_UPI,
6598+
UNCORE_GNR_TYPE_15,
6599+
UNCORE_GNR_B2UPI,
6600+
UNCORE_GNR_TYPE_21,
6601+
UNCORE_GNR_TYPE_22,
6602+
UNCORE_IGNORE_END
6603+
};
6604+
6605+
static struct intel_uncore_type gnr_uncore_ubox = {
6606+
.name = "ubox",
6607+
.attr_update = uncore_alias_groups,
6608+
};
6609+
6610+
static struct intel_uncore_type gnr_uncore_b2cmi = {
6611+
SPR_UNCORE_PCI_COMMON_FORMAT(),
6612+
.name = "b2cmi",
6613+
};
6614+
6615+
static struct intel_uncore_type gnr_uncore_b2cxl = {
6616+
SPR_UNCORE_MMIO_COMMON_FORMAT(),
6617+
.name = "b2cxl",
6618+
};
6619+
6620+
static struct intel_uncore_type gnr_uncore_mdf_sbo = {
6621+
.name = "mdf_sbo",
6622+
.attr_update = uncore_alias_groups,
6623+
};
6624+
6625+
static struct intel_uncore_type *gnr_uncores[UNCORE_GNR_NUM_UNCORE_TYPES] = {
6626+
&spr_uncore_chabox,
6627+
&spr_uncore_iio,
6628+
&spr_uncore_irp,
6629+
NULL,
6630+
&spr_uncore_pcu,
6631+
&gnr_uncore_ubox,
6632+
&spr_uncore_imc,
6633+
NULL,
6634+
NULL,
6635+
NULL,
6636+
NULL,
6637+
NULL,
6638+
NULL,
6639+
NULL,
6640+
NULL,
6641+
NULL,
6642+
&gnr_uncore_b2cmi,
6643+
&gnr_uncore_b2cxl,
6644+
NULL,
6645+
NULL,
6646+
&gnr_uncore_mdf_sbo,
6647+
NULL,
6648+
NULL,
6649+
};
6650+
6651+
void gnr_uncore_cpu_init(void)
6652+
{
6653+
uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR, 0, NULL,
6654+
UNCORE_GNR_NUM_UNCORE_TYPES,
6655+
gnr_uncores);
6656+
}
6657+
6658+
int gnr_uncore_pci_init(void)
6659+
{
6660+
uncore_pci_uncores = uncore_get_uncores(UNCORE_ACCESS_PCI, 0, NULL,
6661+
UNCORE_GNR_NUM_UNCORE_TYPES,
6662+
gnr_uncores);
6663+
return 0;
6664+
}
6665+
6666+
void gnr_uncore_mmio_init(void)
6667+
{
6668+
uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, 0, NULL,
6669+
UNCORE_GNR_NUM_UNCORE_TYPES,
6670+
gnr_uncores);
6671+
}
6672+
6673+
/* end of GNR uncore support */

0 commit comments

Comments
 (0)