Linux Audio

Check our new training course

Loading...
v6.8
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
  3#define _TRACE_KVM_H
  4
  5#include <linux/tracepoint.h>
  6
  7#undef TRACE_SYSTEM
  8#define TRACE_SYSTEM kvm
 
 
  9
 10/*
 11 * Tracepoint for guest mode entry.
 12 */
 13TRACE_EVENT(kvm_ppc_instr,
 14	TP_PROTO(unsigned int inst, unsigned long _pc, unsigned int emulate),
 15	TP_ARGS(inst, _pc, emulate),
 16
 17	TP_STRUCT__entry(
 18		__field(	unsigned int,	inst		)
 19		__field(	unsigned long,	pc		)
 20		__field(	unsigned int,	emulate		)
 21	),
 22
 23	TP_fast_assign(
 24		__entry->inst		= inst;
 25		__entry->pc		= _pc;
 26		__entry->emulate	= emulate;
 27	),
 28
 29	TP_printk("inst %u pc 0x%lx emulate %u\n",
 30		  __entry->inst, __entry->pc, __entry->emulate)
 31);
 32
 33TRACE_EVENT(kvm_stlb_inval,
 34	TP_PROTO(unsigned int stlb_index),
 35	TP_ARGS(stlb_index),
 36
 37	TP_STRUCT__entry(
 38		__field(	unsigned int,	stlb_index	)
 39	),
 40
 41	TP_fast_assign(
 42		__entry->stlb_index	= stlb_index;
 43	),
 44
 45	TP_printk("stlb_index %u", __entry->stlb_index)
 46);
 47
 48TRACE_EVENT(kvm_stlb_write,
 49	TP_PROTO(unsigned int victim, unsigned int tid, unsigned int word0,
 50		 unsigned int word1, unsigned int word2),
 51	TP_ARGS(victim, tid, word0, word1, word2),
 52
 53	TP_STRUCT__entry(
 54		__field(	unsigned int,	victim		)
 55		__field(	unsigned int,	tid		)
 56		__field(	unsigned int,	word0		)
 57		__field(	unsigned int,	word1		)
 58		__field(	unsigned int,	word2		)
 59	),
 60
 61	TP_fast_assign(
 62		__entry->victim		= victim;
 63		__entry->tid		= tid;
 64		__entry->word0		= word0;
 65		__entry->word1		= word1;
 66		__entry->word2		= word2;
 67	),
 68
 69	TP_printk("victim %u tid %u w0 %u w1 %u w2 %u",
 70		__entry->victim, __entry->tid, __entry->word0,
 71		__entry->word1, __entry->word2)
 72);
 73
 74TRACE_EVENT(kvm_gtlb_write,
 75	TP_PROTO(unsigned int gtlb_index, unsigned int tid, unsigned int word0,
 76		 unsigned int word1, unsigned int word2),
 77	TP_ARGS(gtlb_index, tid, word0, word1, word2),
 78
 79	TP_STRUCT__entry(
 80		__field(	unsigned int,	gtlb_index	)
 81		__field(	unsigned int,	tid		)
 82		__field(	unsigned int,	word0		)
 83		__field(	unsigned int,	word1		)
 84		__field(	unsigned int,	word2		)
 85	),
 86
 87	TP_fast_assign(
 88		__entry->gtlb_index	= gtlb_index;
 89		__entry->tid		= tid;
 90		__entry->word0		= word0;
 91		__entry->word1		= word1;
 92		__entry->word2		= word2;
 93	),
 94
 95	TP_printk("gtlb_index %u tid %u w0 %u w1 %u w2 %u",
 96		__entry->gtlb_index, __entry->tid, __entry->word0,
 97		__entry->word1, __entry->word2)
 98);
 99
100TRACE_EVENT(kvm_check_requests,
101	TP_PROTO(struct kvm_vcpu *vcpu),
102	TP_ARGS(vcpu),
 
 
 
 
 
 
 
103
104	TP_STRUCT__entry(
105		__field(	__u32,	cpu_nr		)
106		__field(	__u32,	requests	)
 
 
 
107	),
108
109	TP_fast_assign(
110		__entry->cpu_nr		= vcpu->vcpu_id;
111		__entry->requests	= vcpu->requests;
 
 
 
 
 
 
112	),
113
114	TP_printk("vcpu=%x requests=%x",
115		__entry->cpu_nr, __entry->requests)
 
116);
117
118#endif /* _TRACE_KVM_H */
 
 
119
120/* This part must be outside protection */
121#undef TRACE_INCLUDE_PATH
122#undef TRACE_INCLUDE_FILE
 
123
124#define TRACE_INCLUDE_PATH .
125#define TRACE_INCLUDE_FILE trace
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127#include <trace/define_trace.h>
v3.5.6
 
  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#define TRACE_INCLUDE_PATH .
  9#define TRACE_INCLUDE_FILE trace
 10
 11/*
 12 * Tracepoint for guest mode entry.
 13 */
 14TRACE_EVENT(kvm_ppc_instr,
 15	TP_PROTO(unsigned int inst, unsigned long _pc, unsigned int emulate),
 16	TP_ARGS(inst, _pc, emulate),
 17
 18	TP_STRUCT__entry(
 19		__field(	unsigned int,	inst		)
 20		__field(	unsigned long,	pc		)
 21		__field(	unsigned int,	emulate		)
 22	),
 23
 24	TP_fast_assign(
 25		__entry->inst		= inst;
 26		__entry->pc		= _pc;
 27		__entry->emulate	= emulate;
 28	),
 29
 30	TP_printk("inst %u pc 0x%lx emulate %u\n",
 31		  __entry->inst, __entry->pc, __entry->emulate)
 32);
 33
 34TRACE_EVENT(kvm_stlb_inval,
 35	TP_PROTO(unsigned int stlb_index),
 36	TP_ARGS(stlb_index),
 37
 38	TP_STRUCT__entry(
 39		__field(	unsigned int,	stlb_index	)
 40	),
 41
 42	TP_fast_assign(
 43		__entry->stlb_index	= stlb_index;
 44	),
 45
 46	TP_printk("stlb_index %u", __entry->stlb_index)
 47);
 48
 49TRACE_EVENT(kvm_stlb_write,
 50	TP_PROTO(unsigned int victim, unsigned int tid, unsigned int word0,
 51		 unsigned int word1, unsigned int word2),
 52	TP_ARGS(victim, tid, word0, word1, word2),
 53
 54	TP_STRUCT__entry(
 55		__field(	unsigned int,	victim		)
 56		__field(	unsigned int,	tid		)
 57		__field(	unsigned int,	word0		)
 58		__field(	unsigned int,	word1		)
 59		__field(	unsigned int,	word2		)
 60	),
 61
 62	TP_fast_assign(
 63		__entry->victim		= victim;
 64		__entry->tid		= tid;
 65		__entry->word0		= word0;
 66		__entry->word1		= word1;
 67		__entry->word2		= word2;
 68	),
 69
 70	TP_printk("victim %u tid %u w0 %u w1 %u w2 %u",
 71		__entry->victim, __entry->tid, __entry->word0,
 72		__entry->word1, __entry->word2)
 73);
 74
 75TRACE_EVENT(kvm_gtlb_write,
 76	TP_PROTO(unsigned int gtlb_index, unsigned int tid, unsigned int word0,
 77		 unsigned int word1, unsigned int word2),
 78	TP_ARGS(gtlb_index, tid, word0, word1, word2),
 79
 80	TP_STRUCT__entry(
 81		__field(	unsigned int,	gtlb_index	)
 82		__field(	unsigned int,	tid		)
 83		__field(	unsigned int,	word0		)
 84		__field(	unsigned int,	word1		)
 85		__field(	unsigned int,	word2		)
 86	),
 87
 88	TP_fast_assign(
 89		__entry->gtlb_index	= gtlb_index;
 90		__entry->tid		= tid;
 91		__entry->word0		= word0;
 92		__entry->word1		= word1;
 93		__entry->word2		= word2;
 94	),
 95
 96	TP_printk("gtlb_index %u tid %u w0 %u w1 %u w2 %u",
 97		__entry->gtlb_index, __entry->tid, __entry->word0,
 98		__entry->word1, __entry->word2)
 99);
100
101
102/*************************************************************************
103 *                         Book3S trace points                           *
104 *************************************************************************/
105
106#ifdef CONFIG_KVM_BOOK3S_PR
107
108TRACE_EVENT(kvm_book3s_exit,
109	TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu),
110	TP_ARGS(exit_nr, vcpu),
111
112	TP_STRUCT__entry(
113		__field(	unsigned int,	exit_nr		)
114		__field(	unsigned long,	pc		)
115		__field(	unsigned long,	msr		)
116		__field(	unsigned long,	dar		)
117		__field(	unsigned long,	srr1		)
118	),
119
120	TP_fast_assign(
121		struct kvmppc_book3s_shadow_vcpu *svcpu;
122		__entry->exit_nr	= exit_nr;
123		__entry->pc		= kvmppc_get_pc(vcpu);
124		__entry->dar		= kvmppc_get_fault_dar(vcpu);
125		__entry->msr		= vcpu->arch.shared->msr;
126		svcpu = svcpu_get(vcpu);
127		__entry->srr1		= svcpu->shadow_srr1;
128		svcpu_put(svcpu);
129	),
130
131	TP_printk("exit=0x%x | pc=0x%lx | msr=0x%lx | dar=0x%lx | srr1=0x%lx",
132		  __entry->exit_nr, __entry->pc, __entry->msr, __entry->dar,
133		  __entry->srr1)
134);
135
136TRACE_EVENT(kvm_book3s_reenter,
137	TP_PROTO(int r, struct kvm_vcpu *vcpu),
138	TP_ARGS(r, vcpu),
139
140	TP_STRUCT__entry(
141		__field(	unsigned int,	r		)
142		__field(	unsigned long,	pc		)
143	),
144
145	TP_fast_assign(
146		__entry->r		= r;
147		__entry->pc		= kvmppc_get_pc(vcpu);
148	),
149
150	TP_printk("reentry r=%d | pc=0x%lx", __entry->r, __entry->pc)
151);
152
153#ifdef CONFIG_PPC_BOOK3S_64
154
155TRACE_EVENT(kvm_book3s_64_mmu_map,
156	TP_PROTO(int rflags, ulong hpteg, ulong va, pfn_t hpaddr,
157		 struct kvmppc_pte *orig_pte),
158	TP_ARGS(rflags, hpteg, va, hpaddr, orig_pte),
159
160	TP_STRUCT__entry(
161		__field(	unsigned char,		flag_w		)
162		__field(	unsigned char,		flag_x		)
163		__field(	unsigned long,		eaddr		)
164		__field(	unsigned long,		hpteg		)
165		__field(	unsigned long,		va		)
166		__field(	unsigned long long,	vpage		)
167		__field(	unsigned long,		hpaddr		)
168	),
169
170	TP_fast_assign(
171		__entry->flag_w	= ((rflags & HPTE_R_PP) == 3) ? '-' : 'w';
172		__entry->flag_x	= (rflags & HPTE_R_N) ? '-' : 'x';
173		__entry->eaddr	= orig_pte->eaddr;
174		__entry->hpteg	= hpteg;
175		__entry->va	= va;
176		__entry->vpage	= orig_pte->vpage;
177		__entry->hpaddr	= hpaddr;
178	),
179
180	TP_printk("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx",
181		  __entry->flag_w, __entry->flag_x, __entry->eaddr,
182		  __entry->hpteg, __entry->va, __entry->vpage, __entry->hpaddr)
183);
184
185#endif /* CONFIG_PPC_BOOK3S_64 */
186
187TRACE_EVENT(kvm_book3s_mmu_map,
188	TP_PROTO(struct hpte_cache *pte),
189	TP_ARGS(pte),
190
191	TP_STRUCT__entry(
192		__field(	u64,		host_va		)
193		__field(	u64,		pfn		)
194		__field(	ulong,		eaddr		)
195		__field(	u64,		vpage		)
196		__field(	ulong,		raddr		)
197		__field(	int,		flags		)
198	),
199
200	TP_fast_assign(
201		__entry->host_va	= pte->host_va;
202		__entry->pfn		= pte->pfn;
203		__entry->eaddr		= pte->pte.eaddr;
204		__entry->vpage		= pte->pte.vpage;
205		__entry->raddr		= pte->pte.raddr;
206		__entry->flags		= (pte->pte.may_read ? 0x4 : 0) |
207					  (pte->pte.may_write ? 0x2 : 0) |
208					  (pte->pte.may_execute ? 0x1 : 0);
209	),
210
211	TP_printk("Map: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
212		  __entry->host_va, __entry->pfn, __entry->eaddr,
213		  __entry->vpage, __entry->raddr, __entry->flags)
214);
215
216TRACE_EVENT(kvm_book3s_mmu_invalidate,
217	TP_PROTO(struct hpte_cache *pte),
218	TP_ARGS(pte),
219
220	TP_STRUCT__entry(
221		__field(	u64,		host_va		)
222		__field(	u64,		pfn		)
223		__field(	ulong,		eaddr		)
224		__field(	u64,		vpage		)
225		__field(	ulong,		raddr		)
226		__field(	int,		flags		)
227	),
228
229	TP_fast_assign(
230		__entry->host_va	= pte->host_va;
231		__entry->pfn		= pte->pfn;
232		__entry->eaddr		= pte->pte.eaddr;
233		__entry->vpage		= pte->pte.vpage;
234		__entry->raddr		= pte->pte.raddr;
235		__entry->flags		= (pte->pte.may_read ? 0x4 : 0) |
236					  (pte->pte.may_write ? 0x2 : 0) |
237					  (pte->pte.may_execute ? 0x1 : 0);
238	),
239
240	TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
241		  __entry->host_va, __entry->pfn, __entry->eaddr,
242		  __entry->vpage, __entry->raddr, __entry->flags)
243);
244
245TRACE_EVENT(kvm_book3s_mmu_flush,
246	TP_PROTO(const char *type, struct kvm_vcpu *vcpu, unsigned long long p1,
247		 unsigned long long p2),
248	TP_ARGS(type, vcpu, p1, p2),
249
250	TP_STRUCT__entry(
251		__field(	int,			count		)
252		__field(	unsigned long long,	p1		)
253		__field(	unsigned long long,	p2		)
254		__field(	const char *,		type		)
255	),
256
257	TP_fast_assign(
258		__entry->count		= to_book3s(vcpu)->hpte_cache_count;
259		__entry->p1		= p1;
260		__entry->p2		= p2;
261		__entry->type		= type;
262	),
263
264	TP_printk("Flush %d %sPTEs: %llx - %llx",
265		  __entry->count, __entry->type, __entry->p1, __entry->p2)
266);
267
268TRACE_EVENT(kvm_book3s_slb_found,
269	TP_PROTO(unsigned long long gvsid, unsigned long long hvsid),
270	TP_ARGS(gvsid, hvsid),
271
272	TP_STRUCT__entry(
273		__field(	unsigned long long,	gvsid		)
274		__field(	unsigned long long,	hvsid		)
275	),
276
277	TP_fast_assign(
278		__entry->gvsid		= gvsid;
279		__entry->hvsid		= hvsid;
280	),
281
282	TP_printk("%llx -> %llx", __entry->gvsid, __entry->hvsid)
283);
284
285TRACE_EVENT(kvm_book3s_slb_fail,
286	TP_PROTO(u16 sid_map_mask, unsigned long long gvsid),
287	TP_ARGS(sid_map_mask, gvsid),
288
289	TP_STRUCT__entry(
290		__field(	unsigned short,		sid_map_mask	)
291		__field(	unsigned long long,	gvsid		)
292	),
293
294	TP_fast_assign(
295		__entry->sid_map_mask	= sid_map_mask;
296		__entry->gvsid		= gvsid;
297	),
298
299	TP_printk("%x/%x: %llx", __entry->sid_map_mask,
300		  SID_MAP_MASK - __entry->sid_map_mask, __entry->gvsid)
301);
302
303TRACE_EVENT(kvm_book3s_slb_map,
304	TP_PROTO(u16 sid_map_mask, unsigned long long gvsid,
305		 unsigned long long hvsid),
306	TP_ARGS(sid_map_mask, gvsid, hvsid),
307
308	TP_STRUCT__entry(
309		__field(	unsigned short,		sid_map_mask	)
310		__field(	unsigned long long,	guest_vsid	)
311		__field(	unsigned long long,	host_vsid	)
312	),
313
314	TP_fast_assign(
315		__entry->sid_map_mask	= sid_map_mask;
316		__entry->guest_vsid	= gvsid;
317		__entry->host_vsid	= hvsid;
318	),
319
320	TP_printk("%x: %llx -> %llx", __entry->sid_map_mask,
321		  __entry->guest_vsid, __entry->host_vsid)
322);
323
324TRACE_EVENT(kvm_book3s_slbmte,
325	TP_PROTO(u64 slb_vsid, u64 slb_esid),
326	TP_ARGS(slb_vsid, slb_esid),
327
328	TP_STRUCT__entry(
329		__field(	u64,	slb_vsid	)
330		__field(	u64,	slb_esid	)
331	),
332
333	TP_fast_assign(
334		__entry->slb_vsid	= slb_vsid;
335		__entry->slb_esid	= slb_esid;
336	),
337
338	TP_printk("%llx, %llx", __entry->slb_vsid, __entry->slb_esid)
339);
340
341#endif /* CONFIG_PPC_BOOK3S */
342
343
344/*************************************************************************
345 *                         Book3E trace points                           *
346 *************************************************************************/
347
348#ifdef CONFIG_BOOKE
349
350TRACE_EVENT(kvm_booke206_stlb_write,
351	TP_PROTO(__u32 mas0, __u32 mas8, __u32 mas1, __u64 mas2, __u64 mas7_3),
352	TP_ARGS(mas0, mas8, mas1, mas2, mas7_3),
353
354	TP_STRUCT__entry(
355		__field(	__u32,	mas0		)
356		__field(	__u32,	mas8		)
357		__field(	__u32,	mas1		)
358		__field(	__u64,	mas2		)
359		__field(	__u64,	mas7_3		)
360	),
361
362	TP_fast_assign(
363		__entry->mas0		= mas0;
364		__entry->mas8		= mas8;
365		__entry->mas1		= mas1;
366		__entry->mas2		= mas2;
367		__entry->mas7_3		= mas7_3;
368	),
369
370	TP_printk("mas0=%x mas8=%x mas1=%x mas2=%llx mas7_3=%llx",
371		__entry->mas0, __entry->mas8, __entry->mas1,
372		__entry->mas2, __entry->mas7_3)
373);
374
375TRACE_EVENT(kvm_booke206_gtlb_write,
376	TP_PROTO(__u32 mas0, __u32 mas1, __u64 mas2, __u64 mas7_3),
377	TP_ARGS(mas0, mas1, mas2, mas7_3),
378
379	TP_STRUCT__entry(
380		__field(	__u32,	mas0		)
381		__field(	__u32,	mas1		)
382		__field(	__u64,	mas2		)
383		__field(	__u64,	mas7_3		)
384	),
385
386	TP_fast_assign(
387		__entry->mas0		= mas0;
388		__entry->mas1		= mas1;
389		__entry->mas2		= mas2;
390		__entry->mas7_3		= mas7_3;
391	),
392
393	TP_printk("mas0=%x mas1=%x mas2=%llx mas7_3=%llx",
394		__entry->mas0, __entry->mas1,
395		__entry->mas2, __entry->mas7_3)
396);
397
398#endif
399
400#endif /* _TRACE_KVM_H */
401
402/* This part must be outside protection */
403#include <trace/define_trace.h>