perf/x86/intel/uncore: Support IIO free-running counters on GNR
authorKan Liang <kan.liang@linux.intel.com>
Fri, 17 Nov 2023 16:39:38 +0000 (08:39 -0800)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 24 Nov 2023 19:25:02 +0000 (20:25 +0100)
The free-running counters for IIO uncore blocks on Granite Rapids are
similar to Sapphire Rapids. The key difference is the offset of the
registers. The number of the IIO uncore blocks can also be retrieved
from the discovery table.

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-4-kan.liang@linux.intel.com
arch/x86/events/intel/uncore_snbep.c

index ab31cda797df9a835ca638b8b64d4a0ad7062083..aeaa8efe3c62476c9d4b297fc5eac8266012d0fe 100644 (file)
@@ -6648,11 +6648,21 @@ static struct intel_uncore_type *gnr_uncores[UNCORE_GNR_NUM_UNCORE_TYPES] = {
        NULL,
 };
 
+static struct freerunning_counters gnr_iio_freerunning[] = {
+       [SPR_IIO_MSR_IOCLK]     = { 0x290e, 0x01, 0x10, 1, 48 },
+       [SPR_IIO_MSR_BW_IN]     = { 0x360e, 0x10, 0x80, 8, 48 },
+       [SPR_IIO_MSR_BW_OUT]    = { 0x2e0e, 0x10, 0x80, 8, 48 },
+};
+
 void gnr_uncore_cpu_init(void)
 {
-       uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR, 0, NULL,
+       uncore_msr_uncores = uncore_get_uncores(UNCORE_ACCESS_MSR,
+                                               UNCORE_SPR_MSR_EXTRA_UNCORES,
+                                               spr_msr_uncores,
                                                UNCORE_GNR_NUM_UNCORE_TYPES,
                                                gnr_uncores);
+       spr_uncore_iio_free_running.num_boxes = uncore_type_max_boxes(uncore_msr_uncores, UNCORE_SPR_IIO);
+       spr_uncore_iio_free_running.freerunning = gnr_iio_freerunning;
 }
 
 int gnr_uncore_pci_init(void)