perf/x86/intel/uncore: Support Granite Rapids
authorKan Liang <kan.liang@linux.intel.com>
Fri, 17 Nov 2023 16:39:37 +0000 (08:39 -0800)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 24 Nov 2023 19:25:01 +0000 (20:25 +0100)
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
arch/x86/events/intel/uncore.c
arch/x86/events/intel/uncore.h
arch/x86/events/intel/uncore_snbep.c

index 01023aa5125bbc8ea82e2d3394789796b65e8936..7fb1c54c98796f38d0d0fa08cd54d21b9dec1587 100644 (file)
@@ -1814,6 +1814,14 @@ static const struct intel_uncore_init_fun spr_uncore_init __initconst = {
        .uncore_units_ignore = spr_uncore_units_ignore,
 };
 
+static const struct intel_uncore_init_fun gnr_uncore_init __initconst = {
+       .cpu_init = gnr_uncore_cpu_init,
+       .pci_init = gnr_uncore_pci_init,
+       .mmio_init = gnr_uncore_mmio_init,
+       .use_discovery = true,
+       .uncore_units_ignore = gnr_uncore_units_ignore,
+};
+
 static const struct intel_uncore_init_fun generic_uncore_init __initconst = {
        .cpu_init = intel_uncore_generic_uncore_cpu_init,
        .pci_init = intel_uncore_generic_uncore_pci_init,
@@ -1865,6 +1873,8 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {
        X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L,        &mtl_uncore_init),
        X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X,    &spr_uncore_init),
        X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X,     &spr_uncore_init),
+       X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_X,     &gnr_uncore_init),
+       X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_D,     &gnr_uncore_init),
        X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D,      &snr_uncore_init),
        X86_MATCH_INTEL_FAM6_MODEL(ATOM_GRACEMONT,      &adl_uncore_init),
        {},
index 7428ecaddf72d99b1160dca1a894b20d7fdfdc8b..4838502d89aed34dbedf07211322eb3abb3ff59c 100644 (file)
@@ -593,6 +593,7 @@ extern struct list_head pci2phy_map_head;
 extern struct pci_extra_dev *uncore_extra_pci_dev;
 extern struct event_constraint uncore_constraint_empty;
 extern int spr_uncore_units_ignore[];
+extern int gnr_uncore_units_ignore[];
 
 /* uncore_snb.c */
 int snb_uncore_pci_init(void);
@@ -634,6 +635,9 @@ void icx_uncore_mmio_init(void);
 int spr_uncore_pci_init(void);
 void spr_uncore_cpu_init(void);
 void spr_uncore_mmio_init(void);
+int gnr_uncore_pci_init(void);
+void gnr_uncore_cpu_init(void);
+void gnr_uncore_mmio_init(void);
 
 /* uncore_nhmex.c */
 void nhmex_uncore_cpu_init(void);
index 344319ab6dd52dfc6778a8fda978771b3805c13d..ab31cda797df9a835ca638b8b64d4a0ad7062083 100644 (file)
@@ -6584,3 +6584,90 @@ void spr_uncore_mmio_init(void)
 }
 
 /* end of SPR uncore support */
+
+/* GNR uncore support */
+
+#define UNCORE_GNR_NUM_UNCORE_TYPES    23
+#define UNCORE_GNR_TYPE_15             15
+#define UNCORE_GNR_B2UPI               18
+#define UNCORE_GNR_TYPE_21             21
+#define UNCORE_GNR_TYPE_22             22
+
+int gnr_uncore_units_ignore[] = {
+       UNCORE_SPR_UPI,
+       UNCORE_GNR_TYPE_15,
+       UNCORE_GNR_B2UPI,
+       UNCORE_GNR_TYPE_21,
+       UNCORE_GNR_TYPE_22,
+       UNCORE_IGNORE_END
+};
+
+static struct intel_uncore_type gnr_uncore_ubox = {
+       .name                   = "ubox",
+       .attr_update            = uncore_alias_groups,
+};
+
+static struct intel_uncore_type gnr_uncore_b2cmi = {
+       SPR_UNCORE_PCI_COMMON_FORMAT(),
+       .name                   = "b2cmi",
+};
+
+static struct intel_uncore_type gnr_uncore_b2cxl = {
+       SPR_UNCORE_MMIO_COMMON_FORMAT(),
+       .name                   = "b2cxl",
+};
+
+static struct intel_uncore_type gnr_uncore_mdf_sbo = {
+       .name                   = "mdf_sbo",
+       .attr_update            = uncore_alias_groups,
+};
+
+static struct intel_uncore_type *gnr_uncores[UNCORE_GNR_NUM_UNCORE_TYPES] = {
+       &spr_uncore_chabox,
+       &spr_uncore_iio,
+       &spr_uncore_irp,
+       NULL,
+       &spr_uncore_pcu,
+       &gnr_uncore_ubox,
+       &spr_uncore_imc,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       &gnr_uncore_b2cmi,
+       &gnr_uncore_b2cxl,
+       NULL,
+       NULL,
+       &gnr_uncore_mdf_sbo,
+       NULL,
+       NULL,
+};
+
+void gnr_uncore_cpu_init(void)
+{
+       uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR, 0, NULL,
+                                               UNCORE_GNR_NUM_UNCORE_TYPES,
+                                               gnr_uncores);
+}
+
+int gnr_uncore_pci_init(void)
+{
+       uncore_pci_uncores = uncore_get_uncores(UNCORE_ACCESS_PCI, 0, NULL,
+                                               UNCORE_GNR_NUM_UNCORE_TYPES,
+                                               gnr_uncores);
+       return 0;
+}
+
+void gnr_uncore_mmio_init(void)
+{
+       uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, 0, NULL,
+                                                UNCORE_GNR_NUM_UNCORE_TYPES,
+                                                gnr_uncores);
+}
+
+/* end of GNR uncore support */