xref: /openbmc/linux/arch/powerpc/include/asm/trace.h (revision d0e22329)
1 /* SPDX-License-Identifier: GPL-2.0 */
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 
10 struct pt_regs;
11 
12 DECLARE_EVENT_CLASS(ppc64_interrupt_class,
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 
29 DEFINE_EVENT(ppc64_interrupt_class, irq_entry,
30 
31 	TP_PROTO(struct pt_regs *regs),
32 
33 	TP_ARGS(regs)
34 );
35 
36 DEFINE_EVENT(ppc64_interrupt_class, irq_exit,
37 
38 	TP_PROTO(struct pt_regs *regs),
39 
40 	TP_ARGS(regs)
41 );
42 
43 DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_entry,
44 
45 	TP_PROTO(struct pt_regs *regs),
46 
47 	TP_ARGS(regs)
48 );
49 
50 DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_exit,
51 
52 	TP_PROTO(struct pt_regs *regs),
53 
54 	TP_ARGS(regs)
55 );
56 
57 #ifdef CONFIG_PPC_PSERIES
58 extern int hcall_tracepoint_regfunc(void);
59 extern void hcall_tracepoint_unregfunc(void);
60 
61 TRACE_EVENT_FN_COND(hcall_entry,
62 
63 	TP_PROTO(unsigned long opcode, unsigned long *args),
64 
65 	TP_ARGS(opcode, args),
66 
67 	TP_CONDITION(cpu_online(raw_smp_processor_id())),
68 
69 	TP_STRUCT__entry(
70 		__field(unsigned long, opcode)
71 	),
72 
73 	TP_fast_assign(
74 		__entry->opcode = opcode;
75 	),
76 
77 	TP_printk("opcode=%lu", __entry->opcode),
78 
79 	hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
80 );
81 
82 TRACE_EVENT_FN_COND(hcall_exit,
83 
84 	TP_PROTO(unsigned long opcode, long retval, unsigned long *retbuf),
85 
86 	TP_ARGS(opcode, retval, retbuf),
87 
88 	TP_CONDITION(cpu_online(raw_smp_processor_id())),
89 
90 	TP_STRUCT__entry(
91 		__field(unsigned long, opcode)
92 		__field(long, retval)
93 	),
94 
95 	TP_fast_assign(
96 		__entry->opcode = opcode;
97 		__entry->retval = retval;
98 	),
99 
100 	TP_printk("opcode=%lu retval=%ld", __entry->opcode, __entry->retval),
101 
102 	hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
103 );
104 #endif
105 
106 #ifdef CONFIG_PPC_POWERNV
107 extern int opal_tracepoint_regfunc(void);
108 extern void opal_tracepoint_unregfunc(void);
109 
110 TRACE_EVENT_FN(opal_entry,
111 
112 	TP_PROTO(unsigned long opcode, unsigned long *args),
113 
114 	TP_ARGS(opcode, args),
115 
116 	TP_STRUCT__entry(
117 		__field(unsigned long, opcode)
118 	),
119 
120 	TP_fast_assign(
121 		__entry->opcode = opcode;
122 	),
123 
124 	TP_printk("opcode=%lu", __entry->opcode),
125 
126 	opal_tracepoint_regfunc, opal_tracepoint_unregfunc
127 );
128 
129 TRACE_EVENT_FN(opal_exit,
130 
131 	TP_PROTO(unsigned long opcode, unsigned long retval),
132 
133 	TP_ARGS(opcode, retval),
134 
135 	TP_STRUCT__entry(
136 		__field(unsigned long, opcode)
137 		__field(unsigned long, retval)
138 	),
139 
140 	TP_fast_assign(
141 		__entry->opcode = opcode;
142 		__entry->retval = retval;
143 	),
144 
145 	TP_printk("opcode=%lu retval=%lu", __entry->opcode, __entry->retval),
146 
147 	opal_tracepoint_regfunc, opal_tracepoint_unregfunc
148 );
149 #endif
150 
151 TRACE_EVENT(hash_fault,
152 
153 	    TP_PROTO(unsigned long addr, unsigned long access, unsigned long trap),
154 	    TP_ARGS(addr, access, trap),
155 	    TP_STRUCT__entry(
156 		    __field(unsigned long, addr)
157 		    __field(unsigned long, access)
158 		    __field(unsigned long, trap)
159 		    ),
160 
161 	    TP_fast_assign(
162 		    __entry->addr = addr;
163 		    __entry->access = access;
164 		    __entry->trap = trap;
165 		    ),
166 
167 	    TP_printk("hash fault with addr 0x%lx and access = 0x%lx trap = 0x%lx",
168 		      __entry->addr, __entry->access, __entry->trap)
169 );
170 
171 
172 TRACE_EVENT(tlbie,
173 
174 	TP_PROTO(unsigned long lpid, unsigned long local, unsigned long rb,
175 		unsigned long rs, unsigned long ric, unsigned long prs,
176 		unsigned long r),
177 	TP_ARGS(lpid, local, rb, rs, ric, prs, r),
178 	TP_STRUCT__entry(
179 		__field(unsigned long, lpid)
180 		__field(unsigned long, local)
181 		__field(unsigned long, rb)
182 		__field(unsigned long, rs)
183 		__field(unsigned long, ric)
184 		__field(unsigned long, prs)
185 		__field(unsigned long, r)
186 		),
187 
188 	TP_fast_assign(
189 		__entry->lpid = lpid;
190 		__entry->local = local;
191 		__entry->rb = rb;
192 		__entry->rs = rs;
193 		__entry->ric = ric;
194 		__entry->prs = prs;
195 		__entry->r = r;
196 		),
197 
198 	TP_printk("lpid=%ld, local=%ld, rb=0x%lx, rs=0x%lx, ric=0x%lx, "
199 		"prs=0x%lx, r=0x%lx", __entry->lpid, __entry->local,
200 		__entry->rb, __entry->rs, __entry->ric, __entry->prs,
201 		__entry->r)
202 );
203 
204 TRACE_EVENT(tlbia,
205 
206 	TP_PROTO(unsigned long id),
207 	TP_ARGS(id),
208 	TP_STRUCT__entry(
209 		__field(unsigned long, id)
210 		),
211 
212 	TP_fast_assign(
213 		__entry->id = id;
214 		),
215 
216 	TP_printk("ctx.id=0x%lx", __entry->id)
217 );
218 
219 #endif /* _TRACE_POWERPC_H */
220 
221 #undef TRACE_INCLUDE_PATH
222 #undef TRACE_INCLUDE_FILE
223 
224 #define TRACE_INCLUDE_PATH asm
225 #define TRACE_INCLUDE_FILE trace
226 
227 #include <trace/define_trace.h>
228