xref: /openbmc/linux/arch/powerpc/kvm/trace_hv.h (revision 77423a62)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_TRACE_KVM_HV_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define _TRACE_KVM_HV_H
4 
5 #include <linux/tracepoint.h>
6 #include "trace_book3s.h"
7 #include <asm/hvcall.h>
8 #include <asm/kvm_asm.h>
9 
10 #undef TRACE_SYSTEM
11 #define TRACE_SYSTEM kvm_hv
12 
13 #define kvm_trace_symbol_hcall \
14 	{H_REMOVE,			"H_REMOVE"}, \
15 	{H_ENTER,			"H_ENTER"}, \
16 	{H_READ,			"H_READ"}, \
17 	{H_CLEAR_MOD,			"H_CLEAR_MOD"}, \
18 	{H_CLEAR_REF,			"H_CLEAR_REF"}, \
19 	{H_PROTECT,			"H_PROTECT"}, \
20 	{H_GET_TCE,			"H_GET_TCE"}, \
21 	{H_PUT_TCE,			"H_PUT_TCE"}, \
22 	{H_SET_SPRG0,			"H_SET_SPRG0"}, \
23 	{H_SET_DABR,			"H_SET_DABR"}, \
24 	{H_PAGE_INIT,			"H_PAGE_INIT"}, \
25 	{H_SET_ASR,			"H_SET_ASR"}, \
26 	{H_ASR_ON,			"H_ASR_ON"}, \
27 	{H_ASR_OFF,			"H_ASR_OFF"}, \
28 	{H_LOGICAL_CI_LOAD,		"H_LOGICAL_CI_LOAD"}, \
29 	{H_LOGICAL_CI_STORE,		"H_LOGICAL_CI_STORE"}, \
30 	{H_LOGICAL_CACHE_LOAD,		"H_LOGICAL_CACHE_LOAD"}, \
31 	{H_LOGICAL_CACHE_STORE,		"H_LOGICAL_CACHE_STORE"}, \
32 	{H_LOGICAL_ICBI,		"H_LOGICAL_ICBI"}, \
33 	{H_LOGICAL_DCBF,		"H_LOGICAL_DCBF"}, \
34 	{H_GET_TERM_CHAR,		"H_GET_TERM_CHAR"}, \
35 	{H_PUT_TERM_CHAR,		"H_PUT_TERM_CHAR"}, \
36 	{H_REAL_TO_LOGICAL,		"H_REAL_TO_LOGICAL"}, \
37 	{H_HYPERVISOR_DATA,		"H_HYPERVISOR_DATA"}, \
38 	{H_EOI,				"H_EOI"}, \
39 	{H_CPPR,			"H_CPPR"}, \
40 	{H_IPI,				"H_IPI"}, \
41 	{H_IPOLL,			"H_IPOLL"}, \
42 	{H_XIRR,			"H_XIRR"}, \
43 	{H_PERFMON,			"H_PERFMON"}, \
44 	{H_MIGRATE_DMA,			"H_MIGRATE_DMA"}, \
45 	{H_REGISTER_VPA,		"H_REGISTER_VPA"}, \
46 	{H_CEDE,			"H_CEDE"}, \
47 	{H_CONFER,			"H_CONFER"}, \
48 	{H_PROD,			"H_PROD"}, \
49 	{H_GET_PPP,			"H_GET_PPP"}, \
50 	{H_SET_PPP,			"H_SET_PPP"}, \
51 	{H_PURR,			"H_PURR"}, \
52 	{H_PIC,				"H_PIC"}, \
53 	{H_REG_CRQ,			"H_REG_CRQ"}, \
54 	{H_FREE_CRQ,			"H_FREE_CRQ"}, \
55 	{H_VIO_SIGNAL,			"H_VIO_SIGNAL"}, \
56 	{H_SEND_CRQ,			"H_SEND_CRQ"}, \
57 	{H_COPY_RDMA,			"H_COPY_RDMA"}, \
58 	{H_REGISTER_LOGICAL_LAN,	"H_REGISTER_LOGICAL_LAN"}, \
59 	{H_FREE_LOGICAL_LAN,		"H_FREE_LOGICAL_LAN"}, \
60 	{H_ADD_LOGICAL_LAN_BUFFER,	"H_ADD_LOGICAL_LAN_BUFFER"}, \
61 	{H_SEND_LOGICAL_LAN,		"H_SEND_LOGICAL_LAN"}, \
62 	{H_BULK_REMOVE,			"H_BULK_REMOVE"}, \
63 	{H_MULTICAST_CTRL,		"H_MULTICAST_CTRL"}, \
64 	{H_SET_XDABR,			"H_SET_XDABR"}, \
65 	{H_STUFF_TCE,			"H_STUFF_TCE"}, \
66 	{H_PUT_TCE_INDIRECT,		"H_PUT_TCE_INDIRECT"}, \
67 	{H_CHANGE_LOGICAL_LAN_MAC,	"H_CHANGE_LOGICAL_LAN_MAC"}, \
68 	{H_VTERM_PARTNER_INFO,		"H_VTERM_PARTNER_INFO"}, \
69 	{H_REGISTER_VTERM,		"H_REGISTER_VTERM"}, \
70 	{H_FREE_VTERM,			"H_FREE_VTERM"}, \
71 	{H_RESET_EVENTS,		"H_RESET_EVENTS"}, \
72 	{H_ALLOC_RESOURCE,		"H_ALLOC_RESOURCE"}, \
73 	{H_FREE_RESOURCE,		"H_FREE_RESOURCE"}, \
74 	{H_MODIFY_QP,			"H_MODIFY_QP"}, \
75 	{H_QUERY_QP,			"H_QUERY_QP"}, \
76 	{H_REREGISTER_PMR,		"H_REREGISTER_PMR"}, \
77 	{H_REGISTER_SMR,		"H_REGISTER_SMR"}, \
78 	{H_QUERY_MR,			"H_QUERY_MR"}, \
79 	{H_QUERY_MW,			"H_QUERY_MW"}, \
80 	{H_QUERY_HCA,			"H_QUERY_HCA"}, \
81 	{H_QUERY_PORT,			"H_QUERY_PORT"}, \
82 	{H_MODIFY_PORT,			"H_MODIFY_PORT"}, \
83 	{H_DEFINE_AQP1,			"H_DEFINE_AQP1"}, \
84 	{H_GET_TRACE_BUFFER,		"H_GET_TRACE_BUFFER"}, \
85 	{H_DEFINE_AQP0,			"H_DEFINE_AQP0"}, \
86 	{H_RESIZE_MR,			"H_RESIZE_MR"}, \
87 	{H_ATTACH_MCQP,			"H_ATTACH_MCQP"}, \
88 	{H_DETACH_MCQP,			"H_DETACH_MCQP"}, \
89 	{H_CREATE_RPT,			"H_CREATE_RPT"}, \
90 	{H_REMOVE_RPT,			"H_REMOVE_RPT"}, \
91 	{H_REGISTER_RPAGES,		"H_REGISTER_RPAGES"}, \
92 	{H_DISABLE_AND_GET,		"H_DISABLE_AND_GET"}, \
93 	{H_ERROR_DATA,			"H_ERROR_DATA"}, \
94 	{H_GET_HCA_INFO,		"H_GET_HCA_INFO"}, \
95 	{H_GET_PERF_COUNT,		"H_GET_PERF_COUNT"}, \
96 	{H_MANAGE_TRACE,		"H_MANAGE_TRACE"}, \
97 	{H_GET_CPU_CHARACTERISTICS,	"H_GET_CPU_CHARACTERISTICS"}, \
98 	{H_FREE_LOGICAL_LAN_BUFFER,	"H_FREE_LOGICAL_LAN_BUFFER"}, \
99 	{H_QUERY_INT_STATE,		"H_QUERY_INT_STATE"}, \
100 	{H_POLL_PENDING,		"H_POLL_PENDING"}, \
101 	{H_ILLAN_ATTRIBUTES,		"H_ILLAN_ATTRIBUTES"}, \
102 	{H_MODIFY_HEA_QP,		"H_MODIFY_HEA_QP"}, \
103 	{H_QUERY_HEA_QP,		"H_QUERY_HEA_QP"}, \
104 	{H_QUERY_HEA,			"H_QUERY_HEA"}, \
105 	{H_QUERY_HEA_PORT,		"H_QUERY_HEA_PORT"}, \
106 	{H_MODIFY_HEA_PORT,		"H_MODIFY_HEA_PORT"}, \
107 	{H_REG_BCMC,			"H_REG_BCMC"}, \
108 	{H_DEREG_BCMC,			"H_DEREG_BCMC"}, \
109 	{H_REGISTER_HEA_RPAGES,		"H_REGISTER_HEA_RPAGES"}, \
110 	{H_DISABLE_AND_GET_HEA,		"H_DISABLE_AND_GET_HEA"}, \
111 	{H_GET_HEA_INFO,		"H_GET_HEA_INFO"}, \
112 	{H_ALLOC_HEA_RESOURCE,		"H_ALLOC_HEA_RESOURCE"}, \
113 	{H_ADD_CONN,			"H_ADD_CONN"}, \
114 	{H_DEL_CONN,			"H_DEL_CONN"}, \
115 	{H_JOIN,			"H_JOIN"}, \
116 	{H_VASI_STATE,			"H_VASI_STATE"}, \
117 	{H_ENABLE_CRQ,			"H_ENABLE_CRQ"}, \
118 	{H_GET_EM_PARMS,		"H_GET_EM_PARMS"}, \
119 	{H_GET_ENERGY_SCALE_INFO,	"H_GET_ENERGY_SCALE_INFO"}, \
120 	{H_SET_MPP,			"H_SET_MPP"}, \
121 	{H_GET_MPP,			"H_GET_MPP"}, \
122 	{H_HOME_NODE_ASSOCIATIVITY,	"H_HOME_NODE_ASSOCIATIVITY"}, \
123 	{H_BEST_ENERGY,			"H_BEST_ENERGY"}, \
124 	{H_XIRR_X,			"H_XIRR_X"}, \
125 	{H_RANDOM,			"H_RANDOM"}, \
126 	{H_COP,				"H_COP"}, \
127 	{H_GET_MPP_X,			"H_GET_MPP_X"}, \
128 	{H_SET_MODE,			"H_SET_MODE"}, \
129 	{H_REGISTER_PROC_TBL,		"H_REGISTER_PROC_TBL"}, \
130 	{H_QUERY_VAS_CAPABILITIES,	"H_QUERY_VAS_CAPABILITIES"}, \
131 	{H_INT_GET_SOURCE_INFO,		"H_INT_GET_SOURCE_INFO"}, \
132 	{H_INT_SET_SOURCE_CONFIG,	"H_INT_SET_SOURCE_CONFIG"}, \
133 	{H_INT_GET_QUEUE_INFO,		"H_INT_GET_QUEUE_INFO"}, \
134 	{H_INT_SET_QUEUE_CONFIG,	"H_INT_SET_QUEUE_CONFIG"}, \
135 	{H_INT_ESB,			"H_INT_ESB"}, \
136 	{H_INT_RESET,			"H_INT_RESET"}, \
137 	{H_RPT_INVALIDATE,		"H_RPT_INVALIDATE"}, \
138 	{H_RTAS,			"H_RTAS"}, \
139 	{H_LOGICAL_MEMOP,		"H_LOGICAL_MEMOP"}, \
140 	{H_CAS,				"H_CAS"}, \
141 	{H_UPDATE_DT,			"H_UPDATE_DT"}, \
142 	{H_GET_PERF_COUNTER_INFO,	"H_GET_PERF_COUNTER_INFO"}, \
143 	{H_SET_PARTITION_TABLE,		"H_SET_PARTITION_TABLE"}, \
144 	{H_ENTER_NESTED,		"H_ENTER_NESTED"}, \
145 	{H_TLB_INVALIDATE,		"H_TLB_INVALIDATE"}, \
146 	{H_COPY_TOFROM_GUEST,		"H_COPY_TOFROM_GUEST"}
147 
148 
149 #define kvm_trace_symbol_kvmret \
150 	{RESUME_GUEST,			"RESUME_GUEST"}, \
151 	{RESUME_GUEST_NV,		"RESUME_GUEST_NV"}, \
152 	{RESUME_HOST,			"RESUME_HOST"}, \
153 	{RESUME_HOST_NV,		"RESUME_HOST_NV"}
154 
155 #define kvm_trace_symbol_hcall_rc \
156 	{H_SUCCESS,			"H_SUCCESS"}, \
157 	{H_BUSY,			"H_BUSY"}, \
158 	{H_CLOSED,			"H_CLOSED"}, \
159 	{H_NOT_AVAILABLE,		"H_NOT_AVAILABLE"}, \
160 	{H_CONSTRAINED,			"H_CONSTRAINED"}, \
161 	{H_PARTIAL,			"H_PARTIAL"}, \
162 	{H_IN_PROGRESS,			"H_IN_PROGRESS"}, \
163 	{H_PAGE_REGISTERED,		"H_PAGE_REGISTERED"}, \
164 	{H_PARTIAL_STORE,		"H_PARTIAL_STORE"}, \
165 	{H_PENDING,			"H_PENDING"}, \
166 	{H_CONTINUE,			"H_CONTINUE"}, \
167 	{H_LONG_BUSY_START_RANGE,	"H_LONG_BUSY_START_RANGE"}, \
168 	{H_LONG_BUSY_ORDER_1_MSEC,	"H_LONG_BUSY_ORDER_1_MSEC"}, \
169 	{H_LONG_BUSY_ORDER_10_MSEC,	"H_LONG_BUSY_ORDER_10_MSEC"}, \
170 	{H_LONG_BUSY_ORDER_100_MSEC,	"H_LONG_BUSY_ORDER_100_MSEC"}, \
171 	{H_LONG_BUSY_ORDER_1_SEC,	"H_LONG_BUSY_ORDER_1_SEC"}, \
172 	{H_LONG_BUSY_ORDER_10_SEC,	"H_LONG_BUSY_ORDER_10_SEC"}, \
173 	{H_LONG_BUSY_ORDER_100_SEC,	"H_LONG_BUSY_ORDER_100_SEC"}, \
174 	{H_LONG_BUSY_END_RANGE,		"H_LONG_BUSY_END_RANGE"}, \
175 	{H_TOO_HARD,			"H_TOO_HARD"}, \
176 	{H_HARDWARE,			"H_HARDWARE"}, \
177 	{H_FUNCTION,			"H_FUNCTION"}, \
178 	{H_PRIVILEGE,			"H_PRIVILEGE"}, \
179 	{H_PARAMETER,			"H_PARAMETER"}, \
180 	{H_BAD_MODE,			"H_BAD_MODE"}, \
181 	{H_PTEG_FULL,			"H_PTEG_FULL"}, \
182 	{H_NOT_FOUND,			"H_NOT_FOUND"}, \
183 	{H_RESERVED_DABR,		"H_RESERVED_DABR"}, \
184 	{H_NO_MEM,			"H_NO_MEM"}, \
185 	{H_AUTHORITY,			"H_AUTHORITY"}, \
186 	{H_PERMISSION,			"H_PERMISSION"}, \
187 	{H_DROPPED,			"H_DROPPED"}, \
188 	{H_SOURCE_PARM,			"H_SOURCE_PARM"}, \
189 	{H_DEST_PARM,			"H_DEST_PARM"}, \
190 	{H_REMOTE_PARM,			"H_REMOTE_PARM"}, \
191 	{H_RESOURCE,			"H_RESOURCE"}, \
192 	{H_ADAPTER_PARM,		"H_ADAPTER_PARM"}, \
193 	{H_RH_PARM,			"H_RH_PARM"}, \
194 	{H_RCQ_PARM,			"H_RCQ_PARM"}, \
195 	{H_SCQ_PARM,			"H_SCQ_PARM"}, \
196 	{H_EQ_PARM,			"H_EQ_PARM"}, \
197 	{H_RT_PARM,			"H_RT_PARM"}, \
198 	{H_ST_PARM,			"H_ST_PARM"}, \
199 	{H_SIGT_PARM,			"H_SIGT_PARM"}, \
200 	{H_TOKEN_PARM,			"H_TOKEN_PARM"}, \
201 	{H_MLENGTH_PARM,		"H_MLENGTH_PARM"}, \
202 	{H_MEM_PARM,			"H_MEM_PARM"}, \
203 	{H_MEM_ACCESS_PARM,		"H_MEM_ACCESS_PARM"}, \
204 	{H_ATTR_PARM,			"H_ATTR_PARM"}, \
205 	{H_PORT_PARM,			"H_PORT_PARM"}, \
206 	{H_MCG_PARM,			"H_MCG_PARM"}, \
207 	{H_VL_PARM,			"H_VL_PARM"}, \
208 	{H_TSIZE_PARM,			"H_TSIZE_PARM"}, \
209 	{H_TRACE_PARM,			"H_TRACE_PARM"}, \
210 	{H_MASK_PARM,			"H_MASK_PARM"}, \
211 	{H_MCG_FULL,			"H_MCG_FULL"}, \
212 	{H_ALIAS_EXIST,			"H_ALIAS_EXIST"}, \
213 	{H_P_COUNTER,			"H_P_COUNTER"}, \
214 	{H_TABLE_FULL,			"H_TABLE_FULL"}, \
215 	{H_ALT_TABLE,			"H_ALT_TABLE"}, \
216 	{H_MR_CONDITION,		"H_MR_CONDITION"}, \
217 	{H_NOT_ENOUGH_RESOURCES,	"H_NOT_ENOUGH_RESOURCES"}, \
218 	{H_R_STATE,			"H_R_STATE"}, \
219 	{H_RESCINDED,			"H_RESCINDED"}, \
220 	{H_P2,				"H_P2"}, \
221 	{H_P3,				"H_P3"}, \
222 	{H_P4,				"H_P4"}, \
223 	{H_P5,				"H_P5"}, \
224 	{H_P6,				"H_P6"}, \
225 	{H_P7,				"H_P7"}, \
226 	{H_P8,				"H_P8"}, \
227 	{H_P9,				"H_P9"}, \
228 	{H_TOO_BIG,			"H_TOO_BIG"}, \
229 	{H_OVERLAP,			"H_OVERLAP"}, \
230 	{H_INTERRUPT,			"H_INTERRUPT"}, \
231 	{H_BAD_DATA,			"H_BAD_DATA"}, \
232 	{H_NOT_ACTIVE,			"H_NOT_ACTIVE"}, \
233 	{H_SG_LIST,			"H_SG_LIST"}, \
234 	{H_OP_MODE,			"H_OP_MODE"}, \
235 	{H_COP_HW,			"H_COP_HW"}, \
236 	{H_UNSUPPORTED_FLAG_START,	"H_UNSUPPORTED_FLAG_START"}, \
237 	{H_UNSUPPORTED_FLAG_END,	"H_UNSUPPORTED_FLAG_END"}, \
238 	{H_MULTI_THREADS_ACTIVE,	"H_MULTI_THREADS_ACTIVE"}, \
239 	{H_OUTSTANDING_COP_OPS,		"H_OUTSTANDING_COP_OPS"}
240 
241 TRACE_EVENT(kvm_guest_enter,
242 	TP_PROTO(struct kvm_vcpu *vcpu),
243 	TP_ARGS(vcpu),
244 
245 	TP_STRUCT__entry(
246 		__field(int,		vcpu_id)
247 		__field(unsigned long,	pc)
248 		__field(unsigned long,  pending_exceptions)
249 		__field(u8,		ceded)
250 	),
251 
252 	TP_fast_assign(
253 		__entry->vcpu_id	= vcpu->vcpu_id;
254 		__entry->pc		= kvmppc_get_pc(vcpu);
255 		__entry->ceded		= vcpu->arch.ceded;
256 		__entry->pending_exceptions  = vcpu->arch.pending_exceptions;
257 	),
258 
259 	TP_printk("VCPU %d: pc=0x%lx pexcp=0x%lx ceded=%d",
260 			__entry->vcpu_id,
261 			__entry->pc,
262 			__entry->pending_exceptions, __entry->ceded)
263 );
264 
265 TRACE_EVENT(kvm_guest_exit,
266 	TP_PROTO(struct kvm_vcpu *vcpu),
267 	TP_ARGS(vcpu),
268 
269 	TP_STRUCT__entry(
270 		__field(int,		vcpu_id)
271 		__field(int,		trap)
272 		__field(unsigned long,	pc)
273 		__field(unsigned long,	msr)
274 		__field(u8,		ceded)
275 	),
276 
277 	TP_fast_assign(
278 		__entry->vcpu_id = vcpu->vcpu_id;
279 		__entry->trap	 = vcpu->arch.trap;
280 		__entry->ceded	 = vcpu->arch.ceded;
281 		__entry->pc	 = kvmppc_get_pc(vcpu);
282 		__entry->msr	 = vcpu->arch.shregs.msr;
283 	),
284 
285 	TP_printk("VCPU %d: trap=%s pc=0x%lx msr=0x%lx, ceded=%d",
286 		__entry->vcpu_id,
287 		__print_symbolic(__entry->trap, kvm_trace_symbol_exit),
288 		__entry->pc, __entry->msr, __entry->ceded
289 	)
290 );
291 
292 TRACE_EVENT(kvm_page_fault_enter,
293 	TP_PROTO(struct kvm_vcpu *vcpu, unsigned long *hptep,
294 		 struct kvm_memory_slot *memslot, unsigned long ea,
295 		 unsigned long dsisr),
296 
297 	TP_ARGS(vcpu, hptep, memslot, ea, dsisr),
298 
299 	TP_STRUCT__entry(
300 		__field(int,		vcpu_id)
301 		__field(unsigned long,	hpte_v)
302 		__field(unsigned long,	hpte_r)
303 		__field(unsigned long,	gpte_r)
304 		__field(unsigned long,	ea)
305 		__field(u64,		base_gfn)
306 		__field(u32,		slot_flags)
307 		__field(u32,		dsisr)
308 	),
309 
310 	TP_fast_assign(
311 		__entry->vcpu_id  = vcpu->vcpu_id;
312 		__entry->hpte_v	  = hptep[0];
313 		__entry->hpte_r	  = hptep[1];
314 		__entry->gpte_r	  = hptep[2];
315 		__entry->ea	  = ea;
316 		__entry->dsisr	  = dsisr;
317 		__entry->base_gfn = memslot ? memslot->base_gfn : -1UL;
318 		__entry->slot_flags = memslot ? memslot->flags : 0;
319 	),
320 
321 	TP_printk("VCPU %d: hpte=0x%lx:0x%lx guest=0x%lx ea=0x%lx,%x slot=0x%llx,0x%x",
322 		   __entry->vcpu_id,
323 		   __entry->hpte_v, __entry->hpte_r, __entry->gpte_r,
324 		   __entry->ea, __entry->dsisr,
325 		   __entry->base_gfn, __entry->slot_flags)
326 );
327 
328 TRACE_EVENT(kvm_page_fault_exit,
329 	TP_PROTO(struct kvm_vcpu *vcpu, unsigned long *hptep, long ret),
330 
331 	TP_ARGS(vcpu, hptep, ret),
332 
333 	TP_STRUCT__entry(
334 		__field(int,		vcpu_id)
335 		__field(unsigned long,	hpte_v)
336 		__field(unsigned long,	hpte_r)
337 		__field(long,		ret)
338 	),
339 
340 	TP_fast_assign(
341 		__entry->vcpu_id  = vcpu->vcpu_id;
342 		__entry->hpte_v	= hptep[0];
343 		__entry->hpte_r	= hptep[1];
344 		__entry->ret = ret;
345 	),
346 
347 	TP_printk("VCPU %d: hpte=0x%lx:0x%lx ret=0x%lx",
348 		   __entry->vcpu_id,
349 		   __entry->hpte_v, __entry->hpte_r, __entry->ret)
350 );
351 
352 TRACE_EVENT(kvm_hcall_enter,
353 	TP_PROTO(struct kvm_vcpu *vcpu),
354 
355 	TP_ARGS(vcpu),
356 
357 	TP_STRUCT__entry(
358 		__field(int,		vcpu_id)
359 		__field(unsigned long,	req)
360 		__field(unsigned long,	gpr4)
361 		__field(unsigned long,	gpr5)
362 		__field(unsigned long,	gpr6)
363 		__field(unsigned long,	gpr7)
364 	),
365 
366 	TP_fast_assign(
367 		__entry->vcpu_id  = vcpu->vcpu_id;
368 		__entry->req   = kvmppc_get_gpr(vcpu, 3);
369 		__entry->gpr4  = kvmppc_get_gpr(vcpu, 4);
370 		__entry->gpr5  = kvmppc_get_gpr(vcpu, 5);
371 		__entry->gpr6  = kvmppc_get_gpr(vcpu, 6);
372 		__entry->gpr7  = kvmppc_get_gpr(vcpu, 7);
373 	),
374 
375 	TP_printk("VCPU %d: hcall=%s GPR4-7=0x%lx,0x%lx,0x%lx,0x%lx",
376 		   __entry->vcpu_id,
377 		   __print_symbolic(__entry->req, kvm_trace_symbol_hcall),
378 		   __entry->gpr4, __entry->gpr5, __entry->gpr6, __entry->gpr7)
379 );
380 
381 TRACE_EVENT(kvm_hcall_exit,
382 	TP_PROTO(struct kvm_vcpu *vcpu, int ret),
383 
384 	TP_ARGS(vcpu, ret),
385 
386 	TP_STRUCT__entry(
387 		__field(int,		vcpu_id)
388 		__field(unsigned long,	ret)
389 		__field(unsigned long,	hcall_rc)
390 	),
391 
392 	TP_fast_assign(
393 		__entry->vcpu_id  = vcpu->vcpu_id;
394 		__entry->ret	  = ret;
395 		__entry->hcall_rc = kvmppc_get_gpr(vcpu, 3);
396 	),
397 
398 	TP_printk("VCPU %d: ret=%s hcall_rc=%s",
399 		   __entry->vcpu_id,
400 		   __print_symbolic(__entry->ret, kvm_trace_symbol_kvmret),
401 		   __print_symbolic(__entry->ret & RESUME_FLAG_HOST ?
402 					H_TOO_HARD : __entry->hcall_rc,
403 					kvm_trace_symbol_hcall_rc))
404 );
405 
406 TRACE_EVENT(kvmppc_run_core,
407 	TP_PROTO(struct kvmppc_vcore *vc, int where),
408 
409 	TP_ARGS(vc, where),
410 
411 	TP_STRUCT__entry(
412 		__field(int,	n_runnable)
413 		__field(int,	runner_vcpu)
414 		__field(int,	where)
415 		__field(pid_t,	tgid)
416 	),
417 
418 	TP_fast_assign(
419 		__entry->runner_vcpu	= vc->runner->vcpu_id;
420 		__entry->n_runnable	= vc->n_runnable;
421 		__entry->where		= where;
422 		__entry->tgid		= current->tgid;
423 	),
424 
425 	TP_printk("%s runner_vcpu==%d runnable=%d tgid=%d",
426 		    __entry->where ? "Exit" : "Enter",
427 		    __entry->runner_vcpu, __entry->n_runnable, __entry->tgid)
428 );
429 
430 TRACE_EVENT(kvmppc_vcore_blocked,
431 	TP_PROTO(struct kvm_vcpu *vcpu, int where),
432 
433 	TP_ARGS(vcpu, where),
434 
435 	TP_STRUCT__entry(
436 		__field(int,	n_runnable)
437 		__field(int,	runner_vcpu)
438 		__field(int,	where)
439 		__field(pid_t,	tgid)
440 	),
441 
442 	TP_fast_assign(
443 		__entry->runner_vcpu = vcpu->vcpu_id;
444 		__entry->n_runnable  = vcpu->arch.vcore->n_runnable;
445 		__entry->where       = where;
446 		__entry->tgid	     = current->tgid;
447 	),
448 
449 	TP_printk("%s runner_vcpu=%d runnable=%d tgid=%d",
450 		   __entry->where ? "Exit" : "Enter",
451 		   __entry->runner_vcpu, __entry->n_runnable, __entry->tgid)
452 );
453 
454 TRACE_EVENT(kvmppc_vcore_wakeup,
455 	TP_PROTO(int do_sleep, __u64 ns),
456 
457 	TP_ARGS(do_sleep, ns),
458 
459 	TP_STRUCT__entry(
460 		__field(__u64,  ns)
461 		__field(int,    waited)
462 		__field(pid_t,  tgid)
463 	),
464 
465 	TP_fast_assign(
466 		__entry->ns     = ns;
467 		__entry->waited = do_sleep;
468 		__entry->tgid   = current->tgid;
469 	),
470 
471 	TP_printk("%s time %llu ns, tgid=%d",
472 		__entry->waited ? "wait" : "poll",
473 		__entry->ns, __entry->tgid)
474 );
475 
476 TRACE_EVENT(kvmppc_run_vcpu_enter,
477 	TP_PROTO(struct kvm_vcpu *vcpu),
478 
479 	TP_ARGS(vcpu),
480 
481 	TP_STRUCT__entry(
482 		__field(int,		vcpu_id)
483 		__field(pid_t,		tgid)
484 	),
485 
486 	TP_fast_assign(
487 		__entry->vcpu_id  = vcpu->vcpu_id;
488 		__entry->tgid	  = current->tgid;
489 	),
490 
491 	TP_printk("VCPU %d: tgid=%d", __entry->vcpu_id, __entry->tgid)
492 );
493 
494 TRACE_EVENT(kvmppc_run_vcpu_exit,
495 	TP_PROTO(struct kvm_vcpu *vcpu),
496 
497 	TP_ARGS(vcpu),
498 
499 	TP_STRUCT__entry(
500 		__field(int,		vcpu_id)
501 		__field(int,		exit)
502 		__field(int,		ret)
503 	),
504 
505 	TP_fast_assign(
506 		__entry->vcpu_id  = vcpu->vcpu_id;
507 		__entry->exit     = vcpu->run->exit_reason;
508 		__entry->ret      = vcpu->arch.ret;
509 	),
510 
511 	TP_printk("VCPU %d: exit=%d, ret=%d",
512 			__entry->vcpu_id, __entry->exit, __entry->ret)
513 );
514 
515 #endif /* _TRACE_KVM_HV_H */
516 
517 /* This part must be outside protection */
518 
519 #undef TRACE_INCLUDE_PATH
520 #undef TRACE_INCLUDE_FILE
521 
522 #define TRACE_INCLUDE_PATH .
523 #define TRACE_INCLUDE_FILE trace_hv
524 
525 #include <trace/define_trace.h>
526