MIPS: KVM: Add kvm_asid_change trace event
[deliverable/linux.git] / arch / mips / kvm / trace.h
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
7 * Authors: Sanjay Lal <sanjayl@kymasys.com>
8 */
9
10 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_KVM_H
12
13 #include <linux/tracepoint.h>
14
15 #undef TRACE_SYSTEM
16 #define TRACE_SYSTEM kvm
17 #define TRACE_INCLUDE_PATH .
18 #define TRACE_INCLUDE_FILE trace
19
20 /* The first 32 exit reasons correspond to Cause.ExcCode */
21 #define KVM_TRACE_EXIT_INT 0
22 #define KVM_TRACE_EXIT_TLBMOD 1
23 #define KVM_TRACE_EXIT_TLBMISS_LD 2
24 #define KVM_TRACE_EXIT_TLBMISS_ST 3
25 #define KVM_TRACE_EXIT_ADDRERR_LD 4
26 #define KVM_TRACE_EXIT_ADDRERR_ST 5
27 #define KVM_TRACE_EXIT_SYSCALL 8
28 #define KVM_TRACE_EXIT_BREAK_INST 9
29 #define KVM_TRACE_EXIT_RESVD_INST 10
30 #define KVM_TRACE_EXIT_COP_UNUSABLE 11
31 #define KVM_TRACE_EXIT_TRAP_INST 13
32 #define KVM_TRACE_EXIT_MSA_FPE 14
33 #define KVM_TRACE_EXIT_FPE 15
34 #define KVM_TRACE_EXIT_MSA_DISABLED 21
35 /* Further exit reasons */
36 #define KVM_TRACE_EXIT_WAIT 32
37 #define KVM_TRACE_EXIT_CACHE 33
38 #define KVM_TRACE_EXIT_SIGNAL 34
39
40 /* Tracepoints for VM exits */
41 #define kvm_trace_symbol_exit_types \
42 { KVM_TRACE_EXIT_INT, "Interrupt" }, \
43 { KVM_TRACE_EXIT_TLBMOD, "TLB Mod" }, \
44 { KVM_TRACE_EXIT_TLBMISS_LD, "TLB Miss (LD)" }, \
45 { KVM_TRACE_EXIT_TLBMISS_ST, "TLB Miss (ST)" }, \
46 { KVM_TRACE_EXIT_ADDRERR_LD, "Address Error (LD)" }, \
47 { KVM_TRACE_EXIT_ADDRERR_ST, "Address Err (ST)" }, \
48 { KVM_TRACE_EXIT_SYSCALL, "System Call" }, \
49 { KVM_TRACE_EXIT_BREAK_INST, "Break Inst" }, \
50 { KVM_TRACE_EXIT_RESVD_INST, "Reserved Inst" }, \
51 { KVM_TRACE_EXIT_COP_UNUSABLE, "COP0/1 Unusable" }, \
52 { KVM_TRACE_EXIT_TRAP_INST, "Trap Inst" }, \
53 { KVM_TRACE_EXIT_MSA_FPE, "MSA FPE" }, \
54 { KVM_TRACE_EXIT_FPE, "FPE" }, \
55 { KVM_TRACE_EXIT_MSA_DISABLED, "MSA Disabled" }, \
56 { KVM_TRACE_EXIT_WAIT, "WAIT" }, \
57 { KVM_TRACE_EXIT_CACHE, "CACHE" }, \
58 { KVM_TRACE_EXIT_SIGNAL, "Signal" }
59
60 TRACE_EVENT(kvm_exit,
61 TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
62 TP_ARGS(vcpu, reason),
63 TP_STRUCT__entry(
64 __field(unsigned long, pc)
65 __field(unsigned int, reason)
66 ),
67
68 TP_fast_assign(
69 __entry->pc = vcpu->arch.pc;
70 __entry->reason = reason;
71 ),
72
73 TP_printk("[%s]PC: 0x%08lx",
74 __print_symbolic(__entry->reason,
75 kvm_trace_symbol_exit_types),
76 __entry->pc)
77 );
78
79 #define KVM_TRACE_AUX_RESTORE 0
80 #define KVM_TRACE_AUX_SAVE 1
81 #define KVM_TRACE_AUX_ENABLE 2
82 #define KVM_TRACE_AUX_DISABLE 3
83 #define KVM_TRACE_AUX_DISCARD 4
84
85 #define KVM_TRACE_AUX_FPU 1
86 #define KVM_TRACE_AUX_MSA 2
87 #define KVM_TRACE_AUX_FPU_MSA 3
88
89 #define kvm_trace_symbol_aux_op \
90 { KVM_TRACE_AUX_RESTORE, "restore" }, \
91 { KVM_TRACE_AUX_SAVE, "save" }, \
92 { KVM_TRACE_AUX_ENABLE, "enable" }, \
93 { KVM_TRACE_AUX_DISABLE, "disable" }, \
94 { KVM_TRACE_AUX_DISCARD, "discard" }
95
96 #define kvm_trace_symbol_aux_state \
97 { KVM_TRACE_AUX_FPU, "FPU" }, \
98 { KVM_TRACE_AUX_MSA, "MSA" }, \
99 { KVM_TRACE_AUX_FPU_MSA, "FPU & MSA" }
100
101 TRACE_EVENT(kvm_aux,
102 TP_PROTO(struct kvm_vcpu *vcpu, unsigned int op,
103 unsigned int state),
104 TP_ARGS(vcpu, op, state),
105 TP_STRUCT__entry(
106 __field(unsigned long, pc)
107 __field(u8, op)
108 __field(u8, state)
109 ),
110
111 TP_fast_assign(
112 __entry->pc = vcpu->arch.pc;
113 __entry->op = op;
114 __entry->state = state;
115 ),
116
117 TP_printk("%s %s PC: 0x%08lx",
118 __print_symbolic(__entry->op,
119 kvm_trace_symbol_aux_op),
120 __print_symbolic(__entry->state,
121 kvm_trace_symbol_aux_state),
122 __entry->pc)
123 );
124
125 TRACE_EVENT(kvm_asid_change,
126 TP_PROTO(struct kvm_vcpu *vcpu, unsigned int old_asid,
127 unsigned int new_asid),
128 TP_ARGS(vcpu, old_asid, new_asid),
129 TP_STRUCT__entry(
130 __field(unsigned long, pc)
131 __field(u8, old_asid)
132 __field(u8, new_asid)
133 ),
134
135 TP_fast_assign(
136 __entry->pc = vcpu->arch.pc;
137 __entry->old_asid = old_asid;
138 __entry->new_asid = new_asid;
139 ),
140
141 TP_printk("PC: 0x%08lx old: 0x%02x new: 0x%02x",
142 __entry->pc,
143 __entry->old_asid,
144 __entry->new_asid)
145 );
146
147 #endif /* _TRACE_KVM_H */
148
149 /* This part must be outside protection */
150 #include <trace/define_trace.h>
This page took 0.035296 seconds and 6 git commands to generate.