xref: /openbmc/linux/arch/powerpc/kvm/trace_booke.h (revision 276e552e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_TRACE_KVM_BOOKE_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define _TRACE_KVM_BOOKE_H
4 
5 #include <linux/tracepoint.h>
6 
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM kvm_booke
9 
10 #define kvm_trace_symbol_exit \
11 	{0, "CRITICAL"}, \
12 	{1, "MACHINE_CHECK"}, \
13 	{2, "DATA_STORAGE"}, \
14 	{3, "INST_STORAGE"}, \
15 	{4, "EXTERNAL"}, \
16 	{5, "ALIGNMENT"}, \
17 	{6, "PROGRAM"}, \
18 	{7, "FP_UNAVAIL"}, \
19 	{8, "SYSCALL"}, \
20 	{9, "AP_UNAVAIL"}, \
21 	{10, "DECREMENTER"}, \
22 	{11, "FIT"}, \
23 	{12, "WATCHDOG"}, \
24 	{13, "DTLB_MISS"}, \
25 	{14, "ITLB_MISS"}, \
26 	{15, "DEBUG"}, \
27 	{32, "SPE_UNAVAIL"}, \
28 	{33, "SPE_FP_DATA"}, \
29 	{34, "SPE_FP_ROUND"}, \
30 	{35, "PERFORMANCE_MONITOR"}, \
31 	{36, "DOORBELL"}, \
32 	{37, "DOORBELL_CRITICAL"}, \
33 	{38, "GUEST_DBELL"}, \
34 	{39, "GUEST_DBELL_CRIT"}, \
35 	{40, "HV_SYSCALL"}, \
36 	{41, "HV_PRIV"}
37 
38 TRACE_EVENT(kvm_exit,
39 	TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu),
40 	TP_ARGS(exit_nr, vcpu),
41 
42 	TP_STRUCT__entry(
43 		__field(	unsigned int,	exit_nr		)
44 		__field(	unsigned long,	pc		)
45 		__field(	unsigned long,	msr		)
46 		__field(	unsigned long,	dar		)
47 		__field(	unsigned long,	last_inst	)
48 	),
49 
50 	TP_fast_assign(
51 		__entry->exit_nr	= exit_nr;
52 		__entry->pc		= kvmppc_get_pc(vcpu);
53 		__entry->dar		= kvmppc_get_fault_dar(vcpu);
54 		__entry->msr		= vcpu->arch.shared->msr;
55 		__entry->last_inst	= vcpu->arch.last_inst;
56 	),
57 
58 	TP_printk("exit=%s"
59 		" | pc=0x%lx"
60 		" | msr=0x%lx"
61 		" | dar=0x%lx"
62 		" | last_inst=0x%lx"
63 		,
64 		__print_symbolic(__entry->exit_nr, kvm_trace_symbol_exit),
65 		__entry->pc,
66 		__entry->msr,
67 		__entry->dar,
68 		__entry->last_inst
69 		)
70 );
71 
72 TRACE_EVENT(kvm_booke206_stlb_write,
73 	TP_PROTO(__u32 mas0, __u32 mas8, __u32 mas1, __u64 mas2, __u64 mas7_3),
74 	TP_ARGS(mas0, mas8, mas1, mas2, mas7_3),
75 
76 	TP_STRUCT__entry(
77 		__field(	__u32,	mas0		)
78 		__field(	__u32,	mas8		)
79 		__field(	__u32,	mas1		)
80 		__field(	__u64,	mas2		)
81 		__field(	__u64,	mas7_3		)
82 	),
83 
84 	TP_fast_assign(
85 		__entry->mas0		= mas0;
86 		__entry->mas8		= mas8;
87 		__entry->mas1		= mas1;
88 		__entry->mas2		= mas2;
89 		__entry->mas7_3		= mas7_3;
90 	),
91 
92 	TP_printk("mas0=%x mas8=%x mas1=%x mas2=%llx mas7_3=%llx",
93 		__entry->mas0, __entry->mas8, __entry->mas1,
94 		__entry->mas2, __entry->mas7_3)
95 );
96 
97 TRACE_EVENT(kvm_booke206_gtlb_write,
98 	TP_PROTO(__u32 mas0, __u32 mas1, __u64 mas2, __u64 mas7_3),
99 	TP_ARGS(mas0, mas1, mas2, mas7_3),
100 
101 	TP_STRUCT__entry(
102 		__field(	__u32,	mas0		)
103 		__field(	__u32,	mas1		)
104 		__field(	__u64,	mas2		)
105 		__field(	__u64,	mas7_3		)
106 	),
107 
108 	TP_fast_assign(
109 		__entry->mas0		= mas0;
110 		__entry->mas1		= mas1;
111 		__entry->mas2		= mas2;
112 		__entry->mas7_3		= mas7_3;
113 	),
114 
115 	TP_printk("mas0=%x mas1=%x mas2=%llx mas7_3=%llx",
116 		__entry->mas0, __entry->mas1,
117 		__entry->mas2, __entry->mas7_3)
118 );
119 
120 TRACE_EVENT(kvm_booke206_ref_release,
121 	TP_PROTO(__u64 pfn, __u32 flags),
122 	TP_ARGS(pfn, flags),
123 
124 	TP_STRUCT__entry(
125 		__field(	__u64,	pfn		)
126 		__field(	__u32,	flags		)
127 	),
128 
129 	TP_fast_assign(
130 		__entry->pfn		= pfn;
131 		__entry->flags		= flags;
132 	),
133 
134 	TP_printk("pfn=%llx flags=%x",
135 		__entry->pfn, __entry->flags)
136 );
137 
138 #ifdef CONFIG_SPE_POSSIBLE
139 #define kvm_trace_symbol_irqprio_spe \
140 	{BOOKE_IRQPRIO_SPE_UNAVAIL, "SPE_UNAVAIL"}, \
141 	{BOOKE_IRQPRIO_SPE_FP_DATA, "SPE_FP_DATA"}, \
142 	{BOOKE_IRQPRIO_SPE_FP_ROUND, "SPE_FP_ROUND"},
143 #else
144 #define kvm_trace_symbol_irqprio_spe
145 #endif
146 
147 #ifdef CONFIG_PPC_E500MC
148 #define kvm_trace_symbol_irqprio_e500mc \
149 	{BOOKE_IRQPRIO_ALTIVEC_UNAVAIL, "ALTIVEC_UNAVAIL"}, \
150 	{BOOKE_IRQPRIO_ALTIVEC_ASSIST, "ALTIVEC_ASSIST"},
151 #else
152 #define kvm_trace_symbol_irqprio_e500mc
153 #endif
154 
155 #define kvm_trace_symbol_irqprio \
156 	kvm_trace_symbol_irqprio_spe \
157 	kvm_trace_symbol_irqprio_e500mc \
158 	{BOOKE_IRQPRIO_DATA_STORAGE, "DATA_STORAGE"}, \
159 	{BOOKE_IRQPRIO_INST_STORAGE, "INST_STORAGE"}, \
160 	{BOOKE_IRQPRIO_ALIGNMENT, "ALIGNMENT"}, \
161 	{BOOKE_IRQPRIO_PROGRAM, "PROGRAM"}, \
162 	{BOOKE_IRQPRIO_FP_UNAVAIL, "FP_UNAVAIL"}, \
163 	{BOOKE_IRQPRIO_SYSCALL, "SYSCALL"}, \
164 	{BOOKE_IRQPRIO_AP_UNAVAIL, "AP_UNAVAIL"}, \
165 	{BOOKE_IRQPRIO_DTLB_MISS, "DTLB_MISS"}, \
166 	{BOOKE_IRQPRIO_ITLB_MISS, "ITLB_MISS"}, \
167 	{BOOKE_IRQPRIO_MACHINE_CHECK, "MACHINE_CHECK"}, \
168 	{BOOKE_IRQPRIO_DEBUG, "DEBUG"}, \
169 	{BOOKE_IRQPRIO_CRITICAL, "CRITICAL"}, \
170 	{BOOKE_IRQPRIO_WATCHDOG, "WATCHDOG"}, \
171 	{BOOKE_IRQPRIO_EXTERNAL, "EXTERNAL"}, \
172 	{BOOKE_IRQPRIO_FIT, "FIT"}, \
173 	{BOOKE_IRQPRIO_DECREMENTER, "DECREMENTER"}, \
174 	{BOOKE_IRQPRIO_PERFORMANCE_MONITOR, "PERFORMANCE_MONITOR"}, \
175 	{BOOKE_IRQPRIO_EXTERNAL_LEVEL, "EXTERNAL_LEVEL"}, \
176 	{BOOKE_IRQPRIO_DBELL, "DBELL"}, \
177 	{BOOKE_IRQPRIO_DBELL_CRIT, "DBELL_CRIT"} \
178 
179 TRACE_EVENT(kvm_booke_queue_irqprio,
180 	TP_PROTO(struct kvm_vcpu *vcpu, unsigned int priority),
181 	TP_ARGS(vcpu, priority),
182 
183 	TP_STRUCT__entry(
184 		__field(	__u32,	cpu_nr		)
185 		__field(	__u32,	priority		)
186 		__field(	unsigned long,	pending		)
187 	),
188 
189 	TP_fast_assign(
190 		__entry->cpu_nr		= vcpu->vcpu_id;
191 		__entry->priority	= priority;
192 		__entry->pending	= vcpu->arch.pending_exceptions;
193 	),
194 
195 	TP_printk("vcpu=%x prio=%s pending=%lx",
196 		__entry->cpu_nr,
197 		__print_symbolic(__entry->priority, kvm_trace_symbol_irqprio),
198 		__entry->pending)
199 );
200 
201 #endif
202 
203 /* This part must be outside protection */
204 
205 #undef TRACE_INCLUDE_PATH
206 #undef TRACE_INCLUDE_FILE
207 
208 #define TRACE_INCLUDE_PATH .
209 #define TRACE_INCLUDE_FILE trace_booke
210 
211 #include <trace/define_trace.h>
212