xref: /openbmc/linux/arch/powerpc/kvm/trace_booke.h (revision b830f94f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_TRACE_KVM_BOOKE_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define _TRACE_KVM_BOOKE_H
4 
5 #include <linux/tracepoint.h>
6 
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM kvm_booke
9 
10 #define kvm_trace_symbol_exit \
11 	{0, "CRITICAL"}, \
12 	{1, "MACHINE_CHECK"}, \
13 	{2, "DATA_STORAGE"}, \
14 	{3, "INST_STORAGE"}, \
15 	{4, "EXTERNAL"}, \
16 	{5, "ALIGNMENT"}, \
17 	{6, "PROGRAM"}, \
18 	{7, "FP_UNAVAIL"}, \
19 	{8, "SYSCALL"}, \
20 	{9, "AP_UNAVAIL"}, \
21 	{10, "DECREMENTER"}, \
22 	{11, "FIT"}, \
23 	{12, "WATCHDOG"}, \
24 	{13, "DTLB_MISS"}, \
25 	{14, "ITLB_MISS"}, \
26 	{15, "DEBUG"}, \
27 	{32, "SPE_UNAVAIL"}, \
28 	{33, "SPE_FP_DATA"}, \
29 	{34, "SPE_FP_ROUND"}, \
30 	{35, "PERFORMANCE_MONITOR"}, \
31 	{36, "DOORBELL"}, \
32 	{37, "DOORBELL_CRITICAL"}, \
33 	{38, "GUEST_DBELL"}, \
34 	{39, "GUEST_DBELL_CRIT"}, \
35 	{40, "HV_SYSCALL"}, \
36 	{41, "HV_PRIV"}
37 
38 TRACE_EVENT(kvm_exit,
39 	TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu),
40 	TP_ARGS(exit_nr, vcpu),
41 
42 	TP_STRUCT__entry(
43 		__field(	unsigned int,	exit_nr		)
44 		__field(	unsigned long,	pc		)
45 		__field(	unsigned long,	msr		)
46 		__field(	unsigned long,	dar		)
47 		__field(	unsigned long,	last_inst	)
48 	),
49 
50 	TP_fast_assign(
51 		__entry->exit_nr	= exit_nr;
52 		__entry->pc		= kvmppc_get_pc(vcpu);
53 		__entry->dar		= kvmppc_get_fault_dar(vcpu);
54 		__entry->msr		= vcpu->arch.shared->msr;
55 		__entry->last_inst	= vcpu->arch.last_inst;
56 	),
57 
58 	TP_printk("exit=%s"
59 		" | pc=0x%lx"
60 		" | msr=0x%lx"
61 		" | dar=0x%lx"
62 		" | last_inst=0x%lx"
63 		,
64 		__print_symbolic(__entry->exit_nr, kvm_trace_symbol_exit),
65 		__entry->pc,
66 		__entry->msr,
67 		__entry->dar,
68 		__entry->last_inst
69 		)
70 );
71 
72 TRACE_EVENT(kvm_unmap_hva,
73 	TP_PROTO(unsigned long hva),
74 	TP_ARGS(hva),
75 
76 	TP_STRUCT__entry(
77 		__field(	unsigned long,	hva		)
78 	),
79 
80 	TP_fast_assign(
81 		__entry->hva		= hva;
82 	),
83 
84 	TP_printk("unmap hva 0x%lx\n", __entry->hva)
85 );
86 
87 TRACE_EVENT(kvm_booke206_stlb_write,
88 	TP_PROTO(__u32 mas0, __u32 mas8, __u32 mas1, __u64 mas2, __u64 mas7_3),
89 	TP_ARGS(mas0, mas8, mas1, mas2, mas7_3),
90 
91 	TP_STRUCT__entry(
92 		__field(	__u32,	mas0		)
93 		__field(	__u32,	mas8		)
94 		__field(	__u32,	mas1		)
95 		__field(	__u64,	mas2		)
96 		__field(	__u64,	mas7_3		)
97 	),
98 
99 	TP_fast_assign(
100 		__entry->mas0		= mas0;
101 		__entry->mas8		= mas8;
102 		__entry->mas1		= mas1;
103 		__entry->mas2		= mas2;
104 		__entry->mas7_3		= mas7_3;
105 	),
106 
107 	TP_printk("mas0=%x mas8=%x mas1=%x mas2=%llx mas7_3=%llx",
108 		__entry->mas0, __entry->mas8, __entry->mas1,
109 		__entry->mas2, __entry->mas7_3)
110 );
111 
112 TRACE_EVENT(kvm_booke206_gtlb_write,
113 	TP_PROTO(__u32 mas0, __u32 mas1, __u64 mas2, __u64 mas7_3),
114 	TP_ARGS(mas0, mas1, mas2, mas7_3),
115 
116 	TP_STRUCT__entry(
117 		__field(	__u32,	mas0		)
118 		__field(	__u32,	mas1		)
119 		__field(	__u64,	mas2		)
120 		__field(	__u64,	mas7_3		)
121 	),
122 
123 	TP_fast_assign(
124 		__entry->mas0		= mas0;
125 		__entry->mas1		= mas1;
126 		__entry->mas2		= mas2;
127 		__entry->mas7_3		= mas7_3;
128 	),
129 
130 	TP_printk("mas0=%x mas1=%x mas2=%llx mas7_3=%llx",
131 		__entry->mas0, __entry->mas1,
132 		__entry->mas2, __entry->mas7_3)
133 );
134 
135 TRACE_EVENT(kvm_booke206_ref_release,
136 	TP_PROTO(__u64 pfn, __u32 flags),
137 	TP_ARGS(pfn, flags),
138 
139 	TP_STRUCT__entry(
140 		__field(	__u64,	pfn		)
141 		__field(	__u32,	flags		)
142 	),
143 
144 	TP_fast_assign(
145 		__entry->pfn		= pfn;
146 		__entry->flags		= flags;
147 	),
148 
149 	TP_printk("pfn=%llx flags=%x",
150 		__entry->pfn, __entry->flags)
151 );
152 
153 #ifdef CONFIG_SPE_POSSIBLE
154 #define kvm_trace_symbol_irqprio_spe \
155 	{BOOKE_IRQPRIO_SPE_UNAVAIL, "SPE_UNAVAIL"}, \
156 	{BOOKE_IRQPRIO_SPE_FP_DATA, "SPE_FP_DATA"}, \
157 	{BOOKE_IRQPRIO_SPE_FP_ROUND, "SPE_FP_ROUND"},
158 #else
159 #define kvm_trace_symbol_irqprio_spe
160 #endif
161 
162 #ifdef CONFIG_PPC_E500MC
163 #define kvm_trace_symbol_irqprio_e500mc \
164 	{BOOKE_IRQPRIO_ALTIVEC_UNAVAIL, "ALTIVEC_UNAVAIL"}, \
165 	{BOOKE_IRQPRIO_ALTIVEC_ASSIST, "ALTIVEC_ASSIST"},
166 #else
167 #define kvm_trace_symbol_irqprio_e500mc
168 #endif
169 
170 #define kvm_trace_symbol_irqprio \
171 	kvm_trace_symbol_irqprio_spe \
172 	kvm_trace_symbol_irqprio_e500mc \
173 	{BOOKE_IRQPRIO_DATA_STORAGE, "DATA_STORAGE"}, \
174 	{BOOKE_IRQPRIO_INST_STORAGE, "INST_STORAGE"}, \
175 	{BOOKE_IRQPRIO_ALIGNMENT, "ALIGNMENT"}, \
176 	{BOOKE_IRQPRIO_PROGRAM, "PROGRAM"}, \
177 	{BOOKE_IRQPRIO_FP_UNAVAIL, "FP_UNAVAIL"}, \
178 	{BOOKE_IRQPRIO_SYSCALL, "SYSCALL"}, \
179 	{BOOKE_IRQPRIO_AP_UNAVAIL, "AP_UNAVAIL"}, \
180 	{BOOKE_IRQPRIO_DTLB_MISS, "DTLB_MISS"}, \
181 	{BOOKE_IRQPRIO_ITLB_MISS, "ITLB_MISS"}, \
182 	{BOOKE_IRQPRIO_MACHINE_CHECK, "MACHINE_CHECK"}, \
183 	{BOOKE_IRQPRIO_DEBUG, "DEBUG"}, \
184 	{BOOKE_IRQPRIO_CRITICAL, "CRITICAL"}, \
185 	{BOOKE_IRQPRIO_WATCHDOG, "WATCHDOG"}, \
186 	{BOOKE_IRQPRIO_EXTERNAL, "EXTERNAL"}, \
187 	{BOOKE_IRQPRIO_FIT, "FIT"}, \
188 	{BOOKE_IRQPRIO_DECREMENTER, "DECREMENTER"}, \
189 	{BOOKE_IRQPRIO_PERFORMANCE_MONITOR, "PERFORMANCE_MONITOR"}, \
190 	{BOOKE_IRQPRIO_EXTERNAL_LEVEL, "EXTERNAL_LEVEL"}, \
191 	{BOOKE_IRQPRIO_DBELL, "DBELL"}, \
192 	{BOOKE_IRQPRIO_DBELL_CRIT, "DBELL_CRIT"} \
193 
194 TRACE_EVENT(kvm_booke_queue_irqprio,
195 	TP_PROTO(struct kvm_vcpu *vcpu, unsigned int priority),
196 	TP_ARGS(vcpu, priority),
197 
198 	TP_STRUCT__entry(
199 		__field(	__u32,	cpu_nr		)
200 		__field(	__u32,	priority		)
201 		__field(	unsigned long,	pending		)
202 	),
203 
204 	TP_fast_assign(
205 		__entry->cpu_nr		= vcpu->vcpu_id;
206 		__entry->priority	= priority;
207 		__entry->pending	= vcpu->arch.pending_exceptions;
208 	),
209 
210 	TP_printk("vcpu=%x prio=%s pending=%lx",
211 		__entry->cpu_nr,
212 		__print_symbolic(__entry->priority, kvm_trace_symbol_irqprio),
213 		__entry->pending)
214 );
215 
216 #endif
217 
218 /* This part must be outside protection */
219 
220 #undef TRACE_INCLUDE_PATH
221 #undef TRACE_INCLUDE_FILE
222 
223 #define TRACE_INCLUDE_PATH .
224 #define TRACE_INCLUDE_FILE trace_booke
225 
226 #include <trace/define_trace.h>
227