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