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