Skip to content

Commit 64ad6d6

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf/x86/intel/uncore: Add Panther Lake support
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Dapeng Mi <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent fca24bf commit 64ad6d6

File tree

5 files changed

+85
-1
lines changed

5 files changed

+85
-1
lines changed

arch/x86/events/intel/uncore.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,6 +1807,12 @@ static const struct intel_uncore_init_fun lnl_uncore_init __initconst = {
18071807
.mmio_init = lnl_uncore_mmio_init,
18081808
};
18091809

1810+
static const struct intel_uncore_init_fun ptl_uncore_init __initconst = {
1811+
.cpu_init = ptl_uncore_cpu_init,
1812+
.mmio_init = ptl_uncore_mmio_init,
1813+
.use_discovery = true,
1814+
};
1815+
18101816
static const struct intel_uncore_init_fun icx_uncore_init __initconst = {
18111817
.cpu_init = icx_uncore_cpu_init,
18121818
.pci_init = icx_uncore_pci_init,
@@ -1888,6 +1894,7 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {
18881894
X86_MATCH_VFM(INTEL_ARROWLAKE_U, &mtl_uncore_init),
18891895
X86_MATCH_VFM(INTEL_ARROWLAKE_H, &mtl_uncore_init),
18901896
X86_MATCH_VFM(INTEL_LUNARLAKE_M, &lnl_uncore_init),
1897+
X86_MATCH_VFM(INTEL_PANTHERLAKE_L, &ptl_uncore_init),
18911898
X86_MATCH_VFM(INTEL_SAPPHIRERAPIDS_X, &spr_uncore_init),
18921899
X86_MATCH_VFM(INTEL_EMERALDRAPIDS_X, &spr_uncore_init),
18931900
X86_MATCH_VFM(INTEL_GRANITERAPIDS_X, &gnr_uncore_init),

arch/x86/events/intel/uncore.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,12 @@ void tgl_uncore_cpu_init(void);
612612
void adl_uncore_cpu_init(void);
613613
void lnl_uncore_cpu_init(void);
614614
void mtl_uncore_cpu_init(void);
615+
void ptl_uncore_cpu_init(void);
615616
void tgl_uncore_mmio_init(void);
616617
void tgl_l_uncore_mmio_init(void);
617618
void adl_uncore_mmio_init(void);
618619
void lnl_uncore_mmio_init(void);
620+
void ptl_uncore_mmio_init(void);
619621
int snb_pci2phy_map_init(int devid);
620622

621623
/* uncore_snbep.c */

arch/x86/events/intel/uncore_discovery.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,7 @@ bool intel_generic_uncore_assign_hw_event(struct perf_event *event,
171171
struct intel_uncore_box *box);
172172
void uncore_find_add_unit(struct intel_uncore_discovery_unit *node,
173173
struct rb_root *root, u16 *num_units);
174+
struct intel_uncore_type **
175+
uncore_get_uncores(enum uncore_access_type type_id, int num_extra,
176+
struct intel_uncore_type **extra, int max_num_types,
177+
struct intel_uncore_type **uncores);

arch/x86/events/intel/uncore_snb.c

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,3 +1855,74 @@ void lnl_uncore_mmio_init(void)
18551855
}
18561856

18571857
/* end of Lunar Lake MMIO uncore support */
1858+
1859+
/* Panther Lake uncore support */
1860+
1861+
#define UNCORE_PTL_MAX_NUM_UNCORE_TYPES 42
1862+
#define UNCORE_PTL_TYPE_IMC 6
1863+
#define UNCORE_PTL_TYPE_SNCU 34
1864+
#define UNCORE_PTL_TYPE_HBO 41
1865+
1866+
#define PTL_UNCORE_GLOBAL_CTL_OFFSET 0x380
1867+
1868+
static struct intel_uncore_type ptl_uncore_imc = {
1869+
.name = "imc",
1870+
.mmio_map_size = 0xf00,
1871+
};
1872+
1873+
static void ptl_uncore_sncu_init_box(struct intel_uncore_box *box)
1874+
{
1875+
intel_generic_uncore_mmio_init_box(box);
1876+
1877+
/* Clear the global freeze bit */
1878+
if (box->io_addr)
1879+
writel(0, box->io_addr + PTL_UNCORE_GLOBAL_CTL_OFFSET);
1880+
}
1881+
1882+
static struct intel_uncore_ops ptl_uncore_sncu_ops = {
1883+
.init_box = ptl_uncore_sncu_init_box,
1884+
.exit_box = uncore_mmio_exit_box,
1885+
.disable_box = intel_generic_uncore_mmio_disable_box,
1886+
.enable_box = intel_generic_uncore_mmio_enable_box,
1887+
.disable_event = intel_generic_uncore_mmio_disable_event,
1888+
.enable_event = intel_generic_uncore_mmio_enable_event,
1889+
.read_counter = uncore_mmio_read_counter,
1890+
};
1891+
1892+
static struct intel_uncore_type ptl_uncore_sncu = {
1893+
.name = "sncu",
1894+
.ops = &ptl_uncore_sncu_ops,
1895+
.mmio_map_size = 0xf00,
1896+
};
1897+
1898+
static struct intel_uncore_type ptl_uncore_hbo = {
1899+
.name = "hbo",
1900+
.mmio_map_size = 0xf00,
1901+
};
1902+
1903+
static struct intel_uncore_type *ptl_uncores[UNCORE_PTL_MAX_NUM_UNCORE_TYPES] = {
1904+
[UNCORE_PTL_TYPE_IMC] = &ptl_uncore_imc,
1905+
[UNCORE_PTL_TYPE_SNCU] = &ptl_uncore_sncu,
1906+
[UNCORE_PTL_TYPE_HBO] = &ptl_uncore_hbo,
1907+
};
1908+
1909+
void ptl_uncore_mmio_init(void)
1910+
{
1911+
uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO, 0, NULL,
1912+
UNCORE_PTL_MAX_NUM_UNCORE_TYPES,
1913+
ptl_uncores);
1914+
}
1915+
1916+
static struct intel_uncore_type *ptl_msr_uncores[] = {
1917+
&mtl_uncore_cbox,
1918+
NULL
1919+
};
1920+
1921+
void ptl_uncore_cpu_init(void)
1922+
{
1923+
mtl_uncore_cbox.num_boxes = 6;
1924+
mtl_uncore_cbox.ops = &lnl_uncore_msr_ops;
1925+
uncore_msr_uncores = ptl_msr_uncores;
1926+
}
1927+
1928+
/* end of Panther Lake uncore support */

arch/x86/events/intel/uncore_snbep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6413,7 +6413,7 @@ static void uncore_type_customized_copy(struct intel_uncore_type *to_type,
64136413
to_type->mmio_map_size = from_type->mmio_map_size;
64146414
}
64156415

6416-
static struct intel_uncore_type **
6416+
struct intel_uncore_type **
64176417
uncore_get_uncores(enum uncore_access_type type_id, int num_extra,
64186418
struct intel_uncore_type **extra, int max_num_types,
64196419
struct intel_uncore_type **uncores)

0 commit comments

Comments
 (0)