Skip to content

Commit c828441

Browse files
Kan LiangIngo Molnar
authored andcommitted
perf/x86/intel/uncore: Add Meteor Lake support
The uncore subsystem for Meteor Lake is similar to the previous Alder Lake. The main difference is that MTL provides PMU support for different tiles, while ADL only provides PMU support for the whole package. On ADL, there are CBOX, ARB, and clockbox uncore PMON units. On MTL, they are split into CBOX/HAC_CBOX, ARB/HAC_ARB, and cncu/sncu which provides a fixed counter for clockticks. Also, new MSR addresses are introduced on MTL. The IMC uncore PMON is the same as Alder Lake. Add new PCIIDs of IMC for Meteor Lake. Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent fd636b6 commit c828441

File tree

3 files changed

+169
-0
lines changed

3 files changed

+169
-0
lines changed

arch/x86/events/intel/uncore.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,6 +1789,11 @@ static const struct intel_uncore_init_fun adl_uncore_init __initconst = {
17891789
.mmio_init = adl_uncore_mmio_init,
17901790
};
17911791

1792+
static const struct intel_uncore_init_fun mtl_uncore_init __initconst = {
1793+
.cpu_init = mtl_uncore_cpu_init,
1794+
.mmio_init = adl_uncore_mmio_init,
1795+
};
1796+
17921797
static const struct intel_uncore_init_fun icx_uncore_init __initconst = {
17931798
.cpu_init = icx_uncore_cpu_init,
17941799
.pci_init = icx_uncore_pci_init,
@@ -1857,6 +1862,8 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {
18571862
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, &adl_uncore_init),
18581863
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &adl_uncore_init),
18591864
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, &adl_uncore_init),
1865+
X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE, &mtl_uncore_init),
1866+
X86_MATCH_INTEL_FAM6_MODEL(METEORLAKE_L, &mtl_uncore_init),
18601867
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &spr_uncore_init),
18611868
X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &spr_uncore_init),
18621869
X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &snr_uncore_init),

arch/x86/events/intel/uncore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ void skl_uncore_cpu_init(void);
606606
void icl_uncore_cpu_init(void);
607607
void tgl_uncore_cpu_init(void);
608608
void adl_uncore_cpu_init(void);
609+
void mtl_uncore_cpu_init(void);
609610
void tgl_uncore_mmio_init(void);
610611
void tgl_l_uncore_mmio_init(void);
611612
void adl_uncore_mmio_init(void);

arch/x86/events/intel/uncore_snb.c

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,19 @@
109109
#define PCI_DEVICE_ID_INTEL_RPL_23_IMC 0xA728
110110
#define PCI_DEVICE_ID_INTEL_RPL_24_IMC 0xA729
111111
#define PCI_DEVICE_ID_INTEL_RPL_25_IMC 0xA72A
112+
#define PCI_DEVICE_ID_INTEL_MTL_1_IMC 0x7d00
113+
#define PCI_DEVICE_ID_INTEL_MTL_2_IMC 0x7d01
114+
#define PCI_DEVICE_ID_INTEL_MTL_3_IMC 0x7d02
115+
#define PCI_DEVICE_ID_INTEL_MTL_4_IMC 0x7d05
116+
#define PCI_DEVICE_ID_INTEL_MTL_5_IMC 0x7d10
117+
#define PCI_DEVICE_ID_INTEL_MTL_6_IMC 0x7d14
118+
#define PCI_DEVICE_ID_INTEL_MTL_7_IMC 0x7d15
119+
#define PCI_DEVICE_ID_INTEL_MTL_8_IMC 0x7d16
120+
#define PCI_DEVICE_ID_INTEL_MTL_9_IMC 0x7d21
121+
#define PCI_DEVICE_ID_INTEL_MTL_10_IMC 0x7d22
122+
#define PCI_DEVICE_ID_INTEL_MTL_11_IMC 0x7d23
123+
#define PCI_DEVICE_ID_INTEL_MTL_12_IMC 0x7d24
124+
#define PCI_DEVICE_ID_INTEL_MTL_13_IMC 0x7d28
112125

113126

114127
#define IMC_UNCORE_DEV(a) \
@@ -205,6 +218,32 @@
205218
#define ADL_UNC_ARB_PERFEVTSEL0 0x2FD0
206219
#define ADL_UNC_ARB_MSR_OFFSET 0x8
207220

221+
/* MTL Cbo register */
222+
#define MTL_UNC_CBO_0_PER_CTR0 0x2448
223+
#define MTL_UNC_CBO_0_PERFEVTSEL0 0x2442
224+
225+
/* MTL HAC_ARB register */
226+
#define MTL_UNC_HAC_ARB_CTR 0x2018
227+
#define MTL_UNC_HAC_ARB_CTRL 0x2012
228+
229+
/* MTL ARB register */
230+
#define MTL_UNC_ARB_CTR 0x2418
231+
#define MTL_UNC_ARB_CTRL 0x2412
232+
233+
/* MTL cNCU register */
234+
#define MTL_UNC_CNCU_FIXED_CTR 0x2408
235+
#define MTL_UNC_CNCU_FIXED_CTRL 0x2402
236+
#define MTL_UNC_CNCU_BOX_CTL 0x240e
237+
238+
/* MTL sNCU register */
239+
#define MTL_UNC_SNCU_FIXED_CTR 0x2008
240+
#define MTL_UNC_SNCU_FIXED_CTRL 0x2002
241+
#define MTL_UNC_SNCU_BOX_CTL 0x200e
242+
243+
/* MTL HAC_CBO register */
244+
#define MTL_UNC_HBO_CTR 0x2048
245+
#define MTL_UNC_HBO_CTRL 0x2042
246+
208247
DEFINE_UNCORE_FORMAT_ATTR(event, event, "config:0-7");
209248
DEFINE_UNCORE_FORMAT_ATTR(umask, umask, "config:8-15");
210249
DEFINE_UNCORE_FORMAT_ATTR(chmask, chmask, "config:8-11");
@@ -598,6 +637,115 @@ void adl_uncore_cpu_init(void)
598637
uncore_msr_uncores = adl_msr_uncores;
599638
}
600639

640+
static struct intel_uncore_type mtl_uncore_cbox = {
641+
.name = "cbox",
642+
.num_counters = 2,
643+
.perf_ctr_bits = 48,
644+
.perf_ctr = MTL_UNC_CBO_0_PER_CTR0,
645+
.event_ctl = MTL_UNC_CBO_0_PERFEVTSEL0,
646+
.event_mask = ADL_UNC_RAW_EVENT_MASK,
647+
.msr_offset = SNB_UNC_CBO_MSR_OFFSET,
648+
.ops = &icl_uncore_msr_ops,
649+
.format_group = &adl_uncore_format_group,
650+
};
651+
652+
static struct intel_uncore_type mtl_uncore_hac_arb = {
653+
.name = "hac_arb",
654+
.num_counters = 2,
655+
.num_boxes = 2,
656+
.perf_ctr_bits = 48,
657+
.perf_ctr = MTL_UNC_HAC_ARB_CTR,
658+
.event_ctl = MTL_UNC_HAC_ARB_CTRL,
659+
.event_mask = ADL_UNC_RAW_EVENT_MASK,
660+
.msr_offset = SNB_UNC_CBO_MSR_OFFSET,
661+
.ops = &icl_uncore_msr_ops,
662+
.format_group = &adl_uncore_format_group,
663+
};
664+
665+
static struct intel_uncore_type mtl_uncore_arb = {
666+
.name = "arb",
667+
.num_counters = 2,
668+
.num_boxes = 2,
669+
.perf_ctr_bits = 48,
670+
.perf_ctr = MTL_UNC_ARB_CTR,
671+
.event_ctl = MTL_UNC_ARB_CTRL,
672+
.event_mask = ADL_UNC_RAW_EVENT_MASK,
673+
.msr_offset = SNB_UNC_CBO_MSR_OFFSET,
674+
.ops = &icl_uncore_msr_ops,
675+
.format_group = &adl_uncore_format_group,
676+
};
677+
678+
static struct intel_uncore_type mtl_uncore_hac_cbox = {
679+
.name = "hac_cbox",
680+
.num_counters = 2,
681+
.num_boxes = 2,
682+
.perf_ctr_bits = 48,
683+
.perf_ctr = MTL_UNC_HBO_CTR,
684+
.event_ctl = MTL_UNC_HBO_CTRL,
685+
.event_mask = ADL_UNC_RAW_EVENT_MASK,
686+
.msr_offset = SNB_UNC_CBO_MSR_OFFSET,
687+
.ops = &icl_uncore_msr_ops,
688+
.format_group = &adl_uncore_format_group,
689+
};
690+
691+
static void mtl_uncore_msr_init_box(struct intel_uncore_box *box)
692+
{
693+
wrmsrl(uncore_msr_box_ctl(box), SNB_UNC_GLOBAL_CTL_EN);
694+
}
695+
696+
static struct intel_uncore_ops mtl_uncore_msr_ops = {
697+
.init_box = mtl_uncore_msr_init_box,
698+
.disable_event = snb_uncore_msr_disable_event,
699+
.enable_event = snb_uncore_msr_enable_event,
700+
.read_counter = uncore_msr_read_counter,
701+
};
702+
703+
static struct intel_uncore_type mtl_uncore_cncu = {
704+
.name = "cncu",
705+
.num_counters = 1,
706+
.num_boxes = 1,
707+
.box_ctl = MTL_UNC_CNCU_BOX_CTL,
708+
.fixed_ctr_bits = 48,
709+
.fixed_ctr = MTL_UNC_CNCU_FIXED_CTR,
710+
.fixed_ctl = MTL_UNC_CNCU_FIXED_CTRL,
711+
.single_fixed = 1,
712+
.event_mask = SNB_UNC_CTL_EV_SEL_MASK,
713+
.format_group = &icl_uncore_clock_format_group,
714+
.ops = &mtl_uncore_msr_ops,
715+
.event_descs = icl_uncore_events,
716+
};
717+
718+
static struct intel_uncore_type mtl_uncore_sncu = {
719+
.name = "sncu",
720+
.num_counters = 1,
721+
.num_boxes = 1,
722+
.box_ctl = MTL_UNC_SNCU_BOX_CTL,
723+
.fixed_ctr_bits = 48,
724+
.fixed_ctr = MTL_UNC_SNCU_FIXED_CTR,
725+
.fixed_ctl = MTL_UNC_SNCU_FIXED_CTRL,
726+
.single_fixed = 1,
727+
.event_mask = SNB_UNC_CTL_EV_SEL_MASK,
728+
.format_group = &icl_uncore_clock_format_group,
729+
.ops = &mtl_uncore_msr_ops,
730+
.event_descs = icl_uncore_events,
731+
};
732+
733+
static struct intel_uncore_type *mtl_msr_uncores[] = {
734+
&mtl_uncore_cbox,
735+
&mtl_uncore_hac_arb,
736+
&mtl_uncore_arb,
737+
&mtl_uncore_hac_cbox,
738+
&mtl_uncore_cncu,
739+
&mtl_uncore_sncu,
740+
NULL
741+
};
742+
743+
void mtl_uncore_cpu_init(void)
744+
{
745+
mtl_uncore_cbox.num_boxes = icl_get_cbox_num();
746+
uncore_msr_uncores = mtl_msr_uncores;
747+
}
748+
601749
enum {
602750
SNB_PCI_UNCORE_IMC,
603751
};
@@ -1264,6 +1412,19 @@ static const struct pci_device_id tgl_uncore_pci_ids[] = {
12641412
IMC_UNCORE_DEV(RPL_23),
12651413
IMC_UNCORE_DEV(RPL_24),
12661414
IMC_UNCORE_DEV(RPL_25),
1415+
IMC_UNCORE_DEV(MTL_1),
1416+
IMC_UNCORE_DEV(MTL_2),
1417+
IMC_UNCORE_DEV(MTL_3),
1418+
IMC_UNCORE_DEV(MTL_4),
1419+
IMC_UNCORE_DEV(MTL_5),
1420+
IMC_UNCORE_DEV(MTL_6),
1421+
IMC_UNCORE_DEV(MTL_7),
1422+
IMC_UNCORE_DEV(MTL_8),
1423+
IMC_UNCORE_DEV(MTL_9),
1424+
IMC_UNCORE_DEV(MTL_10),
1425+
IMC_UNCORE_DEV(MTL_11),
1426+
IMC_UNCORE_DEV(MTL_12),
1427+
IMC_UNCORE_DEV(MTL_13),
12671428
{ /* end: all zeroes */ }
12681429
};
12691430

0 commit comments

Comments
 (0)