18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci/*---------------------------------------- 38c2ecf20Sopenharmony_ci PERFORMANCE INSTRUMENTATION 48c2ecf20Sopenharmony_ci Guillaume Thouvenin 08/10/98 58c2ecf20Sopenharmony_ci David S. Miller 10/06/98 68c2ecf20Sopenharmony_ci ---------------------------------------*/ 78c2ecf20Sopenharmony_ci#ifndef PERF_COUNTER_API 88c2ecf20Sopenharmony_ci#define PERF_COUNTER_API 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* sys_perfctr() interface. First arg is operation code 118c2ecf20Sopenharmony_ci * from enumeration below. The meaning of further arguments 128c2ecf20Sopenharmony_ci * are determined by the operation code. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * NOTE: This system call is no longer provided, use the perf_events 158c2ecf20Sopenharmony_ci * infrastructure. 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * Pointers which are passed by the user are pointers to 64-bit 188c2ecf20Sopenharmony_ci * integers. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * Once enabled, performance counter state is retained until the 218c2ecf20Sopenharmony_ci * process either exits or performs an exec. That is, performance 228c2ecf20Sopenharmony_ci * counters remain enabled for fork/clone children. 238c2ecf20Sopenharmony_ci */ 248c2ecf20Sopenharmony_cienum perfctr_opcode { 258c2ecf20Sopenharmony_ci /* Enable UltraSparc performance counters, ARG0 is pointer 268c2ecf20Sopenharmony_ci * to 64-bit accumulator for D0 counter in PIC, ARG1 is pointer 278c2ecf20Sopenharmony_ci * to 64-bit accumulator for D1 counter. ARG2 is a pointer to 288c2ecf20Sopenharmony_ci * the initial PCR register value to use. 298c2ecf20Sopenharmony_ci */ 308c2ecf20Sopenharmony_ci PERFCTR_ON, 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci /* Disable UltraSparc performance counters. The PCR is written 338c2ecf20Sopenharmony_ci * with zero and the user counter accumulator pointers and 348c2ecf20Sopenharmony_ci * working PCR register value are forgotten. 358c2ecf20Sopenharmony_ci */ 368c2ecf20Sopenharmony_ci PERFCTR_OFF, 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci /* Add current D0 and D1 PIC values into user pointers given 398c2ecf20Sopenharmony_ci * in PERFCTR_ON operation. The PIC is cleared before returning. 408c2ecf20Sopenharmony_ci */ 418c2ecf20Sopenharmony_ci PERFCTR_READ, 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci /* Clear the PIC register. */ 448c2ecf20Sopenharmony_ci PERFCTR_CLRPIC, 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci /* Begin using a new PCR value, the pointer to which is passed 478c2ecf20Sopenharmony_ci * in ARG0. The PIC is also cleared after the new PCR value is 488c2ecf20Sopenharmony_ci * written. 498c2ecf20Sopenharmony_ci */ 508c2ecf20Sopenharmony_ci PERFCTR_SETPCR, 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci /* Store in pointer given in ARG0 the current PCR register value 538c2ecf20Sopenharmony_ci * being used. 548c2ecf20Sopenharmony_ci */ 558c2ecf20Sopenharmony_ci PERFCTR_GETPCR 568c2ecf20Sopenharmony_ci}; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define PRIV 0x00000001 598c2ecf20Sopenharmony_ci#define SYS 0x00000002 608c2ecf20Sopenharmony_ci#define USR 0x00000004 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* Pic.S0 Selection Bit Field Encoding, Ultra-I/II */ 638c2ecf20Sopenharmony_ci#define CYCLE_CNT 0x00000000 648c2ecf20Sopenharmony_ci#define INSTR_CNT 0x00000010 658c2ecf20Sopenharmony_ci#define DISPATCH0_IC_MISS 0x00000020 668c2ecf20Sopenharmony_ci#define DISPATCH0_STOREBUF 0x00000030 678c2ecf20Sopenharmony_ci#define IC_REF 0x00000080 688c2ecf20Sopenharmony_ci#define DC_RD 0x00000090 698c2ecf20Sopenharmony_ci#define DC_WR 0x000000A0 708c2ecf20Sopenharmony_ci#define LOAD_USE 0x000000B0 718c2ecf20Sopenharmony_ci#define EC_REF 0x000000C0 728c2ecf20Sopenharmony_ci#define EC_WRITE_HIT_RDO 0x000000D0 738c2ecf20Sopenharmony_ci#define EC_SNOOP_INV 0x000000E0 748c2ecf20Sopenharmony_ci#define EC_RD_HIT 0x000000F0 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci/* Pic.S0 Selection Bit Field Encoding, Ultra-III */ 778c2ecf20Sopenharmony_ci#define US3_CYCLE_CNT 0x00000000 788c2ecf20Sopenharmony_ci#define US3_INSTR_CNT 0x00000010 798c2ecf20Sopenharmony_ci#define US3_DISPATCH0_IC_MISS 0x00000020 808c2ecf20Sopenharmony_ci#define US3_DISPATCH0_BR_TGT 0x00000030 818c2ecf20Sopenharmony_ci#define US3_DISPATCH0_2ND_BR 0x00000040 828c2ecf20Sopenharmony_ci#define US3_RSTALL_STOREQ 0x00000050 838c2ecf20Sopenharmony_ci#define US3_RSTALL_IU_USE 0x00000060 848c2ecf20Sopenharmony_ci#define US3_IC_REF 0x00000080 858c2ecf20Sopenharmony_ci#define US3_DC_RD 0x00000090 868c2ecf20Sopenharmony_ci#define US3_DC_WR 0x000000a0 878c2ecf20Sopenharmony_ci#define US3_EC_REF 0x000000c0 888c2ecf20Sopenharmony_ci#define US3_EC_WR_HIT_RTO 0x000000d0 898c2ecf20Sopenharmony_ci#define US3_EC_SNOOP_INV 0x000000e0 908c2ecf20Sopenharmony_ci#define US3_EC_RD_MISS 0x000000f0 918c2ecf20Sopenharmony_ci#define US3_PC_PORT0_RD 0x00000100 928c2ecf20Sopenharmony_ci#define US3_SI_SNOOP 0x00000110 938c2ecf20Sopenharmony_ci#define US3_SI_CIQ_FLOW 0x00000120 948c2ecf20Sopenharmony_ci#define US3_SI_OWNED 0x00000130 958c2ecf20Sopenharmony_ci#define US3_SW_COUNT_0 0x00000140 968c2ecf20Sopenharmony_ci#define US3_IU_BR_MISS_TAKEN 0x00000150 978c2ecf20Sopenharmony_ci#define US3_IU_BR_COUNT_TAKEN 0x00000160 988c2ecf20Sopenharmony_ci#define US3_DISP_RS_MISPRED 0x00000170 998c2ecf20Sopenharmony_ci#define US3_FA_PIPE_COMPL 0x00000180 1008c2ecf20Sopenharmony_ci#define US3_MC_READS_0 0x00000200 1018c2ecf20Sopenharmony_ci#define US3_MC_READS_1 0x00000210 1028c2ecf20Sopenharmony_ci#define US3_MC_READS_2 0x00000220 1038c2ecf20Sopenharmony_ci#define US3_MC_READS_3 0x00000230 1048c2ecf20Sopenharmony_ci#define US3_MC_STALLS_0 0x00000240 1058c2ecf20Sopenharmony_ci#define US3_MC_STALLS_2 0x00000250 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci/* Pic.S1 Selection Bit Field Encoding, Ultra-I/II */ 1088c2ecf20Sopenharmony_ci#define CYCLE_CNT_D1 0x00000000 1098c2ecf20Sopenharmony_ci#define INSTR_CNT_D1 0x00000800 1108c2ecf20Sopenharmony_ci#define DISPATCH0_IC_MISPRED 0x00001000 1118c2ecf20Sopenharmony_ci#define DISPATCH0_FP_USE 0x00001800 1128c2ecf20Sopenharmony_ci#define IC_HIT 0x00004000 1138c2ecf20Sopenharmony_ci#define DC_RD_HIT 0x00004800 1148c2ecf20Sopenharmony_ci#define DC_WR_HIT 0x00005000 1158c2ecf20Sopenharmony_ci#define LOAD_USE_RAW 0x00005800 1168c2ecf20Sopenharmony_ci#define EC_HIT 0x00006000 1178c2ecf20Sopenharmony_ci#define EC_WB 0x00006800 1188c2ecf20Sopenharmony_ci#define EC_SNOOP_CB 0x00007000 1198c2ecf20Sopenharmony_ci#define EC_IT_HIT 0x00007800 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci/* Pic.S1 Selection Bit Field Encoding, Ultra-III */ 1228c2ecf20Sopenharmony_ci#define US3_CYCLE_CNT_D1 0x00000000 1238c2ecf20Sopenharmony_ci#define US3_INSTR_CNT_D1 0x00000800 1248c2ecf20Sopenharmony_ci#define US3_DISPATCH0_MISPRED 0x00001000 1258c2ecf20Sopenharmony_ci#define US3_IC_MISS_CANCELLED 0x00001800 1268c2ecf20Sopenharmony_ci#define US3_RE_ENDIAN_MISS 0x00002000 1278c2ecf20Sopenharmony_ci#define US3_RE_FPU_BYPASS 0x00002800 1288c2ecf20Sopenharmony_ci#define US3_RE_DC_MISS 0x00003000 1298c2ecf20Sopenharmony_ci#define US3_RE_EC_MISS 0x00003800 1308c2ecf20Sopenharmony_ci#define US3_IC_MISS 0x00004000 1318c2ecf20Sopenharmony_ci#define US3_DC_RD_MISS 0x00004800 1328c2ecf20Sopenharmony_ci#define US3_DC_WR_MISS 0x00005000 1338c2ecf20Sopenharmony_ci#define US3_RSTALL_FP_USE 0x00005800 1348c2ecf20Sopenharmony_ci#define US3_EC_MISSES 0x00006000 1358c2ecf20Sopenharmony_ci#define US3_EC_WB 0x00006800 1368c2ecf20Sopenharmony_ci#define US3_EC_SNOOP_CB 0x00007000 1378c2ecf20Sopenharmony_ci#define US3_EC_IC_MISS 0x00007800 1388c2ecf20Sopenharmony_ci#define US3_RE_PC_MISS 0x00008000 1398c2ecf20Sopenharmony_ci#define US3_ITLB_MISS 0x00008800 1408c2ecf20Sopenharmony_ci#define US3_DTLB_MISS 0x00009000 1418c2ecf20Sopenharmony_ci#define US3_WC_MISS 0x00009800 1428c2ecf20Sopenharmony_ci#define US3_WC_SNOOP_CB 0x0000a000 1438c2ecf20Sopenharmony_ci#define US3_WC_SCRUBBED 0x0000a800 1448c2ecf20Sopenharmony_ci#define US3_WC_WB_WO_READ 0x0000b000 1458c2ecf20Sopenharmony_ci#define US3_PC_SOFT_HIT 0x0000c000 1468c2ecf20Sopenharmony_ci#define US3_PC_SNOOP_INV 0x0000c800 1478c2ecf20Sopenharmony_ci#define US3_PC_HARD_HIT 0x0000d000 1488c2ecf20Sopenharmony_ci#define US3_PC_PORT1_RD 0x0000d800 1498c2ecf20Sopenharmony_ci#define US3_SW_COUNT_1 0x0000e000 1508c2ecf20Sopenharmony_ci#define US3_IU_STAT_BR_MIS_UNTAKEN 0x0000e800 1518c2ecf20Sopenharmony_ci#define US3_IU_STAT_BR_COUNT_UNTAKEN 0x0000f000 1528c2ecf20Sopenharmony_ci#define US3_PC_MS_MISSES 0x0000f800 1538c2ecf20Sopenharmony_ci#define US3_MC_WRITES_0 0x00010800 1548c2ecf20Sopenharmony_ci#define US3_MC_WRITES_1 0x00011000 1558c2ecf20Sopenharmony_ci#define US3_MC_WRITES_2 0x00011800 1568c2ecf20Sopenharmony_ci#define US3_MC_WRITES_3 0x00012000 1578c2ecf20Sopenharmony_ci#define US3_MC_STALLS_1 0x00012800 1588c2ecf20Sopenharmony_ci#define US3_MC_STALLS_3 0x00013000 1598c2ecf20Sopenharmony_ci#define US3_RE_RAW_MISS 0x00013800 1608c2ecf20Sopenharmony_ci#define US3_FM_PIPE_COMPLETION 0x00014000 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_cistruct vcounter_struct { 1638c2ecf20Sopenharmony_ci unsigned long long vcnt0; 1648c2ecf20Sopenharmony_ci unsigned long long vcnt1; 1658c2ecf20Sopenharmony_ci}; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci#endif /* !(PERF_COUNTER_API) */ 168