MIPS: KVM: Clean up kvm_exit trace event
[linux-2.6-block.git] / arch / mips / kvm / trace.h
CommitLineData
669e846e 1/*
d116e812
DCZ
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 */
669e846e
SL
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
1e09e86a
JH
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" }
669e846e
SL
59
60TRACE_EVENT(kvm_exit,
61 TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
62 TP_ARGS(vcpu, reason),
63 TP_STRUCT__entry(
b3cffac0 64 __field(unsigned long, pc)
669e846e
SL
65 __field(unsigned int, reason)
66 ),
67
68 TP_fast_assign(
b3cffac0 69 __entry->pc = vcpu->arch.pc;
669e846e
SL
70 __entry->reason = reason;
71 ),
72
73 TP_printk("[%s]PC: 0x%08lx",
1e09e86a
JH
74 __print_symbolic(__entry->reason,
75 kvm_trace_symbol_exit_types),
b3cffac0 76 __entry->pc)
669e846e
SL
77);
78
04ebebf4
JH
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
101TRACE_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
669e846e
SL
125#endif /* _TRACE_KVM_H */
126
127/* This part must be outside protection */
128#include <trace/define_trace.h>