]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf/x86/intel/uncore: Add Panther Lake support
authorKan Liang <kan.liang@linux.intel.com>
Mon, 7 Jul 2025 20:17:49 +0000 (13:17 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 9 Jul 2025 11:40:19 +0000 (13:40 +0200)
The Panther Lake supports CBOX, MC, sNCU, and HBO uncore PMON.

The CBOX is similar to Lunar Lake. The only difference is the number of
CBOX.

The other three uncore PMON can be retrieved from the discovery table.
The global control register resides in the sNCU. The global freeze bit
is set by default. It must be cleared before monitoring any uncore
counters.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Link: https://lore.kernel.org/r/20250707201750.616527-4-kan.liang@linux.intel.com
arch/x86/events/intel/uncore.c
arch/x86/events/intel/uncore.h
arch/x86/events/intel/uncore_discovery.h
arch/x86/events/intel/uncore_snb.c
arch/x86/events/intel/uncore_snbep.c

index e0815a12db9000aa13692d1d4058332d7618d410..a762f7f5b16165cff8cb5c538782b90ac9c6f979 100644 (file)
@@ -1807,6 +1807,12 @@ static const struct intel_uncore_init_fun lnl_uncore_init __initconst = {
        .mmio_init = lnl_uncore_mmio_init,
 };
 
+static const struct intel_uncore_init_fun ptl_uncore_init __initconst = {
+       .cpu_init = ptl_uncore_cpu_init,
+       .mmio_init = ptl_uncore_mmio_init,
+       .use_discovery = true,
+};
+
 static const struct intel_uncore_init_fun icx_uncore_init __initconst = {
        .cpu_init = icx_uncore_cpu_init,
        .pci_init = icx_uncore_pci_init,
@@ -1888,6 +1894,7 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {
        X86_MATCH_VFM(INTEL_ARROWLAKE_U,        &mtl_uncore_init),
        X86_MATCH_VFM(INTEL_ARROWLAKE_H,        &mtl_uncore_init),
        X86_MATCH_VFM(INTEL_LUNARLAKE_M,        &lnl_uncore_init),
+       X86_MATCH_VFM(INTEL_PANTHERLAKE_L,      &ptl_uncore_init),
        X86_MATCH_VFM(INTEL_SAPPHIRERAPIDS_X,   &spr_uncore_init),
        X86_MATCH_VFM(INTEL_EMERALDRAPIDS_X,    &spr_uncore_init),
        X86_MATCH_VFM(INTEL_GRANITERAPIDS_X,    &gnr_uncore_init),
index 3dcb88c0ecfa33dec18b4e655bda1eefa34029eb..d8815fff75882b4bc946f31ef11395e934053cc2 100644 (file)
@@ -612,10 +612,12 @@ void tgl_uncore_cpu_init(void);
 void adl_uncore_cpu_init(void);
 void lnl_uncore_cpu_init(void);
 void mtl_uncore_cpu_init(void);
+void ptl_uncore_cpu_init(void);
 void tgl_uncore_mmio_init(void);
 void tgl_l_uncore_mmio_init(void);
 void adl_uncore_mmio_init(void);
 void lnl_uncore_mmio_init(void);
+void ptl_uncore_mmio_init(void);
 int snb_pci2phy_map_init(int devid);
 
 /* uncore_snbep.c */
index 690f737e6837b1aa6701367ddb5d8a7ce08e4c1f..dff75c98e22f4a88329a6db04ce0ee08cceaaa05 100644 (file)
@@ -171,3 +171,7 @@ bool intel_generic_uncore_assign_hw_event(struct perf_event *event,
                                          struct intel_uncore_box *box);
 void uncore_find_add_unit(struct intel_uncore_discovery_unit *node,
                          struct rb_root *root, u16 *num_units);
+struct intel_uncore_type **
+uncore_get_uncores(enum uncore_access_type type_id, int num_extra,
+                  struct intel_uncore_type **extra, int max_num_types,
+                  struct intel_uncore_type **uncores);
index a1a96833e30eb087e71b4249e2b4eb165728459f..2afd4bb7b56486825902dadfa13422cf4c69af0d 100644 (file)
@@ -1855,3 +1855,74 @@ void lnl_uncore_mmio_init(void)
 }
 
 /* end of Lunar Lake MMIO uncore support */
+
+/* Panther Lake uncore support */
+
+#define UNCORE_PTL_MAX_NUM_UNCORE_TYPES                42
+#define UNCORE_PTL_TYPE_IMC                    6
+#define UNCORE_PTL_TYPE_SNCU                   34
+#define UNCORE_PTL_TYPE_HBO                    41
+
+#define PTL_UNCORE_GLOBAL_CTL_OFFSET           0x380
+
+static struct intel_uncore_type ptl_uncore_imc = {
+       .name                   = "imc",
+       .mmio_map_size          = 0xf00,
+};
+
+static void ptl_uncore_sncu_init_box(struct intel_uncore_box *box)
+{
+       intel_generic_uncore_mmio_init_box(box);
+
+       /* Clear the global freeze bit */
+       if (box->io_addr)
+               writel(0, box->io_addr + PTL_UNCORE_GLOBAL_CTL_OFFSET);
+}
+
+static struct intel_uncore_ops ptl_uncore_sncu_ops = {
+       .init_box               = ptl_uncore_sncu_init_box,
+       .exit_box               = uncore_mmio_exit_box,
+       .disable_box            = intel_generic_uncore_mmio_disable_box,
+       .enable_box             = intel_generic_uncore_mmio_enable_box,
+       .disable_event          = intel_generic_uncore_mmio_disable_event,
+       .enable_event           = intel_generic_uncore_mmio_enable_event,
+       .read_counter           = uncore_mmio_read_counter,
+};
+
+static struct intel_uncore_type ptl_uncore_sncu = {
+       .name                   = "sncu",
+       .ops                    = &ptl_uncore_sncu_ops,
+       .mmio_map_size          = 0xf00,
+};
+
+static struct intel_uncore_type ptl_uncore_hbo = {
+       .name                   = "hbo",
+       .mmio_map_size          = 0xf00,
+};
+
+static struct intel_uncore_type *ptl_uncores[UNCORE_PTL_MAX_NUM_UNCORE_TYPES] = {
+       [UNCORE_PTL_TYPE_IMC] = &ptl_uncore_imc,
+       [UNCORE_PTL_TYPE_SNCU] = &ptl_uncore_sncu,
+       [UNCORE_PTL_TYPE_HBO] = &ptl_uncore_hbo,
+};
+
+void ptl_uncore_mmio_init(void)
+{
+       uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, 0, NULL,
+                                                UNCORE_PTL_MAX_NUM_UNCORE_TYPES,
+                                                ptl_uncores);
+}
+
+static struct intel_uncore_type *ptl_msr_uncores[] = {
+       &mtl_uncore_cbox,
+       NULL
+};
+
+void ptl_uncore_cpu_init(void)
+{
+       mtl_uncore_cbox.num_boxes = 6;
+       mtl_uncore_cbox.ops = &lnl_uncore_msr_ops;
+       uncore_msr_uncores = ptl_msr_uncores;
+}
+
+/* end of Panther Lake uncore support */
index 3a6543159fabfc38680b2306feb7cb1f10ae7d83..e1f370b8d065f9ffffd27a8fc0b5200a8fe68c83 100644 (file)
@@ -6413,7 +6413,7 @@ static void uncore_type_customized_copy(struct intel_uncore_type *to_type,
                to_type->mmio_map_size = from_type->mmio_map_size;
 }
 
-static struct intel_uncore_type **
+struct intel_uncore_type **
 uncore_get_uncores(enum uncore_access_type type_id, int num_extra,
                   struct intel_uncore_type **extra, int max_num_types,
                   struct intel_uncore_type **uncores)