xref: /linux/arch/alpha/include/asm/wrperfmon.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
292484f10SMichael Cree /*
392484f10SMichael Cree  * Definitions for use with the Alpha wrperfmon PAL call.
492484f10SMichael Cree  */
592484f10SMichael Cree 
692484f10SMichael Cree #ifndef __ALPHA_WRPERFMON_H
792484f10SMichael Cree #define __ALPHA_WRPERFMON_H
892484f10SMichael Cree 
992484f10SMichael Cree /* Following commands are implemented on all CPUs */
1092484f10SMichael Cree #define PERFMON_CMD_DISABLE 0
1192484f10SMichael Cree #define PERFMON_CMD_ENABLE 1
1292484f10SMichael Cree #define PERFMON_CMD_DESIRED_EVENTS 2
1392484f10SMichael Cree #define PERFMON_CMD_LOGGING_OPTIONS 3
1492484f10SMichael Cree /* Following commands on EV5/EV56/PCA56 only */
1592484f10SMichael Cree #define PERFMON_CMD_INT_FREQ 4
1692484f10SMichael Cree #define PERFMON_CMD_ENABLE_CLEAR 7
1792484f10SMichael Cree /* Following commands are on EV5 and better CPUs */
1892484f10SMichael Cree #define PERFMON_CMD_READ 5
1992484f10SMichael Cree #define PERFMON_CMD_WRITE 6
2092484f10SMichael Cree /* Following command are on EV6 and better CPUs */
2192484f10SMichael Cree #define PERFMON_CMD_ENABLE_WRITE 7
2292484f10SMichael Cree /* Following command are on EV67 and better CPUs */
2392484f10SMichael Cree #define PERFMON_CMD_I_STAT 8
2492484f10SMichael Cree #define PERFMON_CMD_PMPC 9
2592484f10SMichael Cree 
2692484f10SMichael Cree 
2792484f10SMichael Cree /* EV5/EV56/PCA56 Counters */
2892484f10SMichael Cree #define EV5_PCTR_0 (1UL<<0)
2992484f10SMichael Cree #define EV5_PCTR_1 (1UL<<1)
3092484f10SMichael Cree #define EV5_PCTR_2 (1UL<<2)
3192484f10SMichael Cree 
3292484f10SMichael Cree #define EV5_PCTR_0_COUNT_SHIFT 48
3392484f10SMichael Cree #define EV5_PCTR_1_COUNT_SHIFT 32
3492484f10SMichael Cree #define EV5_PCTR_2_COUNT_SHIFT 16
3592484f10SMichael Cree 
3692484f10SMichael Cree #define EV5_PCTR_0_COUNT_MASK 0xffffUL
3792484f10SMichael Cree #define EV5_PCTR_1_COUNT_MASK 0xffffUL
3892484f10SMichael Cree #define EV5_PCTR_2_COUNT_MASK 0x3fffUL
3992484f10SMichael Cree 
4092484f10SMichael Cree /* EV6 Counters */
4192484f10SMichael Cree #define EV6_PCTR_0 (1UL<<0)
4292484f10SMichael Cree #define EV6_PCTR_1 (1UL<<1)
4392484f10SMichael Cree 
4492484f10SMichael Cree #define EV6_PCTR_0_COUNT_SHIFT 28
4592484f10SMichael Cree #define EV6_PCTR_1_COUNT_SHIFT 6
4692484f10SMichael Cree 
4792484f10SMichael Cree #define EV6_PCTR_0_COUNT_MASK 0xfffffUL
4892484f10SMichael Cree #define EV6_PCTR_1_COUNT_MASK 0xfffffUL
4992484f10SMichael Cree 
5092484f10SMichael Cree /* EV67 (and subsequent) counters */
5192484f10SMichael Cree #define EV67_PCTR_0 (1UL<<0)
5292484f10SMichael Cree #define EV67_PCTR_1 (1UL<<1)
5392484f10SMichael Cree 
5492484f10SMichael Cree #define EV67_PCTR_0_COUNT_SHIFT 28
5592484f10SMichael Cree #define EV67_PCTR_1_COUNT_SHIFT 6
5692484f10SMichael Cree 
5792484f10SMichael Cree #define EV67_PCTR_0_COUNT_MASK 0xfffffUL
5892484f10SMichael Cree #define EV67_PCTR_1_COUNT_MASK 0xfffffUL
5992484f10SMichael Cree 
6092484f10SMichael Cree 
6192484f10SMichael Cree /*
6292484f10SMichael Cree  * The Alpha Architecure Handbook, vers. 4 (1998) appears to have a misprint
6392484f10SMichael Cree  *  in Table E-23 regarding the bits that set the event PCTR 1 counts.
6492484f10SMichael Cree  *  Hopefully what we have here is correct.
6592484f10SMichael Cree  */
6692484f10SMichael Cree #define EV6_PCTR_0_EVENT_MASK 0x10UL
6792484f10SMichael Cree #define EV6_PCTR_1_EVENT_MASK 0x0fUL
6892484f10SMichael Cree 
6992484f10SMichael Cree /* EV6 Events */
7092484f10SMichael Cree #define EV6_PCTR_0_CYCLES (0UL << 4)
7192484f10SMichael Cree #define EV6_PCTR_0_INSTRUCTIONS (1UL << 4)
7292484f10SMichael Cree 
7392484f10SMichael Cree #define EV6_PCTR_1_CYCLES 0
7492484f10SMichael Cree #define EV6_PCTR_1_BRANCHES 1
7592484f10SMichael Cree #define EV6_PCTR_1_BRANCH_MISPREDICTS 2
7692484f10SMichael Cree #define EV6_PCTR_1_DTB_SINGLE_MISSES 3
7792484f10SMichael Cree #define EV6_PCTR_1_DTB_DOUBLE_MISSES 4
7892484f10SMichael Cree #define EV6_PCTR_1_ITB_MISSES 5
7992484f10SMichael Cree #define EV6_PCTR_1_UNALIGNED_TRAPS 6
8092484f10SMichael Cree #define EV6_PCTR_1_REPLY_TRAPS 7
8192484f10SMichael Cree 
8292484f10SMichael Cree /* From the Alpha Architecture Reference Manual, 4th edn., 2002 */
8392484f10SMichael Cree #define EV67_PCTR_MODE_MASK 0x10UL
8492484f10SMichael Cree #define EV67_PCTR_EVENT_MASK 0x0CUL
8592484f10SMichael Cree 
8692484f10SMichael Cree #define EV67_PCTR_MODE_PROFILEME (1UL<<4)
8792484f10SMichael Cree #define EV67_PCTR_MODE_AGGREGATE (0UL<<4)
8892484f10SMichael Cree 
8992484f10SMichael Cree #define EV67_PCTR_INSTR_CYCLES (0UL<<2)
9092484f10SMichael Cree #define EV67_PCTR_CYCLES_UNDEF (1UL<<2)
9192484f10SMichael Cree #define EV67_PCTR_INSTR_BCACHEMISS (2UL<<2)
9292484f10SMichael Cree #define EV67_PCTR_CYCLES_MBOX (3UL<<2)
9392484f10SMichael Cree 
9492484f10SMichael Cree #endif
95