ARM: dts: at91: Enable DMA on sama5d2_xplained console
[firefly-linux-kernel-4.4.55.git] / arch / arm / kvm / trace.h
1 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _TRACE_KVM_H
3
4 #include <linux/tracepoint.h>
5
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM kvm
8
9 /*
10  * Tracepoints for entry/exit to guest
11  */
12 TRACE_EVENT(kvm_entry,
13         TP_PROTO(unsigned long vcpu_pc),
14         TP_ARGS(vcpu_pc),
15
16         TP_STRUCT__entry(
17                 __field(        unsigned long,  vcpu_pc         )
18         ),
19
20         TP_fast_assign(
21                 __entry->vcpu_pc                = vcpu_pc;
22         ),
23
24         TP_printk("PC: 0x%08lx", __entry->vcpu_pc)
25 );
26
27 TRACE_EVENT(kvm_exit,
28         TP_PROTO(int idx, unsigned int exit_reason, unsigned long vcpu_pc),
29         TP_ARGS(idx, exit_reason, vcpu_pc),
30
31         TP_STRUCT__entry(
32                 __field(        int,            idx             )
33                 __field(        unsigned int,   exit_reason     )
34                 __field(        unsigned long,  vcpu_pc         )
35         ),
36
37         TP_fast_assign(
38                 __entry->idx                    = idx;
39                 __entry->exit_reason            = exit_reason;
40                 __entry->vcpu_pc                = vcpu_pc;
41         ),
42
43         TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx",
44                   __print_symbolic(__entry->idx, kvm_arm_exception_type),
45                   __entry->exit_reason,
46                   __print_symbolic(__entry->exit_reason, kvm_arm_exception_class),
47                   __entry->vcpu_pc)
48 );
49
50 TRACE_EVENT(kvm_guest_fault,
51         TP_PROTO(unsigned long vcpu_pc, unsigned long hsr,
52                  unsigned long hxfar,
53                  unsigned long long ipa),
54         TP_ARGS(vcpu_pc, hsr, hxfar, ipa),
55
56         TP_STRUCT__entry(
57                 __field(        unsigned long,  vcpu_pc         )
58                 __field(        unsigned long,  hsr             )
59                 __field(        unsigned long,  hxfar           )
60                 __field(   unsigned long long,  ipa             )
61         ),
62
63         TP_fast_assign(
64                 __entry->vcpu_pc                = vcpu_pc;
65                 __entry->hsr                    = hsr;
66                 __entry->hxfar                  = hxfar;
67                 __entry->ipa                    = ipa;
68         ),
69
70         TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx",
71                   __entry->ipa, __entry->hsr,
72                   __entry->hxfar, __entry->vcpu_pc)
73 );
74
75 TRACE_EVENT(kvm_access_fault,
76         TP_PROTO(unsigned long ipa),
77         TP_ARGS(ipa),
78
79         TP_STRUCT__entry(
80                 __field(        unsigned long,  ipa             )
81         ),
82
83         TP_fast_assign(
84                 __entry->ipa            = ipa;
85         ),
86
87         TP_printk("IPA: %lx", __entry->ipa)
88 );
89
90 TRACE_EVENT(kvm_irq_line,
91         TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level),
92         TP_ARGS(type, vcpu_idx, irq_num, level),
93
94         TP_STRUCT__entry(
95                 __field(        unsigned int,   type            )
96                 __field(        int,            vcpu_idx        )
97                 __field(        int,            irq_num         )
98                 __field(        int,            level           )
99         ),
100
101         TP_fast_assign(
102                 __entry->type           = type;
103                 __entry->vcpu_idx       = vcpu_idx;
104                 __entry->irq_num        = irq_num;
105                 __entry->level          = level;
106         ),
107
108         TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d",
109                   (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ? "CPU" :
110                   (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ? "VGIC PPI" :
111                   (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ? "VGIC SPI" : "UNKNOWN",
112                   __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level)
113 );
114
115 TRACE_EVENT(kvm_mmio_emulate,
116         TP_PROTO(unsigned long vcpu_pc, unsigned long instr,
117                  unsigned long cpsr),
118         TP_ARGS(vcpu_pc, instr, cpsr),
119
120         TP_STRUCT__entry(
121                 __field(        unsigned long,  vcpu_pc         )
122                 __field(        unsigned long,  instr           )
123                 __field(        unsigned long,  cpsr            )
124         ),
125
126         TP_fast_assign(
127                 __entry->vcpu_pc                = vcpu_pc;
128                 __entry->instr                  = instr;
129                 __entry->cpsr                   = cpsr;
130         ),
131
132         TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)",
133                   __entry->vcpu_pc, __entry->instr, __entry->cpsr)
134 );
135
136 /* Architecturally implementation defined CP15 register access */
137 TRACE_EVENT(kvm_emulate_cp15_imp,
138         TP_PROTO(unsigned long Op1, unsigned long Rt1, unsigned long CRn,
139                  unsigned long CRm, unsigned long Op2, bool is_write),
140         TP_ARGS(Op1, Rt1, CRn, CRm, Op2, is_write),
141
142         TP_STRUCT__entry(
143                 __field(        unsigned int,   Op1             )
144                 __field(        unsigned int,   Rt1             )
145                 __field(        unsigned int,   CRn             )
146                 __field(        unsigned int,   CRm             )
147                 __field(        unsigned int,   Op2             )
148                 __field(        bool,           is_write        )
149         ),
150
151         TP_fast_assign(
152                 __entry->is_write               = is_write;
153                 __entry->Op1                    = Op1;
154                 __entry->Rt1                    = Rt1;
155                 __entry->CRn                    = CRn;
156                 __entry->CRm                    = CRm;
157                 __entry->Op2                    = Op2;
158         ),
159
160         TP_printk("Implementation defined CP15: %s\tp15, %u, r%u, c%u, c%u, %u",
161                         (__entry->is_write) ? "mcr" : "mrc",
162                         __entry->Op1, __entry->Rt1, __entry->CRn,
163                         __entry->CRm, __entry->Op2)
164 );
165
166 TRACE_EVENT(kvm_wfx,
167         TP_PROTO(unsigned long vcpu_pc, bool is_wfe),
168         TP_ARGS(vcpu_pc, is_wfe),
169
170         TP_STRUCT__entry(
171                 __field(        unsigned long,  vcpu_pc         )
172                 __field(                 bool,  is_wfe          )
173         ),
174
175         TP_fast_assign(
176                 __entry->vcpu_pc                = vcpu_pc;
177                 __entry->is_wfe                 = is_wfe;
178         ),
179
180         TP_printk("guest executed wf%c at: 0x%08lx",
181                 __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc)
182 );
183
184 TRACE_EVENT(kvm_unmap_hva,
185         TP_PROTO(unsigned long hva),
186         TP_ARGS(hva),
187
188         TP_STRUCT__entry(
189                 __field(        unsigned long,  hva             )
190         ),
191
192         TP_fast_assign(
193                 __entry->hva            = hva;
194         ),
195
196         TP_printk("mmu notifier unmap hva: %#08lx", __entry->hva)
197 );
198
199 TRACE_EVENT(kvm_unmap_hva_range,
200         TP_PROTO(unsigned long start, unsigned long end),
201         TP_ARGS(start, end),
202
203         TP_STRUCT__entry(
204                 __field(        unsigned long,  start           )
205                 __field(        unsigned long,  end             )
206         ),
207
208         TP_fast_assign(
209                 __entry->start          = start;
210                 __entry->end            = end;
211         ),
212
213         TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
214                   __entry->start, __entry->end)
215 );
216
217 TRACE_EVENT(kvm_set_spte_hva,
218         TP_PROTO(unsigned long hva),
219         TP_ARGS(hva),
220
221         TP_STRUCT__entry(
222                 __field(        unsigned long,  hva             )
223         ),
224
225         TP_fast_assign(
226                 __entry->hva            = hva;
227         ),
228
229         TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva)
230 );
231
232 TRACE_EVENT(kvm_age_hva,
233         TP_PROTO(unsigned long start, unsigned long end),
234         TP_ARGS(start, end),
235
236         TP_STRUCT__entry(
237                 __field(        unsigned long,  start           )
238                 __field(        unsigned long,  end             )
239         ),
240
241         TP_fast_assign(
242                 __entry->start          = start;
243                 __entry->end            = end;
244         ),
245
246         TP_printk("mmu notifier age hva: %#08lx -- %#08lx",
247                   __entry->start, __entry->end)
248 );
249
250 TRACE_EVENT(kvm_test_age_hva,
251         TP_PROTO(unsigned long hva),
252         TP_ARGS(hva),
253
254         TP_STRUCT__entry(
255                 __field(        unsigned long,  hva             )
256         ),
257
258         TP_fast_assign(
259                 __entry->hva            = hva;
260         ),
261
262         TP_printk("mmu notifier test age hva: %#08lx", __entry->hva)
263 );
264
265 TRACE_EVENT(kvm_hvc,
266         TP_PROTO(unsigned long vcpu_pc, unsigned long r0, unsigned long imm),
267         TP_ARGS(vcpu_pc, r0, imm),
268
269         TP_STRUCT__entry(
270                 __field(        unsigned long,  vcpu_pc         )
271                 __field(        unsigned long,  r0              )
272                 __field(        unsigned long,  imm             )
273         ),
274
275         TP_fast_assign(
276                 __entry->vcpu_pc                = vcpu_pc;
277                 __entry->r0             = r0;
278                 __entry->imm            = imm;
279         ),
280
281         TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx",
282                   __entry->vcpu_pc, __entry->r0, __entry->imm)
283 );
284
285 TRACE_EVENT(kvm_set_way_flush,
286             TP_PROTO(unsigned long vcpu_pc, bool cache),
287             TP_ARGS(vcpu_pc, cache),
288
289             TP_STRUCT__entry(
290                     __field(    unsigned long,  vcpu_pc         )
291                     __field(    bool,           cache           )
292             ),
293
294             TP_fast_assign(
295                     __entry->vcpu_pc            = vcpu_pc;
296                     __entry->cache              = cache;
297             ),
298
299             TP_printk("S/W flush at 0x%016lx (cache %s)",
300                       __entry->vcpu_pc, __entry->cache ? "on" : "off")
301 );
302
303 TRACE_EVENT(kvm_toggle_cache,
304             TP_PROTO(unsigned long vcpu_pc, bool was, bool now),
305             TP_ARGS(vcpu_pc, was, now),
306
307             TP_STRUCT__entry(
308                     __field(    unsigned long,  vcpu_pc         )
309                     __field(    bool,           was             )
310                     __field(    bool,           now             )
311             ),
312
313             TP_fast_assign(
314                     __entry->vcpu_pc            = vcpu_pc;
315                     __entry->was                = was;
316                     __entry->now                = now;
317             ),
318
319             TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
320                       __entry->vcpu_pc, __entry->was ? "on" : "off",
321                       __entry->now ? "on" : "off")
322 );
323
324 #endif /* _TRACE_KVM_H */
325
326 #undef TRACE_INCLUDE_PATH
327 #define TRACE_INCLUDE_PATH arch/arm/kvm
328 #undef TRACE_INCLUDE_FILE
329 #define TRACE_INCLUDE_FILE trace
330
331 /* This part must be outside protection */
332 #include <trace/define_trace.h>