@@ -219,6 +219,17 @@ static struct event_constraint intel_grt_event_constraints[] __read_mostly = {
219219 EVENT_CONSTRAINT_END
220220};
221221
222+ static struct event_constraint intel_skt_event_constraints [] __read_mostly = {
223+ FIXED_EVENT_CONSTRAINT (0x00c0 , 0 ), /* INST_RETIRED.ANY */
224+ FIXED_EVENT_CONSTRAINT (0x003c , 1 ), /* CPU_CLK_UNHALTED.CORE */
225+ FIXED_EVENT_CONSTRAINT (0x0300 , 2 ), /* pseudo CPU_CLK_UNHALTED.REF */
226+ FIXED_EVENT_CONSTRAINT (0x013c , 2 ), /* CPU_CLK_UNHALTED.REF_TSC_P */
227+ FIXED_EVENT_CONSTRAINT (0x0073 , 4 ), /* TOPDOWN_BAD_SPECULATION.ALL */
228+ FIXED_EVENT_CONSTRAINT (0x019c , 5 ), /* TOPDOWN_FE_BOUND.ALL */
229+ FIXED_EVENT_CONSTRAINT (0x02c2 , 6 ), /* TOPDOWN_RETIRING.ALL */
230+ EVENT_CONSTRAINT_END
231+ };
232+
222233static struct event_constraint intel_skl_event_constraints [] = {
223234 FIXED_EVENT_CONSTRAINT (0x00c0 , 0 ), /* INST_RETIRED.ANY */
224235 FIXED_EVENT_CONSTRAINT (0x003c , 1 ), /* CPU_CLK_UNHALTED.CORE */
@@ -369,6 +380,55 @@ static struct extra_reg intel_rwc_extra_regs[] __read_mostly = {
369380 EVENT_EXTRA_END
370381};
371382
383+ static struct event_constraint intel_lnc_event_constraints [] = {
384+ FIXED_EVENT_CONSTRAINT (0x00c0 , 0 ), /* INST_RETIRED.ANY */
385+ FIXED_EVENT_CONSTRAINT (0x0100 , 0 ), /* INST_RETIRED.PREC_DIST */
386+ FIXED_EVENT_CONSTRAINT (0x003c , 1 ), /* CPU_CLK_UNHALTED.CORE */
387+ FIXED_EVENT_CONSTRAINT (0x0300 , 2 ), /* CPU_CLK_UNHALTED.REF */
388+ FIXED_EVENT_CONSTRAINT (0x013c , 2 ), /* CPU_CLK_UNHALTED.REF_TSC_P */
389+ FIXED_EVENT_CONSTRAINT (0x0400 , 3 ), /* SLOTS */
390+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING , 0 ),
391+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC , 1 ),
392+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND , 2 ),
393+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BE_BOUND , 3 ),
394+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_HEAVY_OPS , 4 ),
395+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BR_MISPREDICT , 5 ),
396+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FETCH_LAT , 6 ),
397+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_MEM_BOUND , 7 ),
398+
399+ INTEL_UEVENT_CONSTRAINT (0x0148 , 0x4 ),
400+ INTEL_UEVENT_CONSTRAINT (0x0175 , 0x4 ),
401+
402+ INTEL_EVENT_CONSTRAINT (0x2e , 0x3ff ),
403+ INTEL_EVENT_CONSTRAINT (0x3c , 0x3ff ),
404+ /*
405+ * Generally event codes < 0x90 are restricted to counters 0-3.
406+ * The 0x2E and 0x3C are exception, which has no restriction.
407+ */
408+ INTEL_EVENT_CONSTRAINT_RANGE (0x01 , 0x8f , 0xf ),
409+
410+ INTEL_UEVENT_CONSTRAINT (0x01a3 , 0xf ),
411+ INTEL_UEVENT_CONSTRAINT (0x02a3 , 0xf ),
412+ INTEL_UEVENT_CONSTRAINT (0x08a3 , 0x4 ),
413+ INTEL_UEVENT_CONSTRAINT (0x0ca3 , 0x4 ),
414+ INTEL_UEVENT_CONSTRAINT (0x04a4 , 0x1 ),
415+ INTEL_UEVENT_CONSTRAINT (0x08a4 , 0x1 ),
416+ INTEL_UEVENT_CONSTRAINT (0x10a4 , 0x1 ),
417+ INTEL_UEVENT_CONSTRAINT (0x01b1 , 0x8 ),
418+ INTEL_UEVENT_CONSTRAINT (0x02cd , 0x3 ),
419+ INTEL_EVENT_CONSTRAINT (0xce , 0x1 ),
420+
421+ INTEL_EVENT_CONSTRAINT_RANGE (0xd0 , 0xdf , 0xf ),
422+ /*
423+ * Generally event codes >= 0x90 are likely to have no restrictions.
424+ * The exception are defined as above.
425+ */
426+ INTEL_EVENT_CONSTRAINT_RANGE (0x90 , 0xfe , 0x3ff ),
427+
428+ EVENT_CONSTRAINT_END
429+ };
430+
431+
372432EVENT_ATTR_STR (mem - loads , mem_ld_nhm , "event=0x0b,umask=0x10,ldlat=3" );
373433EVENT_ATTR_STR (mem - loads , mem_ld_snb , "event=0xcd,umask=0x1,ldlat=3" );
374434EVENT_ATTR_STR (mem - stores , mem_st_snb , "event=0xcd,umask=0x2" );
@@ -5796,6 +5856,23 @@ static struct attribute *adl_hybrid_events_attrs[] = {
57965856 NULL ,
57975857};
57985858
5859+ EVENT_ATTR_STR_HYBRID (topdown - retiring , td_retiring_lnl , "event=0xc2,umask=0x02;event=0x00,umask=0x80" , hybrid_big_small );
5860+ EVENT_ATTR_STR_HYBRID (topdown - fe - bound , td_fe_bound_lnl , "event=0x9c,umask=0x01;event=0x00,umask=0x82" , hybrid_big_small );
5861+ EVENT_ATTR_STR_HYBRID (topdown - be - bound , td_be_bound_lnl , "event=0xa4,umask=0x02;event=0x00,umask=0x83" , hybrid_big_small );
5862+
5863+ static struct attribute * lnl_hybrid_events_attrs [] = {
5864+ EVENT_PTR (slots_adl ),
5865+ EVENT_PTR (td_retiring_lnl ),
5866+ EVENT_PTR (td_bad_spec_adl ),
5867+ EVENT_PTR (td_fe_bound_lnl ),
5868+ EVENT_PTR (td_be_bound_lnl ),
5869+ EVENT_PTR (td_heavy_ops_adl ),
5870+ EVENT_PTR (td_br_mis_adl ),
5871+ EVENT_PTR (td_fetch_lat_adl ),
5872+ EVENT_PTR (td_mem_bound_adl ),
5873+ NULL
5874+ };
5875+
57995876/* Must be in IDX order */
58005877EVENT_ATTR_STR_HYBRID (mem - loads , mem_ld_adl , "event=0xd0,umask=0x5,ldlat=3;event=0xcd,umask=0x1,ldlat=3" , hybrid_big_small );
58015878EVENT_ATTR_STR_HYBRID (mem - stores , mem_st_adl , "event=0xd0,umask=0x6;event=0xcd,umask=0x2" , hybrid_big_small );
@@ -6145,6 +6222,21 @@ static __always_inline void intel_pmu_init_grt(struct pmu *pmu)
61456222 intel_pmu_ref_cycles_ext ();
61466223}
61476224
6225+ static __always_inline void intel_pmu_init_lnc (struct pmu * pmu )
6226+ {
6227+ intel_pmu_init_glc (pmu );
6228+ hybrid (pmu , event_constraints ) = intel_lnc_event_constraints ;
6229+ hybrid (pmu , pebs_constraints ) = intel_lnc_pebs_event_constraints ;
6230+ hybrid (pmu , extra_regs ) = intel_rwc_extra_regs ;
6231+ }
6232+
6233+ static __always_inline void intel_pmu_init_skt (struct pmu * pmu )
6234+ {
6235+ intel_pmu_init_grt (pmu );
6236+ hybrid (pmu , event_constraints ) = intel_skt_event_constraints ;
6237+ hybrid (pmu , extra_regs ) = intel_cmt_extra_regs ;
6238+ }
6239+
61486240__init int intel_pmu_init (void )
61496241{
61506242 struct attribute * * extra_skl_attr = & empty_attrs ;
@@ -6870,6 +6962,31 @@ __init int intel_pmu_init(void)
68706962 name = "meteorlake_hybrid" ;
68716963 break ;
68726964
6965+ case INTEL_LUNARLAKE_M :
6966+ case INTEL_ARROWLAKE :
6967+ intel_pmu_init_hybrid (hybrid_big_small );
6968+
6969+ x86_pmu .get_event_constraints = mtl_get_event_constraints ;
6970+ x86_pmu .hw_config = adl_hw_config ;
6971+
6972+ td_attr = lnl_hybrid_events_attrs ;
6973+ mem_attr = mtl_hybrid_mem_attrs ;
6974+ tsx_attr = adl_hybrid_tsx_attrs ;
6975+ extra_attr = boot_cpu_has (X86_FEATURE_RTM ) ?
6976+ mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr ;
6977+
6978+ /* Initialize big core specific PerfMon capabilities.*/
6979+ pmu = & x86_pmu .hybrid_pmu [X86_HYBRID_PMU_CORE_IDX ];
6980+ intel_pmu_init_lnc (& pmu -> pmu );
6981+
6982+ /* Initialize Atom core specific PerfMon capabilities.*/
6983+ pmu = & x86_pmu .hybrid_pmu [X86_HYBRID_PMU_ATOM_IDX ];
6984+ intel_pmu_init_skt (& pmu -> pmu );
6985+
6986+ pr_cont ("Lunarlake Hybrid events, " );
6987+ name = "lunarlake_hybrid" ;
6988+ break ;
6989+
68736990 default :
68746991 switch (x86_pmu .version ) {
68756992 case 1 :
0 commit comments