1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM powerpc
5 #if !defined(_TRACE_POWERPC_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_POWERPC_H
8 #include <linux/tracepoint.h>
12 DECLARE_EVENT_CLASS(ppc64_interrupt_class,
14 TP_PROTO(struct pt_regs *regs),
19 __field(struct pt_regs *, regs)
26 TP_printk("pt_regs=%p", __entry->regs)
29 DEFINE_EVENT(ppc64_interrupt_class, irq_entry,
31 TP_PROTO(struct pt_regs *regs),
36 DEFINE_EVENT(ppc64_interrupt_class, irq_exit,
38 TP_PROTO(struct pt_regs *regs),
43 DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_entry,
45 TP_PROTO(struct pt_regs *regs),
50 DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_exit,
52 TP_PROTO(struct pt_regs *regs),
57 #ifdef CONFIG_PPC_DOORBELL
58 DEFINE_EVENT(ppc64_interrupt_class, doorbell_entry,
60 TP_PROTO(struct pt_regs *regs),
65 DEFINE_EVENT(ppc64_interrupt_class, doorbell_exit,
67 TP_PROTO(struct pt_regs *regs),
73 #ifdef CONFIG_PPC_PSERIES
74 extern int hcall_tracepoint_regfunc(void);
75 extern void hcall_tracepoint_unregfunc(void);
77 TRACE_EVENT_FN_COND(hcall_entry,
79 TP_PROTO(unsigned long opcode, unsigned long *args),
81 TP_ARGS(opcode, args),
83 TP_CONDITION(cpu_online(raw_smp_processor_id())),
86 __field(unsigned long, opcode)
90 __entry->opcode = opcode;
93 TP_printk("opcode=%lu", __entry->opcode),
95 hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
98 TRACE_EVENT_FN_COND(hcall_exit,
100 TP_PROTO(unsigned long opcode, long retval, unsigned long *retbuf),
102 TP_ARGS(opcode, retval, retbuf),
104 TP_CONDITION(cpu_online(raw_smp_processor_id())),
107 __field(unsigned long, opcode)
108 __field(long, retval)
112 __entry->opcode = opcode;
113 __entry->retval = retval;
116 TP_printk("opcode=%lu retval=%ld", __entry->opcode, __entry->retval),
118 hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
122 #ifdef CONFIG_PPC_RTAS
124 #include <asm/rtas-types.h>
126 TRACE_EVENT(rtas_input,
128 TP_PROTO(struct rtas_args *rtas_args, const char *name),
130 TP_ARGS(rtas_args, name),
133 __field(__u32, nargs)
135 __dynamic_array(__u32, inputs, be32_to_cpu(rtas_args->nargs))
139 __entry->nargs = be32_to_cpu(rtas_args->nargs);
140 __assign_str(name, name);
141 be32_to_cpu_array(__get_dynamic_array(inputs), rtas_args->args, __entry->nargs);
144 TP_printk("%s arguments: %s", __get_str(name),
145 __print_array(__get_dynamic_array(inputs), __entry->nargs, 4)
149 TRACE_EVENT(rtas_output,
151 TP_PROTO(struct rtas_args *rtas_args, const char *name),
153 TP_ARGS(rtas_args, name),
156 __field(__u32, nr_other)
157 __field(__s32, status)
159 __dynamic_array(__u32, other_outputs, be32_to_cpu(rtas_args->nret) - 1)
163 __entry->nr_other = be32_to_cpu(rtas_args->nret) - 1;
164 __entry->status = be32_to_cpu(rtas_args->rets[0]);
165 __assign_str(name, name);
166 be32_to_cpu_array(__get_dynamic_array(other_outputs),
167 &rtas_args->rets[1], __entry->nr_other);
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)
176 DECLARE_EVENT_CLASS(rtas_parameter_block,
178 TP_PROTO(struct rtas_args *rtas_args),
186 __array(__u32, params, 16)
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));
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]
209 DEFINE_EVENT(rtas_parameter_block, rtas_ll_entry,
211 TP_PROTO(struct rtas_args *rtas_args),
216 DEFINE_EVENT(rtas_parameter_block, rtas_ll_exit,
218 TP_PROTO(struct rtas_args *rtas_args),
223 #endif /* CONFIG_PPC_RTAS */
225 #ifdef CONFIG_PPC_POWERNV
226 extern int opal_tracepoint_regfunc(void);
227 extern void opal_tracepoint_unregfunc(void);
229 TRACE_EVENT_FN(opal_entry,
231 TP_PROTO(unsigned long opcode, unsigned long *args),
233 TP_ARGS(opcode, args),
236 __field(unsigned long, opcode)
240 __entry->opcode = opcode;
243 TP_printk("opcode=%lu", __entry->opcode),
245 opal_tracepoint_regfunc, opal_tracepoint_unregfunc
248 TRACE_EVENT_FN(opal_exit,
250 TP_PROTO(unsigned long opcode, unsigned long retval),
252 TP_ARGS(opcode, retval),
255 __field(unsigned long, opcode)
256 __field(unsigned long, retval)
260 __entry->opcode = opcode;
261 __entry->retval = retval;
264 TP_printk("opcode=%lu retval=%lu", __entry->opcode, __entry->retval),
266 opal_tracepoint_regfunc, opal_tracepoint_unregfunc
270 TRACE_EVENT(hash_fault,
272 TP_PROTO(unsigned long addr, unsigned long access, unsigned long trap),
273 TP_ARGS(addr, access, trap),
275 __field(unsigned long, addr)
276 __field(unsigned long, access)
277 __field(unsigned long, trap)
281 __entry->addr = addr;
282 __entry->access = access;
283 __entry->trap = trap;
286 TP_printk("hash fault with addr 0x%lx and access = 0x%lx trap = 0x%lx",
287 __entry->addr, __entry->access, __entry->trap)
293 TP_PROTO(unsigned long lpid, unsigned long local, unsigned long rb,
294 unsigned long rs, unsigned long ric, unsigned long prs,
296 TP_ARGS(lpid, local, rb, rs, ric, prs, r),
298 __field(unsigned long, lpid)
299 __field(unsigned long, local)
300 __field(unsigned long, rb)
301 __field(unsigned long, rs)
302 __field(unsigned long, ric)
303 __field(unsigned long, prs)
304 __field(unsigned long, r)
308 __entry->lpid = lpid;
309 __entry->local = local;
317 TP_printk("lpid=%ld, local=%ld, rb=0x%lx, rs=0x%lx, ric=0x%lx, "
318 "prs=0x%lx, r=0x%lx", __entry->lpid, __entry->local,
319 __entry->rb, __entry->rs, __entry->ric, __entry->prs,
325 TP_PROTO(unsigned long id),
328 __field(unsigned long, id)
335 TP_printk("ctx.id=0x%lx", __entry->id)
338 #endif /* _TRACE_POWERPC_H */
340 #undef TRACE_INCLUDE_PATH
341 #undef TRACE_INCLUDE_FILE
343 #define TRACE_INCLUDE_PATH asm
344 #define TRACE_INCLUDE_FILE trace
346 #include <trace/define_trace.h>