162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 262306a36Sopenharmony_ci/*---------------------------------------- 362306a36Sopenharmony_ci PERFORMANCE INSTRUMENTATION 462306a36Sopenharmony_ci Guillaume Thouvenin 08/10/98 562306a36Sopenharmony_ci David S. Miller 10/06/98 662306a36Sopenharmony_ci ---------------------------------------*/ 762306a36Sopenharmony_ci#ifndef PERF_COUNTER_API 862306a36Sopenharmony_ci#define PERF_COUNTER_API 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* sys_perfctr() interface. First arg is operation code 1162306a36Sopenharmony_ci * from enumeration below. The meaning of further arguments 1262306a36Sopenharmony_ci * are determined by the operation code. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * NOTE: This system call is no longer provided, use the perf_events 1562306a36Sopenharmony_ci * infrastructure. 1662306a36Sopenharmony_ci * 1762306a36Sopenharmony_ci * Pointers which are passed by the user are pointers to 64-bit 1862306a36Sopenharmony_ci * integers. 1962306a36Sopenharmony_ci * 2062306a36Sopenharmony_ci * Once enabled, performance counter state is retained until the 2162306a36Sopenharmony_ci * process either exits or performs an exec. That is, performance 2262306a36Sopenharmony_ci * counters remain enabled for fork/clone children. 2362306a36Sopenharmony_ci */ 2462306a36Sopenharmony_cienum perfctr_opcode { 2562306a36Sopenharmony_ci /* Enable UltraSparc performance counters, ARG0 is pointer 2662306a36Sopenharmony_ci * to 64-bit accumulator for D0 counter in PIC, ARG1 is pointer 2762306a36Sopenharmony_ci * to 64-bit accumulator for D1 counter. ARG2 is a pointer to 2862306a36Sopenharmony_ci * the initial PCR register value to use. 2962306a36Sopenharmony_ci */ 3062306a36Sopenharmony_ci PERFCTR_ON, 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci /* Disable UltraSparc performance counters. The PCR is written 3362306a36Sopenharmony_ci * with zero and the user counter accumulator pointers and 3462306a36Sopenharmony_ci * working PCR register value are forgotten. 3562306a36Sopenharmony_ci */ 3662306a36Sopenharmony_ci PERFCTR_OFF, 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci /* Add current D0 and D1 PIC values into user pointers given 3962306a36Sopenharmony_ci * in PERFCTR_ON operation. The PIC is cleared before returning. 4062306a36Sopenharmony_ci */ 4162306a36Sopenharmony_ci PERFCTR_READ, 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci /* Clear the PIC register. */ 4462306a36Sopenharmony_ci PERFCTR_CLRPIC, 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci /* Begin using a new PCR value, the pointer to which is passed 4762306a36Sopenharmony_ci * in ARG0. The PIC is also cleared after the new PCR value is 4862306a36Sopenharmony_ci * written. 4962306a36Sopenharmony_ci */ 5062306a36Sopenharmony_ci PERFCTR_SETPCR, 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci /* Store in pointer given in ARG0 the current PCR register value 5362306a36Sopenharmony_ci * being used. 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_ci PERFCTR_GETPCR 5662306a36Sopenharmony_ci}; 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci#define PRIV 0x00000001 5962306a36Sopenharmony_ci#define SYS 0x00000002 6062306a36Sopenharmony_ci#define USR 0x00000004 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci/* Pic.S0 Selection Bit Field Encoding, Ultra-I/II */ 6362306a36Sopenharmony_ci#define CYCLE_CNT 0x00000000 6462306a36Sopenharmony_ci#define INSTR_CNT 0x00000010 6562306a36Sopenharmony_ci#define DISPATCH0_IC_MISS 0x00000020 6662306a36Sopenharmony_ci#define DISPATCH0_STOREBUF 0x00000030 6762306a36Sopenharmony_ci#define IC_REF 0x00000080 6862306a36Sopenharmony_ci#define DC_RD 0x00000090 6962306a36Sopenharmony_ci#define DC_WR 0x000000A0 7062306a36Sopenharmony_ci#define LOAD_USE 0x000000B0 7162306a36Sopenharmony_ci#define EC_REF 0x000000C0 7262306a36Sopenharmony_ci#define EC_WRITE_HIT_RDO 0x000000D0 7362306a36Sopenharmony_ci#define EC_SNOOP_INV 0x000000E0 7462306a36Sopenharmony_ci#define EC_RD_HIT 0x000000F0 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci/* Pic.S0 Selection Bit Field Encoding, Ultra-III */ 7762306a36Sopenharmony_ci#define US3_CYCLE_CNT 0x00000000 7862306a36Sopenharmony_ci#define US3_INSTR_CNT 0x00000010 7962306a36Sopenharmony_ci#define US3_DISPATCH0_IC_MISS 0x00000020 8062306a36Sopenharmony_ci#define US3_DISPATCH0_BR_TGT 0x00000030 8162306a36Sopenharmony_ci#define US3_DISPATCH0_2ND_BR 0x00000040 8262306a36Sopenharmony_ci#define US3_RSTALL_STOREQ 0x00000050 8362306a36Sopenharmony_ci#define US3_RSTALL_IU_USE 0x00000060 8462306a36Sopenharmony_ci#define US3_IC_REF 0x00000080 8562306a36Sopenharmony_ci#define US3_DC_RD 0x00000090 8662306a36Sopenharmony_ci#define US3_DC_WR 0x000000a0 8762306a36Sopenharmony_ci#define US3_EC_REF 0x000000c0 8862306a36Sopenharmony_ci#define US3_EC_WR_HIT_RTO 0x000000d0 8962306a36Sopenharmony_ci#define US3_EC_SNOOP_INV 0x000000e0 9062306a36Sopenharmony_ci#define US3_EC_RD_MISS 0x000000f0 9162306a36Sopenharmony_ci#define US3_PC_PORT0_RD 0x00000100 9262306a36Sopenharmony_ci#define US3_SI_SNOOP 0x00000110 9362306a36Sopenharmony_ci#define US3_SI_CIQ_FLOW 0x00000120 9462306a36Sopenharmony_ci#define US3_SI_OWNED 0x00000130 9562306a36Sopenharmony_ci#define US3_SW_COUNT_0 0x00000140 9662306a36Sopenharmony_ci#define US3_IU_BR_MISS_TAKEN 0x00000150 9762306a36Sopenharmony_ci#define US3_IU_BR_COUNT_TAKEN 0x00000160 9862306a36Sopenharmony_ci#define US3_DISP_RS_MISPRED 0x00000170 9962306a36Sopenharmony_ci#define US3_FA_PIPE_COMPL 0x00000180 10062306a36Sopenharmony_ci#define US3_MC_READS_0 0x00000200 10162306a36Sopenharmony_ci#define US3_MC_READS_1 0x00000210 10262306a36Sopenharmony_ci#define US3_MC_READS_2 0x00000220 10362306a36Sopenharmony_ci#define US3_MC_READS_3 0x00000230 10462306a36Sopenharmony_ci#define US3_MC_STALLS_0 0x00000240 10562306a36Sopenharmony_ci#define US3_MC_STALLS_2 0x00000250 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci/* Pic.S1 Selection Bit Field Encoding, Ultra-I/II */ 10862306a36Sopenharmony_ci#define CYCLE_CNT_D1 0x00000000 10962306a36Sopenharmony_ci#define INSTR_CNT_D1 0x00000800 11062306a36Sopenharmony_ci#define DISPATCH0_IC_MISPRED 0x00001000 11162306a36Sopenharmony_ci#define DISPATCH0_FP_USE 0x00001800 11262306a36Sopenharmony_ci#define IC_HIT 0x00004000 11362306a36Sopenharmony_ci#define DC_RD_HIT 0x00004800 11462306a36Sopenharmony_ci#define DC_WR_HIT 0x00005000 11562306a36Sopenharmony_ci#define LOAD_USE_RAW 0x00005800 11662306a36Sopenharmony_ci#define EC_HIT 0x00006000 11762306a36Sopenharmony_ci#define EC_WB 0x00006800 11862306a36Sopenharmony_ci#define EC_SNOOP_CB 0x00007000 11962306a36Sopenharmony_ci#define EC_IT_HIT 0x00007800 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci/* Pic.S1 Selection Bit Field Encoding, Ultra-III */ 12262306a36Sopenharmony_ci#define US3_CYCLE_CNT_D1 0x00000000 12362306a36Sopenharmony_ci#define US3_INSTR_CNT_D1 0x00000800 12462306a36Sopenharmony_ci#define US3_DISPATCH0_MISPRED 0x00001000 12562306a36Sopenharmony_ci#define US3_IC_MISS_CANCELLED 0x00001800 12662306a36Sopenharmony_ci#define US3_RE_ENDIAN_MISS 0x00002000 12762306a36Sopenharmony_ci#define US3_RE_FPU_BYPASS 0x00002800 12862306a36Sopenharmony_ci#define US3_RE_DC_MISS 0x00003000 12962306a36Sopenharmony_ci#define US3_RE_EC_MISS 0x00003800 13062306a36Sopenharmony_ci#define US3_IC_MISS 0x00004000 13162306a36Sopenharmony_ci#define US3_DC_RD_MISS 0x00004800 13262306a36Sopenharmony_ci#define US3_DC_WR_MISS 0x00005000 13362306a36Sopenharmony_ci#define US3_RSTALL_FP_USE 0x00005800 13462306a36Sopenharmony_ci#define US3_EC_MISSES 0x00006000 13562306a36Sopenharmony_ci#define US3_EC_WB 0x00006800 13662306a36Sopenharmony_ci#define US3_EC_SNOOP_CB 0x00007000 13762306a36Sopenharmony_ci#define US3_EC_IC_MISS 0x00007800 13862306a36Sopenharmony_ci#define US3_RE_PC_MISS 0x00008000 13962306a36Sopenharmony_ci#define US3_ITLB_MISS 0x00008800 14062306a36Sopenharmony_ci#define US3_DTLB_MISS 0x00009000 14162306a36Sopenharmony_ci#define US3_WC_MISS 0x00009800 14262306a36Sopenharmony_ci#define US3_WC_SNOOP_CB 0x0000a000 14362306a36Sopenharmony_ci#define US3_WC_SCRUBBED 0x0000a800 14462306a36Sopenharmony_ci#define US3_WC_WB_WO_READ 0x0000b000 14562306a36Sopenharmony_ci#define US3_PC_SOFT_HIT 0x0000c000 14662306a36Sopenharmony_ci#define US3_PC_SNOOP_INV 0x0000c800 14762306a36Sopenharmony_ci#define US3_PC_HARD_HIT 0x0000d000 14862306a36Sopenharmony_ci#define US3_PC_PORT1_RD 0x0000d800 14962306a36Sopenharmony_ci#define US3_SW_COUNT_1 0x0000e000 15062306a36Sopenharmony_ci#define US3_IU_STAT_BR_MIS_UNTAKEN 0x0000e800 15162306a36Sopenharmony_ci#define US3_IU_STAT_BR_COUNT_UNTAKEN 0x0000f000 15262306a36Sopenharmony_ci#define US3_PC_MS_MISSES 0x0000f800 15362306a36Sopenharmony_ci#define US3_MC_WRITES_0 0x00010800 15462306a36Sopenharmony_ci#define US3_MC_WRITES_1 0x00011000 15562306a36Sopenharmony_ci#define US3_MC_WRITES_2 0x00011800 15662306a36Sopenharmony_ci#define US3_MC_WRITES_3 0x00012000 15762306a36Sopenharmony_ci#define US3_MC_STALLS_1 0x00012800 15862306a36Sopenharmony_ci#define US3_MC_STALLS_3 0x00013000 15962306a36Sopenharmony_ci#define US3_RE_RAW_MISS 0x00013800 16062306a36Sopenharmony_ci#define US3_FM_PIPE_COMPLETION 0x00014000 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_cistruct vcounter_struct { 16362306a36Sopenharmony_ci unsigned long long vcnt0; 16462306a36Sopenharmony_ci unsigned long long vcnt1; 16562306a36Sopenharmony_ci}; 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ci#endif /* !(PERF_COUNTER_API) */ 168