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
5 #include <linux/tracepoint.h>
6 #include "trace_book3s.h"
7 #include <asm/hvcall.h>
8 #include <asm/kvm_asm.h>
11 #define TRACE_SYSTEM kvm_hv
13 #define kvm_trace_symbol_hcall \
14 {H_REMOVE, "H_REMOVE"}, \
15 {H_ENTER, "H_ENTER"}, \
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"}, \
41 {H_IPOLL, "H_IPOLL"}, \
43 {H_PERFMON, "H_PERFMON"}, \
44 {H_MIGRATE_DMA, "H_MIGRATE_DMA"}, \
45 {H_REGISTER_VPA, "H_REGISTER_VPA"}, \
47 {H_CONFER, "H_CONFER"}, \
49 {H_GET_PPP, "H_GET_PPP"}, \
50 {H_SET_PPP, "H_SET_PPP"}, \
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_GETC, "H_DISABLE_AND_GETC"}, \
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_FREE_LOGICAL_LAN_BUFFER, "H_FREE_LOGICAL_LAN_BUFFER"}, \
98 {H_QUERY_INT_STATE, "H_QUERY_INT_STATE"}, \
99 {H_POLL_PENDING, "H_POLL_PENDING"}, \
100 {H_ILLAN_ATTRIBUTES, "H_ILLAN_ATTRIBUTES"}, \
101 {H_MODIFY_HEA_QP, "H_MODIFY_HEA_QP"}, \
102 {H_QUERY_HEA_QP, "H_QUERY_HEA_QP"}, \
103 {H_QUERY_HEA, "H_QUERY_HEA"}, \
104 {H_QUERY_HEA_PORT, "H_QUERY_HEA_PORT"}, \
105 {H_MODIFY_HEA_PORT, "H_MODIFY_HEA_PORT"}, \
106 {H_REG_BCMC, "H_REG_BCMC"}, \
107 {H_DEREG_BCMC, "H_DEREG_BCMC"}, \
108 {H_REGISTER_HEA_RPAGES, "H_REGISTER_HEA_RPAGES"}, \
109 {H_DISABLE_AND_GET_HEA, "H_DISABLE_AND_GET_HEA"}, \
110 {H_GET_HEA_INFO, "H_GET_HEA_INFO"}, \
111 {H_ALLOC_HEA_RESOURCE, "H_ALLOC_HEA_RESOURCE"}, \
112 {H_ADD_CONN, "H_ADD_CONN"}, \
113 {H_DEL_CONN, "H_DEL_CONN"}, \
114 {H_JOIN, "H_JOIN"}, \
115 {H_VASI_STATE, "H_VASI_STATE"}, \
116 {H_ENABLE_CRQ, "H_ENABLE_CRQ"}, \
117 {H_GET_EM_PARMS, "H_GET_EM_PARMS"}, \
118 {H_SET_MPP, "H_SET_MPP"}, \
119 {H_GET_MPP, "H_GET_MPP"}, \
120 {H_HOME_NODE_ASSOCIATIVITY, "H_HOME_NODE_ASSOCIATIVITY"}, \
121 {H_BEST_ENERGY, "H_BEST_ENERGY"}, \
122 {H_XIRR_X, "H_XIRR_X"}, \
123 {H_RANDOM, "H_RANDOM"}, \
125 {H_GET_MPP_X, "H_GET_MPP_X"}, \
126 {H_SET_MODE, "H_SET_MODE"}, \
129 #define kvm_trace_symbol_kvmret \
130 {RESUME_GUEST, "RESUME_GUEST"}, \
131 {RESUME_GUEST_NV, "RESUME_GUEST_NV"}, \
132 {RESUME_HOST, "RESUME_HOST"}, \
133 {RESUME_HOST_NV, "RESUME_HOST_NV"}
135 #define kvm_trace_symbol_hcall_rc \
136 {H_SUCCESS, "H_SUCCESS"}, \
137 {H_BUSY, "H_BUSY"}, \
138 {H_CLOSED, "H_CLOSED"}, \
139 {H_NOT_AVAILABLE, "H_NOT_AVAILABLE"}, \
140 {H_CONSTRAINED, "H_CONSTRAINED"}, \
141 {H_PARTIAL, "H_PARTIAL"}, \
142 {H_IN_PROGRESS, "H_IN_PROGRESS"}, \
143 {H_PAGE_REGISTERED, "H_PAGE_REGISTERED"}, \
144 {H_PARTIAL_STORE, "H_PARTIAL_STORE"}, \
145 {H_PENDING, "H_PENDING"}, \
146 {H_CONTINUE, "H_CONTINUE"}, \
147 {H_LONG_BUSY_START_RANGE, "H_LONG_BUSY_START_RANGE"}, \
148 {H_LONG_BUSY_ORDER_1_MSEC, "H_LONG_BUSY_ORDER_1_MSEC"}, \
149 {H_LONG_BUSY_ORDER_10_MSEC, "H_LONG_BUSY_ORDER_10_MSEC"}, \
150 {H_LONG_BUSY_ORDER_100_MSEC, "H_LONG_BUSY_ORDER_100_MSEC"}, \
151 {H_LONG_BUSY_ORDER_1_SEC, "H_LONG_BUSY_ORDER_1_SEC"}, \
152 {H_LONG_BUSY_ORDER_10_SEC, "H_LONG_BUSY_ORDER_10_SEC"}, \
153 {H_LONG_BUSY_ORDER_100_SEC, "H_LONG_BUSY_ORDER_100_SEC"}, \
154 {H_LONG_BUSY_END_RANGE, "H_LONG_BUSY_END_RANGE"}, \
155 {H_TOO_HARD, "H_TOO_HARD"}, \
156 {H_HARDWARE, "H_HARDWARE"}, \
157 {H_FUNCTION, "H_FUNCTION"}, \
158 {H_PRIVILEGE, "H_PRIVILEGE"}, \
159 {H_PARAMETER, "H_PARAMETER"}, \
160 {H_BAD_MODE, "H_BAD_MODE"}, \
161 {H_PTEG_FULL, "H_PTEG_FULL"}, \
162 {H_NOT_FOUND, "H_NOT_FOUND"}, \
163 {H_RESERVED_DABR, "H_RESERVED_DABR"}, \
164 {H_NO_MEM, "H_NO_MEM"}, \
165 {H_AUTHORITY, "H_AUTHORITY"}, \
166 {H_PERMISSION, "H_PERMISSION"}, \
167 {H_DROPPED, "H_DROPPED"}, \
168 {H_SOURCE_PARM, "H_SOURCE_PARM"}, \
169 {H_DEST_PARM, "H_DEST_PARM"}, \
170 {H_REMOTE_PARM, "H_REMOTE_PARM"}, \
171 {H_RESOURCE, "H_RESOURCE"}, \
172 {H_ADAPTER_PARM, "H_ADAPTER_PARM"}, \
173 {H_RH_PARM, "H_RH_PARM"}, \
174 {H_RCQ_PARM, "H_RCQ_PARM"}, \
175 {H_SCQ_PARM, "H_SCQ_PARM"}, \
176 {H_EQ_PARM, "H_EQ_PARM"}, \
177 {H_RT_PARM, "H_RT_PARM"}, \
178 {H_ST_PARM, "H_ST_PARM"}, \
179 {H_SIGT_PARM, "H_SIGT_PARM"}, \
180 {H_TOKEN_PARM, "H_TOKEN_PARM"}, \
181 {H_MLENGTH_PARM, "H_MLENGTH_PARM"}, \
182 {H_MEM_PARM, "H_MEM_PARM"}, \
183 {H_MEM_ACCESS_PARM, "H_MEM_ACCESS_PARM"}, \
184 {H_ATTR_PARM, "H_ATTR_PARM"}, \
185 {H_PORT_PARM, "H_PORT_PARM"}, \
186 {H_MCG_PARM, "H_MCG_PARM"}, \
187 {H_VL_PARM, "H_VL_PARM"}, \
188 {H_TSIZE_PARM, "H_TSIZE_PARM"}, \
189 {H_TRACE_PARM, "H_TRACE_PARM"}, \
190 {H_MASK_PARM, "H_MASK_PARM"}, \
191 {H_MCG_FULL, "H_MCG_FULL"}, \
192 {H_ALIAS_EXIST, "H_ALIAS_EXIST"}, \
193 {H_P_COUNTER, "H_P_COUNTER"}, \
194 {H_TABLE_FULL, "H_TABLE_FULL"}, \
195 {H_ALT_TABLE, "H_ALT_TABLE"}, \
196 {H_MR_CONDITION, "H_MR_CONDITION"}, \
197 {H_NOT_ENOUGH_RESOURCES, "H_NOT_ENOUGH_RESOURCES"}, \
198 {H_R_STATE, "H_R_STATE"}, \
199 {H_RESCINDED, "H_RESCINDED"}, \
208 {H_TOO_BIG, "H_TOO_BIG"}, \
209 {H_OVERLAP, "H_OVERLAP"}, \
210 {H_INTERRUPT, "H_INTERRUPT"}, \
211 {H_BAD_DATA, "H_BAD_DATA"}, \
212 {H_NOT_ACTIVE, "H_NOT_ACTIVE"}, \
213 {H_SG_LIST, "H_SG_LIST"}, \
214 {H_OP_MODE, "H_OP_MODE"}, \
215 {H_COP_HW, "H_COP_HW"}, \
216 {H_UNSUPPORTED_FLAG_START, "H_UNSUPPORTED_FLAG_START"}, \
217 {H_UNSUPPORTED_FLAG_END, "H_UNSUPPORTED_FLAG_END"}, \
218 {H_MULTI_THREADS_ACTIVE, "H_MULTI_THREADS_ACTIVE"}, \
219 {H_OUTSTANDING_COP_OPS, "H_OUTSTANDING_COP_OPS"}
221 TRACE_EVENT(kvm_guest_enter
,
222 TP_PROTO(struct kvm_vcpu
*vcpu
),
226 __field(int, vcpu_id
)
227 __field(unsigned long, pc
)
228 __field(unsigned long, pending_exceptions
)
233 __entry
->vcpu_id
= vcpu
->vcpu_id
;
234 __entry
->pc
= kvmppc_get_pc(vcpu
);
235 __entry
->ceded
= vcpu
->arch
.ceded
;
236 __entry
->pending_exceptions
= vcpu
->arch
.pending_exceptions
;
239 TP_printk("VCPU %d: pc=0x%lx pexcp=0x%lx ceded=%d",
242 __entry
->pending_exceptions
, __entry
->ceded
)
245 TRACE_EVENT(kvm_guest_exit
,
246 TP_PROTO(struct kvm_vcpu
*vcpu
),
250 __field(int, vcpu_id
)
252 __field(unsigned long, pc
)
253 __field(unsigned long, msr
)
258 __entry
->vcpu_id
= vcpu
->vcpu_id
;
259 __entry
->trap
= vcpu
->arch
.trap
;
260 __entry
->ceded
= vcpu
->arch
.ceded
;
261 __entry
->pc
= kvmppc_get_pc(vcpu
);
262 __entry
->msr
= vcpu
->arch
.shregs
.msr
;
265 TP_printk("VCPU %d: trap=%s pc=0x%lx msr=0x%lx, ceded=%d",
267 __print_symbolic(__entry
->trap
, kvm_trace_symbol_exit
),
268 __entry
->pc
, __entry
->msr
, __entry
->ceded
272 TRACE_EVENT(kvm_page_fault_enter
,
273 TP_PROTO(struct kvm_vcpu
*vcpu
, unsigned long *hptep
,
274 struct kvm_memory_slot
*memslot
, unsigned long ea
,
275 unsigned long dsisr
),
277 TP_ARGS(vcpu
, hptep
, memslot
, ea
, dsisr
),
280 __field(int, vcpu_id
)
281 __field(unsigned long, hpte_v
)
282 __field(unsigned long, hpte_r
)
283 __field(unsigned long, gpte_r
)
284 __field(unsigned long, ea
)
285 __field(u64
, base_gfn
)
286 __field(u32
, slot_flags
)
291 __entry
->vcpu_id
= vcpu
->vcpu_id
;
292 __entry
->hpte_v
= hptep
[0];
293 __entry
->hpte_r
= hptep
[1];
294 __entry
->gpte_r
= hptep
[2];
296 __entry
->dsisr
= dsisr
;
297 __entry
->base_gfn
= memslot
? memslot
->base_gfn
: -1UL;
298 __entry
->slot_flags
= memslot
? memslot
->flags
: 0;
301 TP_printk("VCPU %d: hpte=0x%lx:0x%lx guest=0x%lx ea=0x%lx,%x slot=0x%llx,0x%x",
303 __entry
->hpte_v
, __entry
->hpte_r
, __entry
->gpte_r
,
304 __entry
->ea
, __entry
->dsisr
,
305 __entry
->base_gfn
, __entry
->slot_flags
)
308 TRACE_EVENT(kvm_page_fault_exit
,
309 TP_PROTO(struct kvm_vcpu
*vcpu
, unsigned long *hptep
, long ret
),
311 TP_ARGS(vcpu
, hptep
, ret
),
314 __field(int, vcpu_id
)
315 __field(unsigned long, hpte_v
)
316 __field(unsigned long, hpte_r
)
321 __entry
->vcpu_id
= vcpu
->vcpu_id
;
322 __entry
->hpte_v
= hptep
[0];
323 __entry
->hpte_r
= hptep
[1];
327 TP_printk("VCPU %d: hpte=0x%lx:0x%lx ret=0x%lx",
329 __entry
->hpte_v
, __entry
->hpte_r
, __entry
->ret
)
332 TRACE_EVENT(kvm_hcall_enter
,
333 TP_PROTO(struct kvm_vcpu
*vcpu
),
338 __field(int, vcpu_id
)
339 __field(unsigned long, req
)
340 __field(unsigned long, gpr4
)
341 __field(unsigned long, gpr5
)
342 __field(unsigned long, gpr6
)
343 __field(unsigned long, gpr7
)
347 __entry
->vcpu_id
= vcpu
->vcpu_id
;
348 __entry
->req
= kvmppc_get_gpr(vcpu
, 3);
349 __entry
->gpr4
= kvmppc_get_gpr(vcpu
, 4);
350 __entry
->gpr5
= kvmppc_get_gpr(vcpu
, 5);
351 __entry
->gpr6
= kvmppc_get_gpr(vcpu
, 6);
352 __entry
->gpr7
= kvmppc_get_gpr(vcpu
, 7);
355 TP_printk("VCPU %d: hcall=%s GPR4-7=0x%lx,0x%lx,0x%lx,0x%lx",
357 __print_symbolic(__entry
->req
, kvm_trace_symbol_hcall
),
358 __entry
->gpr4
, __entry
->gpr5
, __entry
->gpr6
, __entry
->gpr7
)
361 TRACE_EVENT(kvm_hcall_exit
,
362 TP_PROTO(struct kvm_vcpu
*vcpu
, int ret
),
367 __field(int, vcpu_id
)
368 __field(unsigned long, ret
)
369 __field(unsigned long, hcall_rc
)
373 __entry
->vcpu_id
= vcpu
->vcpu_id
;
375 __entry
->hcall_rc
= kvmppc_get_gpr(vcpu
, 3);
378 TP_printk("VCPU %d: ret=%s hcall_rc=%s",
380 __print_symbolic(__entry
->ret
, kvm_trace_symbol_kvmret
),
381 __print_symbolic(__entry
->ret
& RESUME_FLAG_HOST
?
382 H_TOO_HARD
: __entry
->hcall_rc
,
383 kvm_trace_symbol_hcall_rc
))
386 TRACE_EVENT(kvmppc_run_core
,
387 TP_PROTO(struct kvmppc_vcore
*vc
, int where
),
392 __field(int, n_runnable
)
393 __field(int, runner_vcpu
)
399 __entry
->runner_vcpu
= vc
->runner
->vcpu_id
;
400 __entry
->n_runnable
= vc
->n_runnable
;
401 __entry
->where
= where
;
402 __entry
->tgid
= current
->tgid
;
405 TP_printk("%s runner_vcpu==%d runnable=%d tgid=%d",
406 __entry
->where
? "Exit" : "Enter",
407 __entry
->runner_vcpu
, __entry
->n_runnable
, __entry
->tgid
)
410 TRACE_EVENT(kvmppc_vcore_blocked
,
411 TP_PROTO(struct kvmppc_vcore
*vc
, int where
),
416 __field(int, n_runnable
)
417 __field(int, runner_vcpu
)
423 __entry
->runner_vcpu
= vc
->runner
->vcpu_id
;
424 __entry
->n_runnable
= vc
->n_runnable
;
425 __entry
->where
= where
;
426 __entry
->tgid
= current
->tgid
;
429 TP_printk("%s runner_vcpu=%d runnable=%d tgid=%d",
430 __entry
->where
? "Exit" : "Enter",
431 __entry
->runner_vcpu
, __entry
->n_runnable
, __entry
->tgid
)
434 TRACE_EVENT(kvmppc_vcore_wakeup
,
435 TP_PROTO(int do_sleep
, __u64 ns
),
437 TP_ARGS(do_sleep
, ns
),
447 __entry
->waited
= do_sleep
;
448 __entry
->tgid
= current
->tgid
;
451 TP_printk("%s time %llu ns, tgid=%d",
452 __entry
->waited
? "wait" : "poll",
453 __entry
->ns
, __entry
->tgid
)
456 TRACE_EVENT(kvmppc_run_vcpu_enter
,
457 TP_PROTO(struct kvm_vcpu
*vcpu
),
462 __field(int, vcpu_id
)
467 __entry
->vcpu_id
= vcpu
->vcpu_id
;
468 __entry
->tgid
= current
->tgid
;
471 TP_printk("VCPU %d: tgid=%d", __entry
->vcpu_id
, __entry
->tgid
)
474 TRACE_EVENT(kvmppc_run_vcpu_exit
,
475 TP_PROTO(struct kvm_vcpu
*vcpu
, struct kvm_run
*run
),
480 __field(int, vcpu_id
)
486 __entry
->vcpu_id
= vcpu
->vcpu_id
;
487 __entry
->exit
= run
->exit_reason
;
488 __entry
->ret
= vcpu
->arch
.ret
;
491 TP_printk("VCPU %d: exit=%d, ret=%d",
492 __entry
->vcpu_id
, __entry
->exit
, __entry
->ret
)
495 #endif /* _TRACE_KVM_HV_H */
497 /* This part must be outside protection */
499 #undef TRACE_INCLUDE_PATH
500 #undef TRACE_INCLUDE_FILE
502 #define TRACE_INCLUDE_PATH .
503 #define TRACE_INCLUDE_FILE trace_hv
505 #include <trace/define_trace.h>