xref: /openbmc/linux/arch/powerpc/kvm/trace.h (revision b830f94f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define _TRACE_KVM_H
4 
5 #include <linux/tracepoint.h>
6 
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM kvm
9 
10 /*
11  * Tracepoint for guest mode entry.
12  */
13 TRACE_EVENT(kvm_ppc_instr,
14 	TP_PROTO(unsigned int inst, unsigned long _pc, unsigned int emulate),
15 	TP_ARGS(inst, _pc, emulate),
16 
17 	TP_STRUCT__entry(
18 		__field(	unsigned int,	inst		)
19 		__field(	unsigned long,	pc		)
20 		__field(	unsigned int,	emulate		)
21 	),
22 
23 	TP_fast_assign(
24 		__entry->inst		= inst;
25 		__entry->pc		= _pc;
26 		__entry->emulate	= emulate;
27 	),
28 
29 	TP_printk("inst %u pc 0x%lx emulate %u\n",
30 		  __entry->inst, __entry->pc, __entry->emulate)
31 );
32 
33 TRACE_EVENT(kvm_stlb_inval,
34 	TP_PROTO(unsigned int stlb_index),
35 	TP_ARGS(stlb_index),
36 
37 	TP_STRUCT__entry(
38 		__field(	unsigned int,	stlb_index	)
39 	),
40 
41 	TP_fast_assign(
42 		__entry->stlb_index	= stlb_index;
43 	),
44 
45 	TP_printk("stlb_index %u", __entry->stlb_index)
46 );
47 
48 TRACE_EVENT(kvm_stlb_write,
49 	TP_PROTO(unsigned int victim, unsigned int tid, unsigned int word0,
50 		 unsigned int word1, unsigned int word2),
51 	TP_ARGS(victim, tid, word0, word1, word2),
52 
53 	TP_STRUCT__entry(
54 		__field(	unsigned int,	victim		)
55 		__field(	unsigned int,	tid		)
56 		__field(	unsigned int,	word0		)
57 		__field(	unsigned int,	word1		)
58 		__field(	unsigned int,	word2		)
59 	),
60 
61 	TP_fast_assign(
62 		__entry->victim		= victim;
63 		__entry->tid		= tid;
64 		__entry->word0		= word0;
65 		__entry->word1		= word1;
66 		__entry->word2		= word2;
67 	),
68 
69 	TP_printk("victim %u tid %u w0 %u w1 %u w2 %u",
70 		__entry->victim, __entry->tid, __entry->word0,
71 		__entry->word1, __entry->word2)
72 );
73 
74 TRACE_EVENT(kvm_gtlb_write,
75 	TP_PROTO(unsigned int gtlb_index, unsigned int tid, unsigned int word0,
76 		 unsigned int word1, unsigned int word2),
77 	TP_ARGS(gtlb_index, tid, word0, word1, word2),
78 
79 	TP_STRUCT__entry(
80 		__field(	unsigned int,	gtlb_index	)
81 		__field(	unsigned int,	tid		)
82 		__field(	unsigned int,	word0		)
83 		__field(	unsigned int,	word1		)
84 		__field(	unsigned int,	word2		)
85 	),
86 
87 	TP_fast_assign(
88 		__entry->gtlb_index	= gtlb_index;
89 		__entry->tid		= tid;
90 		__entry->word0		= word0;
91 		__entry->word1		= word1;
92 		__entry->word2		= word2;
93 	),
94 
95 	TP_printk("gtlb_index %u tid %u w0 %u w1 %u w2 %u",
96 		__entry->gtlb_index, __entry->tid, __entry->word0,
97 		__entry->word1, __entry->word2)
98 );
99 
100 TRACE_EVENT(kvm_check_requests,
101 	TP_PROTO(struct kvm_vcpu *vcpu),
102 	TP_ARGS(vcpu),
103 
104 	TP_STRUCT__entry(
105 		__field(	__u32,	cpu_nr		)
106 		__field(	__u32,	requests	)
107 	),
108 
109 	TP_fast_assign(
110 		__entry->cpu_nr		= vcpu->vcpu_id;
111 		__entry->requests	= vcpu->requests;
112 	),
113 
114 	TP_printk("vcpu=%x requests=%x",
115 		__entry->cpu_nr, __entry->requests)
116 );
117 
118 #endif /* _TRACE_KVM_H */
119 
120 /* This part must be outside protection */
121 #undef TRACE_INCLUDE_PATH
122 #undef TRACE_INCLUDE_FILE
123 
124 #define TRACE_INCLUDE_PATH .
125 #define TRACE_INCLUDE_FILE trace
126 
127 #include <trace/define_trace.h>
128