xref: /linux/arch/mips/kvm/trace.h (revision e4de2057698636c0ee709e545d19b169d2069fa3)
1669e846eSSanjay Lal /*
2669e846eSSanjay Lal  * This file is subject to the terms and conditions of the GNU General Public
3669e846eSSanjay Lal  * License.  See the file "COPYING" in the main directory of this archive
4669e846eSSanjay Lal  * for more details.
5669e846eSSanjay Lal  *
6669e846eSSanjay Lal  * Copyright (C) 2012  MIPS Technologies, Inc.  All rights reserved.
7669e846eSSanjay Lal  * Authors: Sanjay Lal <sanjayl@kymasys.com>
8669e846eSSanjay Lal  */
9669e846eSSanjay Lal 
10669e846eSSanjay Lal #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
11669e846eSSanjay Lal #define _TRACE_KVM_H
12669e846eSSanjay Lal 
13669e846eSSanjay Lal #include <linux/tracepoint.h>
14669e846eSSanjay Lal 
15669e846eSSanjay Lal #undef TRACE_SYSTEM
16669e846eSSanjay Lal #define TRACE_SYSTEM kvm
17669e846eSSanjay Lal #define TRACE_INCLUDE_PATH .
18669e846eSSanjay Lal #define TRACE_INCLUDE_FILE trace
19669e846eSSanjay Lal 
2093258604SJames Hogan /*
21edec9d7bSJames Hogan  * arch/mips/kvm/mips.c
22edec9d7bSJames Hogan  */
23edec9d7bSJames Hogan extern bool kvm_trace_guest_mode_change;
24edec9d7bSJames Hogan int kvm_guest_mode_change_trace_reg(void);
25edec9d7bSJames Hogan void kvm_guest_mode_change_trace_unreg(void);
26edec9d7bSJames Hogan 
27edec9d7bSJames Hogan /*
2893258604SJames Hogan  * Tracepoints for VM enters
2993258604SJames Hogan  */
30fb6cec14SJames Hogan DECLARE_EVENT_CLASS(kvm_transition,
3193258604SJames Hogan 	TP_PROTO(struct kvm_vcpu *vcpu),
3293258604SJames Hogan 	TP_ARGS(vcpu),
3393258604SJames Hogan 	TP_STRUCT__entry(
3493258604SJames Hogan 		__field(unsigned long, pc)
3593258604SJames Hogan 	),
3693258604SJames Hogan 
3793258604SJames Hogan 	TP_fast_assign(
3893258604SJames Hogan 		__entry->pc = vcpu->arch.pc;
3993258604SJames Hogan 	),
4093258604SJames Hogan 
4193258604SJames Hogan 	TP_printk("PC: 0x%08lx",
4293258604SJames Hogan 		  __entry->pc)
4393258604SJames Hogan );
4493258604SJames Hogan 
45fb6cec14SJames Hogan DEFINE_EVENT(kvm_transition, kvm_enter,
4693258604SJames Hogan 	     TP_PROTO(struct kvm_vcpu *vcpu),
47fb6cec14SJames Hogan 	     TP_ARGS(vcpu));
4893258604SJames Hogan 
49fb6cec14SJames Hogan DEFINE_EVENT(kvm_transition, kvm_reenter,
5093258604SJames Hogan 	     TP_PROTO(struct kvm_vcpu *vcpu),
51fb6cec14SJames Hogan 	     TP_ARGS(vcpu));
5293258604SJames Hogan 
53fb6cec14SJames Hogan DEFINE_EVENT(kvm_transition, kvm_out,
54fb6cec14SJames Hogan 	     TP_PROTO(struct kvm_vcpu *vcpu),
55fb6cec14SJames Hogan 	     TP_ARGS(vcpu));
5693258604SJames Hogan 
571e09e86aSJames Hogan /* The first 32 exit reasons correspond to Cause.ExcCode */
581e09e86aSJames Hogan #define KVM_TRACE_EXIT_INT		 0
591e09e86aSJames Hogan #define KVM_TRACE_EXIT_TLBMOD		 1
601e09e86aSJames Hogan #define KVM_TRACE_EXIT_TLBMISS_LD	 2
611e09e86aSJames Hogan #define KVM_TRACE_EXIT_TLBMISS_ST	 3
621e09e86aSJames Hogan #define KVM_TRACE_EXIT_ADDRERR_LD	 4
631e09e86aSJames Hogan #define KVM_TRACE_EXIT_ADDRERR_ST	 5
641e09e86aSJames Hogan #define KVM_TRACE_EXIT_SYSCALL		 8
651e09e86aSJames Hogan #define KVM_TRACE_EXIT_BREAK_INST	 9
661e09e86aSJames Hogan #define KVM_TRACE_EXIT_RESVD_INST	10
671e09e86aSJames Hogan #define KVM_TRACE_EXIT_COP_UNUSABLE	11
681e09e86aSJames Hogan #define KVM_TRACE_EXIT_TRAP_INST	13
691e09e86aSJames Hogan #define KVM_TRACE_EXIT_MSA_FPE		14
701e09e86aSJames Hogan #define KVM_TRACE_EXIT_FPE		15
711e09e86aSJames Hogan #define KVM_TRACE_EXIT_MSA_DISABLED	21
7228c1e762SJames Hogan #define KVM_TRACE_EXIT_GUEST_EXIT	27
731e09e86aSJames Hogan /* Further exit reasons */
741e09e86aSJames Hogan #define KVM_TRACE_EXIT_WAIT		32
751e09e86aSJames Hogan #define KVM_TRACE_EXIT_CACHE		33
761e09e86aSJames Hogan #define KVM_TRACE_EXIT_SIGNAL		34
77a7244920SJames Hogan /* 32 exit reasons correspond to GuestCtl0.GExcCode (VZ) */
78a7244920SJames Hogan #define KVM_TRACE_EXIT_GEXCCODE_BASE	64
79a7244920SJames Hogan #define KVM_TRACE_EXIT_GPSI		64	/*  0 */
80a7244920SJames Hogan #define KVM_TRACE_EXIT_GSFC		65	/*  1 */
81a7244920SJames Hogan #define KVM_TRACE_EXIT_HC		66	/*  2 */
82a7244920SJames Hogan #define KVM_TRACE_EXIT_GRR		67	/*  3 */
83a7244920SJames Hogan #define KVM_TRACE_EXIT_GVA		72	/*  8 */
84a7244920SJames Hogan #define KVM_TRACE_EXIT_GHFC		73	/*  9 */
85a7244920SJames Hogan #define KVM_TRACE_EXIT_GPA		74	/* 10 */
861e09e86aSJames Hogan 
871e09e86aSJames Hogan /* Tracepoints for VM exits */
881e09e86aSJames Hogan #define kvm_trace_symbol_exit_types				\
891e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_INT,		"Interrupt" },		\
901e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_TLBMOD,	"TLB Mod" },		\
911e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_TLBMISS_LD,	"TLB Miss (LD)" },	\
921e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_TLBMISS_ST,	"TLB Miss (ST)" },	\
931e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_ADDRERR_LD,	"Address Error (LD)" },	\
941e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_ADDRERR_ST,	"Address Err (ST)" },	\
951e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_SYSCALL,	"System Call" },	\
961e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_BREAK_INST,	"Break Inst" },		\
971e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_RESVD_INST,	"Reserved Inst" },	\
981e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_COP_UNUSABLE,	"COP0/1 Unusable" },	\
991e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_TRAP_INST,	"Trap Inst" },		\
1001e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_MSA_FPE,	"MSA FPE" },		\
1011e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_FPE,		"FPE" },		\
1021e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_MSA_DISABLED,	"MSA Disabled" },	\
10328c1e762SJames Hogan 	{ KVM_TRACE_EXIT_GUEST_EXIT,	"Guest Exit" },		\
1041e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_WAIT,		"WAIT" },		\
1051e09e86aSJames Hogan 	{ KVM_TRACE_EXIT_CACHE,		"CACHE" },		\
106a7244920SJames Hogan 	{ KVM_TRACE_EXIT_SIGNAL,	"Signal" },		\
107a7244920SJames Hogan 	{ KVM_TRACE_EXIT_GPSI,		"GPSI" },		\
108a7244920SJames Hogan 	{ KVM_TRACE_EXIT_GSFC,		"GSFC" },		\
109a7244920SJames Hogan 	{ KVM_TRACE_EXIT_HC,		"HC" },			\
110a7244920SJames Hogan 	{ KVM_TRACE_EXIT_GRR,		"GRR" },		\
111a7244920SJames Hogan 	{ KVM_TRACE_EXIT_GVA,		"GVA" },		\
112a7244920SJames Hogan 	{ KVM_TRACE_EXIT_GHFC,		"GHFC" },		\
113a7244920SJames Hogan 	{ KVM_TRACE_EXIT_GPA,		"GPA" }
114669e846eSSanjay Lal 
115669e846eSSanjay Lal TRACE_EVENT(kvm_exit,
116669e846eSSanjay Lal 	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
117669e846eSSanjay Lal 	    TP_ARGS(vcpu, reason),
118669e846eSSanjay Lal 	    TP_STRUCT__entry(
119b3cffac0SJames Hogan 			__field(unsigned long, pc)
120669e846eSSanjay Lal 			__field(unsigned int, reason)
121669e846eSSanjay Lal 	    ),
122669e846eSSanjay Lal 
123669e846eSSanjay Lal 	    TP_fast_assign(
124b3cffac0SJames Hogan 			__entry->pc = vcpu->arch.pc;
125669e846eSSanjay Lal 			__entry->reason = reason;
126669e846eSSanjay Lal 	    ),
127669e846eSSanjay Lal 
128669e846eSSanjay Lal 	    TP_printk("[%s]PC: 0x%08lx",
1291e09e86aSJames Hogan 		      __print_symbolic(__entry->reason,
1301e09e86aSJames Hogan 				       kvm_trace_symbol_exit_types),
131b3cffac0SJames Hogan 		      __entry->pc)
132669e846eSSanjay Lal );
133669e846eSSanjay Lal 
1346398da13SJames Hogan #define KVM_TRACE_MFC0		0
1356398da13SJames Hogan #define KVM_TRACE_MTC0		1
1366398da13SJames Hogan #define KVM_TRACE_DMFC0		2
1376398da13SJames Hogan #define KVM_TRACE_DMTC0		3
1386398da13SJames Hogan #define KVM_TRACE_RDHWR		4
1396398da13SJames Hogan 
1406398da13SJames Hogan #define KVM_TRACE_HWR_COP0	0
1416398da13SJames Hogan #define KVM_TRACE_HWR_HWR	1
1426398da13SJames Hogan 
1436398da13SJames Hogan #define KVM_TRACE_COP0(REG, SEL)	((KVM_TRACE_HWR_COP0 << 8) |	\
1446398da13SJames Hogan 					 ((REG) << 3) | (SEL))
1456398da13SJames Hogan #define KVM_TRACE_HWR(REG, SEL)		((KVM_TRACE_HWR_HWR  << 8) |	\
1466398da13SJames Hogan 					 ((REG) << 3) | (SEL))
1476398da13SJames Hogan 
1486398da13SJames Hogan #define kvm_trace_symbol_hwr_ops				\
1496398da13SJames Hogan 	{ KVM_TRACE_MFC0,		"MFC0" },		\
1506398da13SJames Hogan 	{ KVM_TRACE_MTC0,		"MTC0" },		\
1516398da13SJames Hogan 	{ KVM_TRACE_DMFC0,		"DMFC0" },		\
1526398da13SJames Hogan 	{ KVM_TRACE_DMTC0,		"DMTC0" },		\
1536398da13SJames Hogan 	{ KVM_TRACE_RDHWR,		"RDHWR" }
1546398da13SJames Hogan 
1556398da13SJames Hogan #define kvm_trace_symbol_hwr_cop				\
1566398da13SJames Hogan 	{ KVM_TRACE_HWR_COP0,		"COP0" },		\
1576398da13SJames Hogan 	{ KVM_TRACE_HWR_HWR,		"HWR" }
1586398da13SJames Hogan 
1596398da13SJames Hogan #define kvm_trace_symbol_hwr_regs				\
1606398da13SJames Hogan 	{ KVM_TRACE_COP0( 0, 0),	"Index" },		\
1616398da13SJames Hogan 	{ KVM_TRACE_COP0( 2, 0),	"EntryLo0" },		\
1626398da13SJames Hogan 	{ KVM_TRACE_COP0( 3, 0),	"EntryLo1" },		\
1636398da13SJames Hogan 	{ KVM_TRACE_COP0( 4, 0),	"Context" },		\
1646398da13SJames Hogan 	{ KVM_TRACE_COP0( 4, 2),	"UserLocal" },		\
1656398da13SJames Hogan 	{ KVM_TRACE_COP0( 5, 0),	"PageMask" },		\
1666398da13SJames Hogan 	{ KVM_TRACE_COP0( 6, 0),	"Wired" },		\
1676398da13SJames Hogan 	{ KVM_TRACE_COP0( 7, 0),	"HWREna" },		\
1686398da13SJames Hogan 	{ KVM_TRACE_COP0( 8, 0),	"BadVAddr" },		\
1696398da13SJames Hogan 	{ KVM_TRACE_COP0( 9, 0),	"Count" },		\
1706398da13SJames Hogan 	{ KVM_TRACE_COP0(10, 0),	"EntryHi" },		\
1716398da13SJames Hogan 	{ KVM_TRACE_COP0(11, 0),	"Compare" },		\
1726398da13SJames Hogan 	{ KVM_TRACE_COP0(12, 0),	"Status" },		\
1736398da13SJames Hogan 	{ KVM_TRACE_COP0(12, 1),	"IntCtl" },		\
1746398da13SJames Hogan 	{ KVM_TRACE_COP0(12, 2),	"SRSCtl" },		\
1756398da13SJames Hogan 	{ KVM_TRACE_COP0(13, 0),	"Cause" },		\
1766398da13SJames Hogan 	{ KVM_TRACE_COP0(14, 0),	"EPC" },		\
1776398da13SJames Hogan 	{ KVM_TRACE_COP0(15, 0),	"PRId" },		\
1786398da13SJames Hogan 	{ KVM_TRACE_COP0(15, 1),	"EBase" },		\
1796398da13SJames Hogan 	{ KVM_TRACE_COP0(16, 0),	"Config" },		\
1806398da13SJames Hogan 	{ KVM_TRACE_COP0(16, 1),	"Config1" },		\
1816398da13SJames Hogan 	{ KVM_TRACE_COP0(16, 2),	"Config2" },		\
1826398da13SJames Hogan 	{ KVM_TRACE_COP0(16, 3),	"Config3" },		\
1836398da13SJames Hogan 	{ KVM_TRACE_COP0(16, 4),	"Config4" },		\
1846398da13SJames Hogan 	{ KVM_TRACE_COP0(16, 5),	"Config5" },		\
1856398da13SJames Hogan 	{ KVM_TRACE_COP0(16, 7),	"Config7" },		\
186d42a008fSJames Hogan 	{ KVM_TRACE_COP0(17, 1),	"MAAR" },		\
187d42a008fSJames Hogan 	{ KVM_TRACE_COP0(17, 2),	"MAARI" },		\
1886398da13SJames Hogan 	{ KVM_TRACE_COP0(26, 0),	"ECC" },		\
1896398da13SJames Hogan 	{ KVM_TRACE_COP0(30, 0),	"ErrorEPC" },		\
19005108709SJames Hogan 	{ KVM_TRACE_COP0(31, 2),	"KScratch1" },		\
19105108709SJames Hogan 	{ KVM_TRACE_COP0(31, 3),	"KScratch2" },		\
19205108709SJames Hogan 	{ KVM_TRACE_COP0(31, 4),	"KScratch3" },		\
19305108709SJames Hogan 	{ KVM_TRACE_COP0(31, 5),	"KScratch4" },		\
19405108709SJames Hogan 	{ KVM_TRACE_COP0(31, 6),	"KScratch5" },		\
19505108709SJames Hogan 	{ KVM_TRACE_COP0(31, 7),	"KScratch6" },		\
1966398da13SJames Hogan 	{ KVM_TRACE_HWR( 0, 0),		"CPUNum" },		\
1976398da13SJames Hogan 	{ KVM_TRACE_HWR( 1, 0),		"SYNCI_Step" },		\
1986398da13SJames Hogan 	{ KVM_TRACE_HWR( 2, 0),		"CC" },			\
1996398da13SJames Hogan 	{ KVM_TRACE_HWR( 3, 0),		"CCRes" },		\
2006398da13SJames Hogan 	{ KVM_TRACE_HWR(29, 0),		"ULR" }
2016398da13SJames Hogan 
2026398da13SJames Hogan TRACE_EVENT(kvm_hwr,
2036398da13SJames Hogan 	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int op, unsigned int reg,
2046398da13SJames Hogan 		     unsigned long val),
2056398da13SJames Hogan 	    TP_ARGS(vcpu, op, reg, val),
2066398da13SJames Hogan 	    TP_STRUCT__entry(
2076398da13SJames Hogan 			__field(unsigned long, val)
2086398da13SJames Hogan 			__field(u16, reg)
2096398da13SJames Hogan 			__field(u8, op)
2106398da13SJames Hogan 	    ),
2116398da13SJames Hogan 
2126398da13SJames Hogan 	    TP_fast_assign(
2136398da13SJames Hogan 			__entry->val = val;
2146398da13SJames Hogan 			__entry->reg = reg;
2156398da13SJames Hogan 			__entry->op = op;
2166398da13SJames Hogan 	    ),
2176398da13SJames Hogan 
2186398da13SJames Hogan 	    TP_printk("%s %s (%s:%u:%u) 0x%08lx",
2196398da13SJames Hogan 		      __print_symbolic(__entry->op,
2206398da13SJames Hogan 				       kvm_trace_symbol_hwr_ops),
2216398da13SJames Hogan 		      __print_symbolic(__entry->reg,
2226398da13SJames Hogan 				       kvm_trace_symbol_hwr_regs),
2236398da13SJames Hogan 		      __print_symbolic(__entry->reg >> 8,
2246398da13SJames Hogan 				       kvm_trace_symbol_hwr_cop),
2256398da13SJames Hogan 		      (__entry->reg >> 3) & 0x1f,
2266398da13SJames Hogan 		      __entry->reg & 0x7,
2276398da13SJames Hogan 		      __entry->val)
2286398da13SJames Hogan );
2296398da13SJames Hogan 
23004ebebf4SJames Hogan #define KVM_TRACE_AUX_RESTORE		0
23104ebebf4SJames Hogan #define KVM_TRACE_AUX_SAVE		1
23204ebebf4SJames Hogan #define KVM_TRACE_AUX_ENABLE		2
23304ebebf4SJames Hogan #define KVM_TRACE_AUX_DISABLE		3
23404ebebf4SJames Hogan #define KVM_TRACE_AUX_DISCARD		4
23504ebebf4SJames Hogan 
23604ebebf4SJames Hogan #define KVM_TRACE_AUX_FPU		1
23704ebebf4SJames Hogan #define KVM_TRACE_AUX_MSA		2
23804ebebf4SJames Hogan #define KVM_TRACE_AUX_FPU_MSA		3
23904ebebf4SJames Hogan 
24004ebebf4SJames Hogan #define kvm_trace_symbol_aux_op		\
24104ebebf4SJames Hogan 	{ KVM_TRACE_AUX_RESTORE, "restore" },	\
24204ebebf4SJames Hogan 	{ KVM_TRACE_AUX_SAVE,    "save" },	\
24304ebebf4SJames Hogan 	{ KVM_TRACE_AUX_ENABLE,  "enable" },	\
24404ebebf4SJames Hogan 	{ KVM_TRACE_AUX_DISABLE, "disable" },	\
24504ebebf4SJames Hogan 	{ KVM_TRACE_AUX_DISCARD, "discard" }
24604ebebf4SJames Hogan 
24704ebebf4SJames Hogan #define kvm_trace_symbol_aux_state		\
24804ebebf4SJames Hogan 	{ KVM_TRACE_AUX_FPU,     "FPU" },	\
24904ebebf4SJames Hogan 	{ KVM_TRACE_AUX_MSA,     "MSA" },	\
25004ebebf4SJames Hogan 	{ KVM_TRACE_AUX_FPU_MSA, "FPU & MSA" }
25104ebebf4SJames Hogan 
25204ebebf4SJames Hogan TRACE_EVENT(kvm_aux,
25304ebebf4SJames Hogan 	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int op,
25404ebebf4SJames Hogan 		     unsigned int state),
25504ebebf4SJames Hogan 	    TP_ARGS(vcpu, op, state),
25604ebebf4SJames Hogan 	    TP_STRUCT__entry(
25704ebebf4SJames Hogan 			__field(unsigned long, pc)
25804ebebf4SJames Hogan 			__field(u8, op)
25904ebebf4SJames Hogan 			__field(u8, state)
26004ebebf4SJames Hogan 	    ),
26104ebebf4SJames Hogan 
26204ebebf4SJames Hogan 	    TP_fast_assign(
26304ebebf4SJames Hogan 			__entry->pc = vcpu->arch.pc;
26404ebebf4SJames Hogan 			__entry->op = op;
26504ebebf4SJames Hogan 			__entry->state = state;
26604ebebf4SJames Hogan 	    ),
26704ebebf4SJames Hogan 
26804ebebf4SJames Hogan 	    TP_printk("%s %s PC: 0x%08lx",
26904ebebf4SJames Hogan 		      __print_symbolic(__entry->op,
27004ebebf4SJames Hogan 				       kvm_trace_symbol_aux_op),
27104ebebf4SJames Hogan 		      __print_symbolic(__entry->state,
27204ebebf4SJames Hogan 				       kvm_trace_symbol_aux_state),
27304ebebf4SJames Hogan 		      __entry->pc)
27404ebebf4SJames Hogan );
27504ebebf4SJames Hogan 
2769887d1c7SJames Hogan TRACE_EVENT(kvm_asid_change,
2779887d1c7SJames Hogan 	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int old_asid,
2789887d1c7SJames Hogan 		     unsigned int new_asid),
2799887d1c7SJames Hogan 	    TP_ARGS(vcpu, old_asid, new_asid),
2809887d1c7SJames Hogan 	    TP_STRUCT__entry(
2819887d1c7SJames Hogan 			__field(unsigned long, pc)
2829887d1c7SJames Hogan 			__field(u8, old_asid)
2839887d1c7SJames Hogan 			__field(u8, new_asid)
2849887d1c7SJames Hogan 	    ),
2859887d1c7SJames Hogan 
2869887d1c7SJames Hogan 	    TP_fast_assign(
2879887d1c7SJames Hogan 			__entry->pc = vcpu->arch.pc;
2889887d1c7SJames Hogan 			__entry->old_asid = old_asid;
2899887d1c7SJames Hogan 			__entry->new_asid = new_asid;
2909887d1c7SJames Hogan 	    ),
2919887d1c7SJames Hogan 
2929887d1c7SJames Hogan 	    TP_printk("PC: 0x%08lx old: 0x%02x new: 0x%02x",
2939887d1c7SJames Hogan 		      __entry->pc,
2949887d1c7SJames Hogan 		      __entry->old_asid,
2959887d1c7SJames Hogan 		      __entry->new_asid)
2969887d1c7SJames Hogan );
2979887d1c7SJames Hogan 
298c992a4f6SJames Hogan TRACE_EVENT(kvm_guestid_change,
299c992a4f6SJames Hogan 	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int guestid),
300c992a4f6SJames Hogan 	    TP_ARGS(vcpu, guestid),
301c992a4f6SJames Hogan 	    TP_STRUCT__entry(
302c992a4f6SJames Hogan 			__field(unsigned int, guestid)
303c992a4f6SJames Hogan 	    ),
304c992a4f6SJames Hogan 
305c992a4f6SJames Hogan 	    TP_fast_assign(
306c992a4f6SJames Hogan 			__entry->guestid = guestid;
307c992a4f6SJames Hogan 	    ),
308c992a4f6SJames Hogan 
309c992a4f6SJames Hogan 	    TP_printk("GuestID: 0x%02x",
310c992a4f6SJames Hogan 		      __entry->guestid)
311c992a4f6SJames Hogan );
312c992a4f6SJames Hogan 
313edec9d7bSJames Hogan TRACE_EVENT_FN(kvm_guest_mode_change,
314edec9d7bSJames Hogan 	    TP_PROTO(struct kvm_vcpu *vcpu),
315edec9d7bSJames Hogan 	    TP_ARGS(vcpu),
316edec9d7bSJames Hogan 	    TP_STRUCT__entry(
317edec9d7bSJames Hogan 			__field(unsigned long, epc)
318edec9d7bSJames Hogan 			__field(unsigned long, pc)
319edec9d7bSJames Hogan 			__field(unsigned long, badvaddr)
320edec9d7bSJames Hogan 			__field(unsigned int, status)
321edec9d7bSJames Hogan 			__field(unsigned int, cause)
322edec9d7bSJames Hogan 	    ),
323edec9d7bSJames Hogan 
324edec9d7bSJames Hogan 	    TP_fast_assign(
325*e4de2057SHuacai Chen 			__entry->epc = kvm_read_c0_guest_epc(&vcpu->arch.cop0);
326edec9d7bSJames Hogan 			__entry->pc = vcpu->arch.pc;
327*e4de2057SHuacai Chen 			__entry->badvaddr = kvm_read_c0_guest_badvaddr(&vcpu->arch.cop0);
328*e4de2057SHuacai Chen 			__entry->status = kvm_read_c0_guest_status(&vcpu->arch.cop0);
329*e4de2057SHuacai Chen 			__entry->cause = kvm_read_c0_guest_cause(&vcpu->arch.cop0);
330edec9d7bSJames Hogan 	    ),
331edec9d7bSJames Hogan 
332edec9d7bSJames Hogan 	    TP_printk("EPC: 0x%08lx PC: 0x%08lx Status: 0x%08x Cause: 0x%08x BadVAddr: 0x%08lx",
333edec9d7bSJames Hogan 		      __entry->epc,
334edec9d7bSJames Hogan 		      __entry->pc,
335edec9d7bSJames Hogan 		      __entry->status,
336edec9d7bSJames Hogan 		      __entry->cause,
337edec9d7bSJames Hogan 		      __entry->badvaddr),
338edec9d7bSJames Hogan 
339edec9d7bSJames Hogan 	    kvm_guest_mode_change_trace_reg,
340edec9d7bSJames Hogan 	    kvm_guest_mode_change_trace_unreg
341edec9d7bSJames Hogan );
342edec9d7bSJames Hogan 
343669e846eSSanjay Lal #endif /* _TRACE_KVM_H */
344669e846eSSanjay Lal 
345669e846eSSanjay Lal /* This part must be outside protection */
346669e846eSSanjay Lal #include <trace/define_trace.h>
347