@@ -220,6 +220,17 @@ static struct event_constraint intel_grt_event_constraints[] __read_mostly = {
220220 EVENT_CONSTRAINT_END
221221};
222222
223+ static struct event_constraint intel_skt_event_constraints [] __read_mostly = {
224+ FIXED_EVENT_CONSTRAINT (0x00c0 , 0 ), /* INST_RETIRED.ANY */
225+ FIXED_EVENT_CONSTRAINT (0x003c , 1 ), /* CPU_CLK_UNHALTED.CORE */
226+ FIXED_EVENT_CONSTRAINT (0x0300 , 2 ), /* pseudo CPU_CLK_UNHALTED.REF */
227+ FIXED_EVENT_CONSTRAINT (0x013c , 2 ), /* CPU_CLK_UNHALTED.REF_TSC_P */
228+ FIXED_EVENT_CONSTRAINT (0x0073 , 4 ), /* TOPDOWN_BAD_SPECULATION.ALL */
229+ FIXED_EVENT_CONSTRAINT (0x019c , 5 ), /* TOPDOWN_FE_BOUND.ALL */
230+ FIXED_EVENT_CONSTRAINT (0x02c2 , 6 ), /* TOPDOWN_RETIRING.ALL */
231+ EVENT_CONSTRAINT_END
232+ };
233+
223234static struct event_constraint intel_skl_event_constraints [] = {
224235 FIXED_EVENT_CONSTRAINT (0x00c0 , 0 ), /* INST_RETIRED.ANY */
225236 FIXED_EVENT_CONSTRAINT (0x003c , 1 ), /* CPU_CLK_UNHALTED.CORE */
@@ -370,6 +381,55 @@ static struct extra_reg intel_rwc_extra_regs[] __read_mostly = {
370381 EVENT_EXTRA_END
371382};
372383
384+ static struct event_constraint intel_lnc_event_constraints [] = {
385+ FIXED_EVENT_CONSTRAINT (0x00c0 , 0 ), /* INST_RETIRED.ANY */
386+ FIXED_EVENT_CONSTRAINT (0x0100 , 0 ), /* INST_RETIRED.PREC_DIST */
387+ FIXED_EVENT_CONSTRAINT (0x003c , 1 ), /* CPU_CLK_UNHALTED.CORE */
388+ FIXED_EVENT_CONSTRAINT (0x0300 , 2 ), /* CPU_CLK_UNHALTED.REF */
389+ FIXED_EVENT_CONSTRAINT (0x013c , 2 ), /* CPU_CLK_UNHALTED.REF_TSC_P */
390+ FIXED_EVENT_CONSTRAINT (0x0400 , 3 ), /* SLOTS */
391+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING , 0 ),
392+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC , 1 ),
393+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND , 2 ),
394+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BE_BOUND , 3 ),
395+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_HEAVY_OPS , 4 ),
396+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BR_MISPREDICT , 5 ),
397+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FETCH_LAT , 6 ),
398+ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_MEM_BOUND , 7 ),
399+
400+ INTEL_UEVENT_CONSTRAINT (0x0148 , 0x4 ),
401+ INTEL_UEVENT_CONSTRAINT (0x0175 , 0x4 ),
402+
403+ INTEL_EVENT_CONSTRAINT (0x2e , 0x3ff ),
404+ INTEL_EVENT_CONSTRAINT (0x3c , 0x3ff ),
405+ /*
406+ * Generally event codes < 0x90 are restricted to counters 0-3.
407+ * The 0x2E and 0x3C are exception, which has no restriction.
408+ */
409+ INTEL_EVENT_CONSTRAINT_RANGE (0x01 , 0x8f , 0xf ),
410+
411+ INTEL_UEVENT_CONSTRAINT (0x01a3 , 0xf ),
412+ INTEL_UEVENT_CONSTRAINT (0x02a3 , 0xf ),
413+ INTEL_UEVENT_CONSTRAINT (0x08a3 , 0x4 ),
414+ INTEL_UEVENT_CONSTRAINT (0x0ca3 , 0x4 ),
415+ INTEL_UEVENT_CONSTRAINT (0x04a4 , 0x1 ),
416+ INTEL_UEVENT_CONSTRAINT (0x08a4 , 0x1 ),
417+ INTEL_UEVENT_CONSTRAINT (0x10a4 , 0x1 ),
418+ INTEL_UEVENT_CONSTRAINT (0x01b1 , 0x8 ),
419+ INTEL_UEVENT_CONSTRAINT (0x02cd , 0x3 ),
420+ INTEL_EVENT_CONSTRAINT (0xce , 0x1 ),
421+
422+ INTEL_EVENT_CONSTRAINT_RANGE (0xd0 , 0xdf , 0xf ),
423+ /*
424+ * Generally event codes >= 0x90 are likely to have no restrictions.
425+ * The exception are defined as above.
426+ */
427+ INTEL_EVENT_CONSTRAINT_RANGE (0x90 , 0xfe , 0x3ff ),
428+
429+ EVENT_CONSTRAINT_END
430+ };
431+
432+
373433EVENT_ATTR_STR (mem - loads , mem_ld_nhm , "event=0x0b,umask=0x10,ldlat=3" );
374434EVENT_ATTR_STR (mem - loads , mem_ld_snb , "event=0xcd,umask=0x1,ldlat=3" );
375435EVENT_ATTR_STR (mem - stores , mem_st_snb , "event=0xcd,umask=0x2" );
@@ -5790,6 +5850,23 @@ static struct attribute *adl_hybrid_events_attrs[] = {
57905850 NULL ,
57915851};
57925852
5853+ EVENT_ATTR_STR_HYBRID (topdown - retiring , td_retiring_lnl , "event=0xc2,umask=0x02;event=0x00,umask=0x80" , hybrid_big_small );
5854+ EVENT_ATTR_STR_HYBRID (topdown - fe - bound , td_fe_bound_lnl , "event=0x9c,umask=0x01;event=0x00,umask=0x82" , hybrid_big_small );
5855+ EVENT_ATTR_STR_HYBRID (topdown - be - bound , td_be_bound_lnl , "event=0xa4,umask=0x02;event=0x00,umask=0x83" , hybrid_big_small );
5856+
5857+ static struct attribute * lnl_hybrid_events_attrs [] = {
5858+ EVENT_PTR (slots_adl ),
5859+ EVENT_PTR (td_retiring_lnl ),
5860+ EVENT_PTR (td_bad_spec_adl ),
5861+ EVENT_PTR (td_fe_bound_lnl ),
5862+ EVENT_PTR (td_be_bound_lnl ),
5863+ EVENT_PTR (td_heavy_ops_adl ),
5864+ EVENT_PTR (td_br_mis_adl ),
5865+ EVENT_PTR (td_fetch_lat_adl ),
5866+ EVENT_PTR (td_mem_bound_adl ),
5867+ NULL
5868+ };
5869+
57935870/* Must be in IDX order */
57945871EVENT_ATTR_STR_HYBRID (mem - loads , mem_ld_adl , "event=0xd0,umask=0x5,ldlat=3;event=0xcd,umask=0x1,ldlat=3" , hybrid_big_small );
57955872EVENT_ATTR_STR_HYBRID (mem - stores , mem_st_adl , "event=0xd0,umask=0x6;event=0xcd,umask=0x2" , hybrid_big_small );
@@ -6139,6 +6216,21 @@ static __always_inline void intel_pmu_init_grt(struct pmu *pmu)
61396216 intel_pmu_ref_cycles_ext ();
61406217}
61416218
6219+ static __always_inline void intel_pmu_init_lnc (struct pmu * pmu )
6220+ {
6221+ intel_pmu_init_glc (pmu );
6222+ hybrid (pmu , event_constraints ) = intel_lnc_event_constraints ;
6223+ hybrid (pmu , pebs_constraints ) = intel_lnc_pebs_event_constraints ;
6224+ hybrid (pmu , extra_regs ) = intel_rwc_extra_regs ;
6225+ }
6226+
6227+ static __always_inline void intel_pmu_init_skt (struct pmu * pmu )
6228+ {
6229+ intel_pmu_init_grt (pmu );
6230+ hybrid (pmu , event_constraints ) = intel_skt_event_constraints ;
6231+ hybrid (pmu , extra_regs ) = intel_cmt_extra_regs ;
6232+ }
6233+
61426234__init int intel_pmu_init (void )
61436235{
61446236 struct attribute * * extra_skl_attr = & empty_attrs ;
@@ -6864,6 +6956,31 @@ __init int intel_pmu_init(void)
68646956 name = "meteorlake_hybrid" ;
68656957 break ;
68666958
6959+ case INTEL_LUNARLAKE_M :
6960+ case INTEL_ARROWLAKE :
6961+ intel_pmu_init_hybrid (hybrid_big_small );
6962+
6963+ x86_pmu .get_event_constraints = mtl_get_event_constraints ;
6964+ x86_pmu .hw_config = adl_hw_config ;
6965+
6966+ td_attr = lnl_hybrid_events_attrs ;
6967+ mem_attr = mtl_hybrid_mem_attrs ;
6968+ tsx_attr = adl_hybrid_tsx_attrs ;
6969+ extra_attr = boot_cpu_has (X86_FEATURE_RTM ) ?
6970+ mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr ;
6971+
6972+ /* Initialize big core specific PerfMon capabilities.*/
6973+ pmu = & x86_pmu .hybrid_pmu [X86_HYBRID_PMU_CORE_IDX ];
6974+ intel_pmu_init_lnc (& pmu -> pmu );
6975+
6976+ /* Initialize Atom core specific PerfMon capabilities.*/
6977+ pmu = & x86_pmu .hybrid_pmu [X86_HYBRID_PMU_ATOM_IDX ];
6978+ intel_pmu_init_skt (& pmu -> pmu );
6979+
6980+ pr_cont ("Lunarlake Hybrid events, " );
6981+ name = "lunarlake_hybrid" ;
6982+ break ;
6983+
68676984 default :
68686985 switch (x86_pmu .version ) {
68696986 case 1 :
0 commit comments