xref: /linux/arch/mips/kvm/trace.h (revision 04ebebf45a6ec61a4405040ea47c4320be5ed229)
1669e846eSSanjay Lal /*
2669e846eSSanjay Lal  * This file is subject to the terms and conditions of the GNU General Public
3669e846eSSanjay Lal  * License.  See the file "COPYING" in the main directory of this archive
4669e846eSSanjay Lal  * for more details.
5669e846eSSanjay Lal  *
6669e846eSSanjay Lal  * Copyright (C) 2012  MIPS Technologies, Inc.  All rights reserved.
7669e846eSSanjay Lal  * Authors: Sanjay Lal <sanjayl@kymasys.com>
8669e846eSSanjay Lal  */
9669e846eSSanjay Lal 
10669e846eSSanjay Lal #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
11669e846eSSanjay Lal #define _TRACE_KVM_H
12669e846eSSanjay Lal 
13669e846eSSanjay Lal #include <linux/tracepoint.h>
14669e846eSSanjay Lal 
15669e846eSSanjay Lal #undef TRACE_SYSTEM
16669e846eSSanjay Lal #define TRACE_SYSTEM kvm
17669e846eSSanjay Lal #define TRACE_INCLUDE_PATH .
18669e846eSSanjay Lal #define TRACE_INCLUDE_FILE trace
19669e846eSSanjay Lal 
20d116e812SDeng-Cheng Zhu /* Tracepoints for VM eists */
21669e846eSSanjay Lal extern char *kvm_mips_exit_types_str[MAX_KVM_MIPS_EXIT_TYPES];
22669e846eSSanjay Lal 
23669e846eSSanjay Lal TRACE_EVENT(kvm_exit,
24669e846eSSanjay Lal 	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
25669e846eSSanjay Lal 	    TP_ARGS(vcpu, reason),
26669e846eSSanjay Lal 	    TP_STRUCT__entry(
27b3cffac0SJames Hogan 			__field(unsigned long, pc)
28669e846eSSanjay Lal 			__field(unsigned int, reason)
29669e846eSSanjay Lal 	    ),
30669e846eSSanjay Lal 
31669e846eSSanjay Lal 	    TP_fast_assign(
32b3cffac0SJames Hogan 			__entry->pc = vcpu->arch.pc;
33669e846eSSanjay Lal 			__entry->reason = reason;
34669e846eSSanjay Lal 	    ),
35669e846eSSanjay Lal 
36669e846eSSanjay Lal 	    TP_printk("[%s]PC: 0x%08lx",
37669e846eSSanjay Lal 		      kvm_mips_exit_types_str[__entry->reason],
38b3cffac0SJames Hogan 		      __entry->pc)
39669e846eSSanjay Lal );
40669e846eSSanjay Lal 
41*04ebebf4SJames Hogan #define KVM_TRACE_AUX_RESTORE		0
42*04ebebf4SJames Hogan #define KVM_TRACE_AUX_SAVE		1
43*04ebebf4SJames Hogan #define KVM_TRACE_AUX_ENABLE		2
44*04ebebf4SJames Hogan #define KVM_TRACE_AUX_DISABLE		3
45*04ebebf4SJames Hogan #define KVM_TRACE_AUX_DISCARD		4
46*04ebebf4SJames Hogan 
47*04ebebf4SJames Hogan #define KVM_TRACE_AUX_FPU		1
48*04ebebf4SJames Hogan #define KVM_TRACE_AUX_MSA		2
49*04ebebf4SJames Hogan #define KVM_TRACE_AUX_FPU_MSA		3
50*04ebebf4SJames Hogan 
51*04ebebf4SJames Hogan #define kvm_trace_symbol_aux_op		\
52*04ebebf4SJames Hogan 	{ KVM_TRACE_AUX_RESTORE, "restore" },	\
53*04ebebf4SJames Hogan 	{ KVM_TRACE_AUX_SAVE,    "save" },	\
54*04ebebf4SJames Hogan 	{ KVM_TRACE_AUX_ENABLE,  "enable" },	\
55*04ebebf4SJames Hogan 	{ KVM_TRACE_AUX_DISABLE, "disable" },	\
56*04ebebf4SJames Hogan 	{ KVM_TRACE_AUX_DISCARD, "discard" }
57*04ebebf4SJames Hogan 
58*04ebebf4SJames Hogan #define kvm_trace_symbol_aux_state		\
59*04ebebf4SJames Hogan 	{ KVM_TRACE_AUX_FPU,     "FPU" },	\
60*04ebebf4SJames Hogan 	{ KVM_TRACE_AUX_MSA,     "MSA" },	\
61*04ebebf4SJames Hogan 	{ KVM_TRACE_AUX_FPU_MSA, "FPU & MSA" }
62*04ebebf4SJames Hogan 
63*04ebebf4SJames Hogan TRACE_EVENT(kvm_aux,
64*04ebebf4SJames Hogan 	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int op,
65*04ebebf4SJames Hogan 		     unsigned int state),
66*04ebebf4SJames Hogan 	    TP_ARGS(vcpu, op, state),
67*04ebebf4SJames Hogan 	    TP_STRUCT__entry(
68*04ebebf4SJames Hogan 			__field(unsigned long, pc)
69*04ebebf4SJames Hogan 			__field(u8, op)
70*04ebebf4SJames Hogan 			__field(u8, state)
71*04ebebf4SJames Hogan 	    ),
72*04ebebf4SJames Hogan 
73*04ebebf4SJames Hogan 	    TP_fast_assign(
74*04ebebf4SJames Hogan 			__entry->pc = vcpu->arch.pc;
75*04ebebf4SJames Hogan 			__entry->op = op;
76*04ebebf4SJames Hogan 			__entry->state = state;
77*04ebebf4SJames Hogan 	    ),
78*04ebebf4SJames Hogan 
79*04ebebf4SJames Hogan 	    TP_printk("%s %s PC: 0x%08lx",
80*04ebebf4SJames Hogan 		      __print_symbolic(__entry->op,
81*04ebebf4SJames Hogan 				       kvm_trace_symbol_aux_op),
82*04ebebf4SJames Hogan 		      __print_symbolic(__entry->state,
83*04ebebf4SJames Hogan 				       kvm_trace_symbol_aux_state),
84*04ebebf4SJames Hogan 		      __entry->pc)
85*04ebebf4SJames Hogan );
86*04ebebf4SJames Hogan 
87669e846eSSanjay Lal #endif /* _TRACE_KVM_H */
88669e846eSSanjay Lal 
89669e846eSSanjay Lal /* This part must be outside protection */
90669e846eSSanjay Lal #include <trace/define_trace.h>
91