Merge tag 'char-misc-3.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregk...
[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(unsigned long vcpu_pc),
29         TP_ARGS(vcpu_pc),
30
31         TP_STRUCT__entry(
32                 __field(        unsigned long,  vcpu_pc         )
33         ),
34
35         TP_fast_assign(
36                 __entry->vcpu_pc                = vcpu_pc;
37         ),
38
39         TP_printk("PC: 0x%08lx", __entry->vcpu_pc)
40 );
41
42 TRACE_EVENT(kvm_guest_fault,
43         TP_PROTO(unsigned long vcpu_pc, unsigned long hsr,
44                  unsigned long hxfar,
45                  unsigned long long ipa),
46         TP_ARGS(vcpu_pc, hsr, hxfar, ipa),
47
48         TP_STRUCT__entry(
49                 __field(        unsigned long,  vcpu_pc         )
50                 __field(        unsigned long,  hsr             )
51                 __field(        unsigned long,  hxfar           )
52                 __field(   unsigned long long,  ipa             )
53         ),
54
55         TP_fast_assign(
56                 __entry->vcpu_pc                = vcpu_pc;
57                 __entry->hsr                    = hsr;
58                 __entry->hxfar                  = hxfar;
59                 __entry->ipa                    = ipa;
60         ),
61
62         TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx",
63                   __entry->ipa, __entry->hsr,
64                   __entry->hxfar, __entry->vcpu_pc)
65 );
66
67 TRACE_EVENT(kvm_irq_line,
68         TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level),
69         TP_ARGS(type, vcpu_idx, irq_num, level),
70
71         TP_STRUCT__entry(
72                 __field(        unsigned int,   type            )
73                 __field(        int,            vcpu_idx        )
74                 __field(        int,            irq_num         )
75                 __field(        int,            level           )
76         ),
77
78         TP_fast_assign(
79                 __entry->type           = type;
80                 __entry->vcpu_idx       = vcpu_idx;
81                 __entry->irq_num        = irq_num;
82                 __entry->level          = level;
83         ),
84
85         TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d",
86                   (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ? "CPU" :
87                   (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ? "VGIC PPI" :
88                   (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ? "VGIC SPI" : "UNKNOWN",
89                   __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level)
90 );
91
92 TRACE_EVENT(kvm_mmio_emulate,
93         TP_PROTO(unsigned long vcpu_pc, unsigned long instr,
94                  unsigned long cpsr),
95         TP_ARGS(vcpu_pc, instr, cpsr),
96
97         TP_STRUCT__entry(
98                 __field(        unsigned long,  vcpu_pc         )
99                 __field(        unsigned long,  instr           )
100                 __field(        unsigned long,  cpsr            )
101         ),
102
103         TP_fast_assign(
104                 __entry->vcpu_pc                = vcpu_pc;
105                 __entry->instr                  = instr;
106                 __entry->cpsr                   = cpsr;
107         ),
108
109         TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)",
110                   __entry->vcpu_pc, __entry->instr, __entry->cpsr)
111 );
112
113 /* Architecturally implementation defined CP15 register access */
114 TRACE_EVENT(kvm_emulate_cp15_imp,
115         TP_PROTO(unsigned long Op1, unsigned long Rt1, unsigned long CRn,
116                  unsigned long CRm, unsigned long Op2, bool is_write),
117         TP_ARGS(Op1, Rt1, CRn, CRm, Op2, is_write),
118
119         TP_STRUCT__entry(
120                 __field(        unsigned int,   Op1             )
121                 __field(        unsigned int,   Rt1             )
122                 __field(        unsigned int,   CRn             )
123                 __field(        unsigned int,   CRm             )
124                 __field(        unsigned int,   Op2             )
125                 __field(        bool,           is_write        )
126         ),
127
128         TP_fast_assign(
129                 __entry->is_write               = is_write;
130                 __entry->Op1                    = Op1;
131                 __entry->Rt1                    = Rt1;
132                 __entry->CRn                    = CRn;
133                 __entry->CRm                    = CRm;
134                 __entry->Op2                    = Op2;
135         ),
136
137         TP_printk("Implementation defined CP15: %s\tp15, %u, r%u, c%u, c%u, %u",
138                         (__entry->is_write) ? "mcr" : "mrc",
139                         __entry->Op1, __entry->Rt1, __entry->CRn,
140                         __entry->CRm, __entry->Op2)
141 );
142
143 TRACE_EVENT(kvm_wfi,
144         TP_PROTO(unsigned long vcpu_pc),
145         TP_ARGS(vcpu_pc),
146
147         TP_STRUCT__entry(
148                 __field(        unsigned long,  vcpu_pc         )
149         ),
150
151         TP_fast_assign(
152                 __entry->vcpu_pc                = vcpu_pc;
153         ),
154
155         TP_printk("guest executed wfi at: 0x%08lx", __entry->vcpu_pc)
156 );
157
158 TRACE_EVENT(kvm_unmap_hva,
159         TP_PROTO(unsigned long hva),
160         TP_ARGS(hva),
161
162         TP_STRUCT__entry(
163                 __field(        unsigned long,  hva             )
164         ),
165
166         TP_fast_assign(
167                 __entry->hva            = hva;
168         ),
169
170         TP_printk("mmu notifier unmap hva: %#08lx", __entry->hva)
171 );
172
173 TRACE_EVENT(kvm_unmap_hva_range,
174         TP_PROTO(unsigned long start, unsigned long end),
175         TP_ARGS(start, end),
176
177         TP_STRUCT__entry(
178                 __field(        unsigned long,  start           )
179                 __field(        unsigned long,  end             )
180         ),
181
182         TP_fast_assign(
183                 __entry->start          = start;
184                 __entry->end            = end;
185         ),
186
187         TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
188                   __entry->start, __entry->end)
189 );
190
191 TRACE_EVENT(kvm_set_spte_hva,
192         TP_PROTO(unsigned long hva),
193         TP_ARGS(hva),
194
195         TP_STRUCT__entry(
196                 __field(        unsigned long,  hva             )
197         ),
198
199         TP_fast_assign(
200                 __entry->hva            = hva;
201         ),
202
203         TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva)
204 );
205
206 TRACE_EVENT(kvm_hvc,
207         TP_PROTO(unsigned long vcpu_pc, unsigned long r0, unsigned long imm),
208         TP_ARGS(vcpu_pc, r0, imm),
209
210         TP_STRUCT__entry(
211                 __field(        unsigned long,  vcpu_pc         )
212                 __field(        unsigned long,  r0              )
213                 __field(        unsigned long,  imm             )
214         ),
215
216         TP_fast_assign(
217                 __entry->vcpu_pc                = vcpu_pc;
218                 __entry->r0             = r0;
219                 __entry->imm            = imm;
220         ),
221
222         TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx",
223                   __entry->vcpu_pc, __entry->r0, __entry->imm)
224 );
225
226 TRACE_EVENT(kvm_set_way_flush,
227             TP_PROTO(unsigned long vcpu_pc, bool cache),
228             TP_ARGS(vcpu_pc, cache),
229
230             TP_STRUCT__entry(
231                     __field(    unsigned long,  vcpu_pc         )
232                     __field(    bool,           cache           )
233             ),
234
235             TP_fast_assign(
236                     __entry->vcpu_pc            = vcpu_pc;
237                     __entry->cache              = cache;
238             ),
239
240             TP_printk("S/W flush at 0x%016lx (cache %s)",
241                       __entry->vcpu_pc, __entry->cache ? "on" : "off")
242 );
243
244 TRACE_EVENT(kvm_toggle_cache,
245             TP_PROTO(unsigned long vcpu_pc, bool was, bool now),
246             TP_ARGS(vcpu_pc, was, now),
247
248             TP_STRUCT__entry(
249                     __field(    unsigned long,  vcpu_pc         )
250                     __field(    bool,           was             )
251                     __field(    bool,           now             )
252             ),
253
254             TP_fast_assign(
255                     __entry->vcpu_pc            = vcpu_pc;
256                     __entry->was                = was;
257                     __entry->now                = now;
258             ),
259
260             TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
261                       __entry->vcpu_pc, __entry->was ? "on" : "off",
262                       __entry->now ? "on" : "off")
263 );
264
265 #endif /* _TRACE_KVM_H */
266
267 #undef TRACE_INCLUDE_PATH
268 #define TRACE_INCLUDE_PATH arch/arm/kvm
269 #undef TRACE_INCLUDE_FILE
270 #define TRACE_INCLUDE_FILE trace
271
272 /* This part must be outside protection */
273 #include <trace/define_trace.h>