Merge tag 'trace-assign-str-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / arch / powerpc / include / asm / trace.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1bf4af16
AB
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM powerpc
4
5#if !defined(_TRACE_POWERPC_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_POWERPC_H
7
8#include <linux/tracepoint.h>
9
10struct pt_regs;
11
d136e273 12DECLARE_EVENT_CLASS(ppc64_interrupt_class,
1bf4af16
AB
13
14 TP_PROTO(struct pt_regs *regs),
15
16 TP_ARGS(regs),
17
18 TP_STRUCT__entry(
19 __field(struct pt_regs *, regs)
20 ),
21
22 TP_fast_assign(
23 __entry->regs = regs;
24 ),
25
26 TP_printk("pt_regs=%p", __entry->regs)
27);
28
d136e273 29DEFINE_EVENT(ppc64_interrupt_class, irq_entry,
1bf4af16
AB
30
31 TP_PROTO(struct pt_regs *regs),
32
d136e273 33 TP_ARGS(regs)
1bf4af16
AB
34);
35
d136e273 36DEFINE_EVENT(ppc64_interrupt_class, irq_exit,
6795b85c
AB
37
38 TP_PROTO(struct pt_regs *regs),
39
d136e273 40 TP_ARGS(regs)
6795b85c
AB
41);
42
d136e273 43DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_entry,
6795b85c
AB
44
45 TP_PROTO(struct pt_regs *regs),
46
d136e273
AB
47 TP_ARGS(regs)
48);
6795b85c 49
d136e273 50DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_exit,
6795b85c 51
d136e273 52 TP_PROTO(struct pt_regs *regs),
6795b85c 53
d136e273 54 TP_ARGS(regs)
6795b85c
AB
55);
56
5b2a1529
AB
57#ifdef CONFIG_PPC_DOORBELL
58DEFINE_EVENT(ppc64_interrupt_class, doorbell_entry,
59
60 TP_PROTO(struct pt_regs *regs),
61
62 TP_ARGS(regs)
63);
64
65DEFINE_EVENT(ppc64_interrupt_class, doorbell_exit,
66
67 TP_PROTO(struct pt_regs *regs),
68
69 TP_ARGS(regs)
70);
71#endif
72
c8cd093a 73#ifdef CONFIG_PPC_PSERIES
8cf868af 74extern int hcall_tracepoint_regfunc(void);
c8cd093a
AB
75extern void hcall_tracepoint_unregfunc(void);
76
126df08c 77TRACE_EVENT_FN_COND(hcall_entry,
c8cd093a 78
6f26353c 79 TP_PROTO(unsigned long opcode, unsigned long *args),
c8cd093a 80
6f26353c 81 TP_ARGS(opcode, args),
c8cd093a 82
126df08c
DK
83 TP_CONDITION(cpu_online(raw_smp_processor_id())),
84
c8cd093a
AB
85 TP_STRUCT__entry(
86 __field(unsigned long, opcode)
87 ),
88
89 TP_fast_assign(
90 __entry->opcode = opcode;
91 ),
92
93 TP_printk("opcode=%lu", __entry->opcode),
94
95 hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
96);
97
126df08c 98TRACE_EVENT_FN_COND(hcall_exit,
c8cd093a 99
8f2133cc 100 TP_PROTO(unsigned long opcode, long retval, unsigned long *retbuf),
c8cd093a 101
6f26353c 102 TP_ARGS(opcode, retval, retbuf),
c8cd093a 103
126df08c
DK
104 TP_CONDITION(cpu_online(raw_smp_processor_id())),
105
c8cd093a
AB
106 TP_STRUCT__entry(
107 __field(unsigned long, opcode)
8f2133cc 108 __field(long, retval)
c8cd093a
AB
109 ),
110
111 TP_fast_assign(
112 __entry->opcode = opcode;
113 __entry->retval = retval;
114 ),
115
8f2133cc 116 TP_printk("opcode=%lu retval=%ld", __entry->opcode, __entry->retval),
c8cd093a
AB
117
118 hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
119);
120#endif
121
2c81ca7f
NL
122#ifdef CONFIG_PPC_RTAS
123
124#include <asm/rtas-types.h>
125
126TRACE_EVENT(rtas_input,
127
128 TP_PROTO(struct rtas_args *rtas_args, const char *name),
129
130 TP_ARGS(rtas_args, name),
131
132 TP_STRUCT__entry(
133 __field(__u32, nargs)
134 __string(name, name)
135 __dynamic_array(__u32, inputs, be32_to_cpu(rtas_args->nargs))
136 ),
137
138 TP_fast_assign(
139 __entry->nargs = be32_to_cpu(rtas_args->nargs);
2c92ca84 140 __assign_str(name);
2c81ca7f
NL
141 be32_to_cpu_array(__get_dynamic_array(inputs), rtas_args->args, __entry->nargs);
142 ),
143
144 TP_printk("%s arguments: %s", __get_str(name),
145 __print_array(__get_dynamic_array(inputs), __entry->nargs, 4)
146 )
147);
148
149TRACE_EVENT(rtas_output,
150
151 TP_PROTO(struct rtas_args *rtas_args, const char *name),
152
153 TP_ARGS(rtas_args, name),
154
155 TP_STRUCT__entry(
156 __field(__u32, nr_other)
157 __field(__s32, status)
158 __string(name, name)
159 __dynamic_array(__u32, other_outputs, be32_to_cpu(rtas_args->nret) - 1)
160 ),
161
162 TP_fast_assign(
163 __entry->nr_other = be32_to_cpu(rtas_args->nret) - 1;
164 __entry->status = be32_to_cpu(rtas_args->rets[0]);
2c92ca84 165 __assign_str(name);
2c81ca7f
NL
166 be32_to_cpu_array(__get_dynamic_array(other_outputs),
167 &rtas_args->rets[1], __entry->nr_other);
168 ),
169
170 TP_printk("%s status: %d, other outputs: %s", __get_str(name), __entry->status,
171 __print_array(__get_dynamic_array(other_outputs),
172 __entry->nr_other, 4)
173 )
174);
175
176DECLARE_EVENT_CLASS(rtas_parameter_block,
177
178 TP_PROTO(struct rtas_args *rtas_args),
179
180 TP_ARGS(rtas_args),
181
182 TP_STRUCT__entry(
183 __field(u32, token)
184 __field(u32, nargs)
185 __field(u32, nret)
186 __array(__u32, params, 16)
187 ),
188
189 TP_fast_assign(
190 __entry->token = be32_to_cpu(rtas_args->token);
191 __entry->nargs = be32_to_cpu(rtas_args->nargs);
192 __entry->nret = be32_to_cpu(rtas_args->nret);
193 be32_to_cpu_array(__entry->params, rtas_args->args, ARRAY_SIZE(rtas_args->args));
194 ),
195
196 TP_printk("token=%u nargs=%u nret=%u params:"
197 " [0]=0x%08x [1]=0x%08x [2]=0x%08x [3]=0x%08x"
198 " [4]=0x%08x [5]=0x%08x [6]=0x%08x [7]=0x%08x"
199 " [8]=0x%08x [9]=0x%08x [10]=0x%08x [11]=0x%08x"
200 " [12]=0x%08x [13]=0x%08x [14]=0x%08x [15]=0x%08x",
201 __entry->token, __entry->nargs, __entry->nret,
202 __entry->params[0], __entry->params[1], __entry->params[2], __entry->params[3],
203 __entry->params[4], __entry->params[5], __entry->params[6], __entry->params[7],
204 __entry->params[8], __entry->params[9], __entry->params[10], __entry->params[11],
205 __entry->params[12], __entry->params[13], __entry->params[14], __entry->params[15]
206 )
207);
208
209DEFINE_EVENT(rtas_parameter_block, rtas_ll_entry,
210
211 TP_PROTO(struct rtas_args *rtas_args),
212
213 TP_ARGS(rtas_args)
214);
215
216DEFINE_EVENT(rtas_parameter_block, rtas_ll_exit,
217
218 TP_PROTO(struct rtas_args *rtas_args),
219
220 TP_ARGS(rtas_args)
221);
222
223#endif /* CONFIG_PPC_RTAS */
224
c49f6353 225#ifdef CONFIG_PPC_POWERNV
8cf868af 226extern int opal_tracepoint_regfunc(void);
c49f6353
AB
227extern void opal_tracepoint_unregfunc(void);
228
229TRACE_EVENT_FN(opal_entry,
230
231 TP_PROTO(unsigned long opcode, unsigned long *args),
232
233 TP_ARGS(opcode, args),
234
235 TP_STRUCT__entry(
236 __field(unsigned long, opcode)
237 ),
238
239 TP_fast_assign(
240 __entry->opcode = opcode;
241 ),
242
243 TP_printk("opcode=%lu", __entry->opcode),
244
245 opal_tracepoint_regfunc, opal_tracepoint_unregfunc
246);
247
248TRACE_EVENT_FN(opal_exit,
249
250 TP_PROTO(unsigned long opcode, unsigned long retval),
251
252 TP_ARGS(opcode, retval),
253
254 TP_STRUCT__entry(
255 __field(unsigned long, opcode)
256 __field(unsigned long, retval)
257 ),
258
259 TP_fast_assign(
260 __entry->opcode = opcode;
261 __entry->retval = retval;
262 ),
263
264 TP_printk("opcode=%lu retval=%lu", __entry->opcode, __entry->retval),
265
266 opal_tracepoint_regfunc, opal_tracepoint_unregfunc
267);
268#endif
269
9e00743a 270#ifdef CONFIG_PPC_64S_HASH_MMU
cfcb3d80
AK
271TRACE_EVENT(hash_fault,
272
273 TP_PROTO(unsigned long addr, unsigned long access, unsigned long trap),
274 TP_ARGS(addr, access, trap),
275 TP_STRUCT__entry(
276 __field(unsigned long, addr)
277 __field(unsigned long, access)
278 __field(unsigned long, trap)
279 ),
280
281 TP_fast_assign(
282 __entry->addr = addr;
283 __entry->access = access;
284 __entry->trap = trap;
285 ),
286
287 TP_printk("hash fault with addr 0x%lx and access = 0x%lx trap = 0x%lx",
288 __entry->addr, __entry->access, __entry->trap)
289);
9e00743a 290#endif
0428491c
BS
291
292TRACE_EVENT(tlbie,
293
294 TP_PROTO(unsigned long lpid, unsigned long local, unsigned long rb,
295 unsigned long rs, unsigned long ric, unsigned long prs,
296 unsigned long r),
297 TP_ARGS(lpid, local, rb, rs, ric, prs, r),
298 TP_STRUCT__entry(
299 __field(unsigned long, lpid)
300 __field(unsigned long, local)
301 __field(unsigned long, rb)
302 __field(unsigned long, rs)
303 __field(unsigned long, ric)
304 __field(unsigned long, prs)
305 __field(unsigned long, r)
306 ),
307
308 TP_fast_assign(
309 __entry->lpid = lpid;
310 __entry->local = local;
311 __entry->rb = rb;
312 __entry->rs = rs;
313 __entry->ric = ric;
314 __entry->prs = prs;
315 __entry->r = r;
316 ),
317
318 TP_printk("lpid=%ld, local=%ld, rb=0x%lx, rs=0x%lx, ric=0x%lx, "
319 "prs=0x%lx, r=0x%lx", __entry->lpid, __entry->local,
320 __entry->rb, __entry->rs, __entry->ric, __entry->prs,
321 __entry->r)
322);
323
8114c36e
CL
324TRACE_EVENT(tlbia,
325
326 TP_PROTO(unsigned long id),
327 TP_ARGS(id),
328 TP_STRUCT__entry(
329 __field(unsigned long, id)
330 ),
331
332 TP_fast_assign(
333 __entry->id = id;
334 ),
335
336 TP_printk("ctx.id=0x%lx", __entry->id)
337);
338
1bf4af16
AB
339#endif /* _TRACE_POWERPC_H */
340
341#undef TRACE_INCLUDE_PATH
342#undef TRACE_INCLUDE_FILE
343
344#define TRACE_INCLUDE_PATH asm
345#define TRACE_INCLUDE_FILE trace
346
347#include <trace/define_trace.h>