18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Performance counter support for POWER9 processors.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2016 Madhavan Srinivasan, IBM Corporation.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/*
98c2ecf20Sopenharmony_ci * Power9 event codes.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ciEVENT(PM_CYC,					0x0001e)
128c2ecf20Sopenharmony_ciEVENT(PM_ICT_NOSLOT_CYC,			0x100f8)
138c2ecf20Sopenharmony_ciEVENT(PM_CMPLU_STALL,				0x1e054)
148c2ecf20Sopenharmony_ciEVENT(PM_INST_CMPL,				0x00002)
158c2ecf20Sopenharmony_ciEVENT(PM_BR_CMPL,				0x4d05e)
168c2ecf20Sopenharmony_ciEVENT(PM_BR_MPRED_CMPL,				0x400f6)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* All L1 D cache load references counted at finish, gated by reject */
198c2ecf20Sopenharmony_ciEVENT(PM_LD_REF_L1,				0x100fc)
208c2ecf20Sopenharmony_ci/* Load Missed L1 */
218c2ecf20Sopenharmony_ciEVENT(PM_LD_MISS_L1_FIN,			0x2c04e)
228c2ecf20Sopenharmony_ciEVENT(PM_LD_MISS_L1,				0x3e054)
238c2ecf20Sopenharmony_ci/* Alternate event code for PM_LD_MISS_L1 */
248c2ecf20Sopenharmony_ciEVENT(PM_LD_MISS_L1_ALT,			0x400f0)
258c2ecf20Sopenharmony_ci/* Store Missed L1 */
268c2ecf20Sopenharmony_ciEVENT(PM_ST_MISS_L1,				0x300f0)
278c2ecf20Sopenharmony_ci/* L1 cache data prefetches */
288c2ecf20Sopenharmony_ciEVENT(PM_L1_PREF,				0x20054)
298c2ecf20Sopenharmony_ci/* Instruction fetches from L1 */
308c2ecf20Sopenharmony_ciEVENT(PM_INST_FROM_L1,				0x04080)
318c2ecf20Sopenharmony_ci/* Demand iCache Miss */
328c2ecf20Sopenharmony_ciEVENT(PM_L1_ICACHE_MISS,			0x200fd)
338c2ecf20Sopenharmony_ci/* Instruction Demand sectors wriittent into IL1 */
348c2ecf20Sopenharmony_ciEVENT(PM_L1_DEMAND_WRITE,			0x0408c)
358c2ecf20Sopenharmony_ci/* Instruction prefetch written into IL1 */
368c2ecf20Sopenharmony_ciEVENT(PM_IC_PREF_WRITE,				0x0488c)
378c2ecf20Sopenharmony_ci/* The data cache was reloaded from local core's L3 due to a demand load */
388c2ecf20Sopenharmony_ciEVENT(PM_DATA_FROM_L3,				0x4c042)
398c2ecf20Sopenharmony_ci/* Demand LD - L3 Miss (not L2 hit and not L3 hit) */
408c2ecf20Sopenharmony_ciEVENT(PM_DATA_FROM_L3MISS,			0x300fe)
418c2ecf20Sopenharmony_ci/* All successful D-side store dispatches for this thread */
428c2ecf20Sopenharmony_ciEVENT(PM_L2_ST,					0x16880)
438c2ecf20Sopenharmony_ci/* All successful D-side store dispatches for this thread that were L2 Miss */
448c2ecf20Sopenharmony_ciEVENT(PM_L2_ST_MISS,				0x26880)
458c2ecf20Sopenharmony_ci/* Total HW L3 prefetches(Load+store) */
468c2ecf20Sopenharmony_ciEVENT(PM_L3_PREF_ALL,				0x4e052)
478c2ecf20Sopenharmony_ci/* Data PTEG reload */
488c2ecf20Sopenharmony_ciEVENT(PM_DTLB_MISS,				0x300fc)
498c2ecf20Sopenharmony_ci/* ITLB Reloaded */
508c2ecf20Sopenharmony_ciEVENT(PM_ITLB_MISS,				0x400fc)
518c2ecf20Sopenharmony_ci/* Run_Instructions */
528c2ecf20Sopenharmony_ciEVENT(PM_RUN_INST_CMPL,				0x500fa)
538c2ecf20Sopenharmony_ci/* Alternate event code for PM_RUN_INST_CMPL */
548c2ecf20Sopenharmony_ciEVENT(PM_RUN_INST_CMPL_ALT,			0x400fa)
558c2ecf20Sopenharmony_ci/* Run_cycles */
568c2ecf20Sopenharmony_ciEVENT(PM_RUN_CYC,				0x600f4)
578c2ecf20Sopenharmony_ci/* Alternate event code for Run_cycles */
588c2ecf20Sopenharmony_ciEVENT(PM_RUN_CYC_ALT,				0x200f4)
598c2ecf20Sopenharmony_ci/* Instruction Dispatched */
608c2ecf20Sopenharmony_ciEVENT(PM_INST_DISP,				0x200f2)
618c2ecf20Sopenharmony_ciEVENT(PM_INST_DISP_ALT,				0x300f2)
628c2ecf20Sopenharmony_ci/* Branch event that are not strongly biased */
638c2ecf20Sopenharmony_ciEVENT(PM_BR_2PATH,				0x20036)
648c2ecf20Sopenharmony_ci/* ALternate branch event that are not strongly biased */
658c2ecf20Sopenharmony_ciEVENT(PM_BR_2PATH_ALT,				0x40036)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/* Blacklisted events */
688c2ecf20Sopenharmony_ciEVENT(PM_MRK_ST_DONE_L2,			0x10134)
698c2ecf20Sopenharmony_ciEVENT(PM_RADIX_PWC_L1_HIT,			0x1f056)
708c2ecf20Sopenharmony_ciEVENT(PM_FLOP_CMPL,				0x100f4)
718c2ecf20Sopenharmony_ciEVENT(PM_MRK_NTF_FIN,				0x20112)
728c2ecf20Sopenharmony_ciEVENT(PM_RADIX_PWC_L2_HIT,			0x2d024)
738c2ecf20Sopenharmony_ciEVENT(PM_IFETCH_THROTTLE,			0x3405e)
748c2ecf20Sopenharmony_ciEVENT(PM_MRK_L2_TM_ST_ABORT_SISTER,		0x3e15c)
758c2ecf20Sopenharmony_ciEVENT(PM_RADIX_PWC_L3_HIT,			0x3f056)
768c2ecf20Sopenharmony_ciEVENT(PM_RUN_CYC_SMT2_MODE,			0x3006c)
778c2ecf20Sopenharmony_ciEVENT(PM_TM_TX_PASS_RUN_INST,			0x4e014)
788c2ecf20Sopenharmony_ciEVENT(PM_DISP_HELD_SYNC_HOLD,			0x4003c)
798c2ecf20Sopenharmony_ciEVENT(PM_DTLB_MISS_16G,				0x1c058)
808c2ecf20Sopenharmony_ciEVENT(PM_DERAT_MISS_2M,				0x1c05a)
818c2ecf20Sopenharmony_ciEVENT(PM_DTLB_MISS_2M,				0x1c05c)
828c2ecf20Sopenharmony_ciEVENT(PM_MRK_DTLB_MISS_1G,			0x1d15c)
838c2ecf20Sopenharmony_ciEVENT(PM_DTLB_MISS_4K,				0x2c056)
848c2ecf20Sopenharmony_ciEVENT(PM_DERAT_MISS_1G,				0x2c05a)
858c2ecf20Sopenharmony_ciEVENT(PM_MRK_DERAT_MISS_2M,			0x2d152)
868c2ecf20Sopenharmony_ciEVENT(PM_MRK_DTLB_MISS_4K,			0x2d156)
878c2ecf20Sopenharmony_ciEVENT(PM_MRK_DTLB_MISS_16G,			0x2d15e)
888c2ecf20Sopenharmony_ciEVENT(PM_DTLB_MISS_64K,				0x3c056)
898c2ecf20Sopenharmony_ciEVENT(PM_MRK_DERAT_MISS_1G,			0x3d152)
908c2ecf20Sopenharmony_ciEVENT(PM_MRK_DTLB_MISS_64K,			0x3d156)
918c2ecf20Sopenharmony_ciEVENT(PM_DTLB_MISS_16M,				0x4c056)
928c2ecf20Sopenharmony_ciEVENT(PM_DTLB_MISS_1G,				0x4c05a)
938c2ecf20Sopenharmony_ciEVENT(PM_MRK_DTLB_MISS_16M,			0x4c15e)
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/*
968c2ecf20Sopenharmony_ci * Memory Access Events
978c2ecf20Sopenharmony_ci *
988c2ecf20Sopenharmony_ci * Primary PMU event used here is PM_MRK_INST_CMPL (0x401e0)
998c2ecf20Sopenharmony_ci * To enable capturing of memory profiling, these MMCRA bits
1008c2ecf20Sopenharmony_ci * needs to be programmed and corresponding raw event format
1018c2ecf20Sopenharmony_ci * encoding.
1028c2ecf20Sopenharmony_ci *
1038c2ecf20Sopenharmony_ci * MMCRA bits encoding needed are
1048c2ecf20Sopenharmony_ci *     SM (Sampling Mode)
1058c2ecf20Sopenharmony_ci *     EM (Eligibility for Random Sampling)
1068c2ecf20Sopenharmony_ci *     TECE (Threshold Event Counter Event)
1078c2ecf20Sopenharmony_ci *     TS (Threshold Start Event)
1088c2ecf20Sopenharmony_ci *     TE (Threshold End Event)
1098c2ecf20Sopenharmony_ci *
1108c2ecf20Sopenharmony_ci * Corresponding Raw Encoding bits:
1118c2ecf20Sopenharmony_ci *     sample [EM,SM]
1128c2ecf20Sopenharmony_ci *     thresh_sel (TECE)
1138c2ecf20Sopenharmony_ci *     thresh start (TS)
1148c2ecf20Sopenharmony_ci *     thresh end (TE)
1158c2ecf20Sopenharmony_ci */
1168c2ecf20Sopenharmony_ciEVENT(MEM_LOADS,				0x34340401e0)
1178c2ecf20Sopenharmony_ciEVENT(MEM_STORES,				0x343c0401e0)
118