xref: /linux/arch/powerpc/include/asm/trace.h (revision da1d9caf95def6f0320819cf941c9fd1069ba9e1)
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_DOORBELL
58 DEFINE_EVENT(ppc64_interrupt_class, doorbell_entry,
59 
60 	TP_PROTO(struct pt_regs *regs),
61 
62 	TP_ARGS(regs)
63 );
64 
65 DEFINE_EVENT(ppc64_interrupt_class, doorbell_exit,
66 
67 	TP_PROTO(struct pt_regs *regs),
68 
69 	TP_ARGS(regs)
70 );
71 #endif
72 
73 #ifdef CONFIG_PPC_PSERIES
74 extern int hcall_tracepoint_regfunc(void);
75 extern void hcall_tracepoint_unregfunc(void);
76 
77 TRACE_EVENT_FN_COND(hcall_entry,
78 
79 	TP_PROTO(unsigned long opcode, unsigned long *args),
80 
81 	TP_ARGS(opcode, args),
82 
83 	TP_CONDITION(cpu_online(raw_smp_processor_id())),
84 
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 
98 TRACE_EVENT_FN_COND(hcall_exit,
99 
100 	TP_PROTO(unsigned long opcode, long retval, unsigned long *retbuf),
101 
102 	TP_ARGS(opcode, retval, retbuf),
103 
104 	TP_CONDITION(cpu_online(raw_smp_processor_id())),
105 
106 	TP_STRUCT__entry(
107 		__field(unsigned long, opcode)
108 		__field(long, retval)
109 	),
110 
111 	TP_fast_assign(
112 		__entry->opcode = opcode;
113 		__entry->retval = retval;
114 	),
115 
116 	TP_printk("opcode=%lu retval=%ld", __entry->opcode, __entry->retval),
117 
118 	hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
119 );
120 #endif
121 
122 #ifdef CONFIG_PPC_POWERNV
123 extern int opal_tracepoint_regfunc(void);
124 extern void opal_tracepoint_unregfunc(void);
125 
126 TRACE_EVENT_FN(opal_entry,
127 
128 	TP_PROTO(unsigned long opcode, unsigned long *args),
129 
130 	TP_ARGS(opcode, args),
131 
132 	TP_STRUCT__entry(
133 		__field(unsigned long, opcode)
134 	),
135 
136 	TP_fast_assign(
137 		__entry->opcode = opcode;
138 	),
139 
140 	TP_printk("opcode=%lu", __entry->opcode),
141 
142 	opal_tracepoint_regfunc, opal_tracepoint_unregfunc
143 );
144 
145 TRACE_EVENT_FN(opal_exit,
146 
147 	TP_PROTO(unsigned long opcode, unsigned long retval),
148 
149 	TP_ARGS(opcode, retval),
150 
151 	TP_STRUCT__entry(
152 		__field(unsigned long, opcode)
153 		__field(unsigned long, retval)
154 	),
155 
156 	TP_fast_assign(
157 		__entry->opcode = opcode;
158 		__entry->retval = retval;
159 	),
160 
161 	TP_printk("opcode=%lu retval=%lu", __entry->opcode, __entry->retval),
162 
163 	opal_tracepoint_regfunc, opal_tracepoint_unregfunc
164 );
165 #endif
166 
167 TRACE_EVENT(hash_fault,
168 
169 	    TP_PROTO(unsigned long addr, unsigned long access, unsigned long trap),
170 	    TP_ARGS(addr, access, trap),
171 	    TP_STRUCT__entry(
172 		    __field(unsigned long, addr)
173 		    __field(unsigned long, access)
174 		    __field(unsigned long, trap)
175 		    ),
176 
177 	    TP_fast_assign(
178 		    __entry->addr = addr;
179 		    __entry->access = access;
180 		    __entry->trap = trap;
181 		    ),
182 
183 	    TP_printk("hash fault with addr 0x%lx and access = 0x%lx trap = 0x%lx",
184 		      __entry->addr, __entry->access, __entry->trap)
185 );
186 
187 
188 TRACE_EVENT(tlbie,
189 
190 	TP_PROTO(unsigned long lpid, unsigned long local, unsigned long rb,
191 		unsigned long rs, unsigned long ric, unsigned long prs,
192 		unsigned long r),
193 	TP_ARGS(lpid, local, rb, rs, ric, prs, r),
194 	TP_STRUCT__entry(
195 		__field(unsigned long, lpid)
196 		__field(unsigned long, local)
197 		__field(unsigned long, rb)
198 		__field(unsigned long, rs)
199 		__field(unsigned long, ric)
200 		__field(unsigned long, prs)
201 		__field(unsigned long, r)
202 		),
203 
204 	TP_fast_assign(
205 		__entry->lpid = lpid;
206 		__entry->local = local;
207 		__entry->rb = rb;
208 		__entry->rs = rs;
209 		__entry->ric = ric;
210 		__entry->prs = prs;
211 		__entry->r = r;
212 		),
213 
214 	TP_printk("lpid=%ld, local=%ld, rb=0x%lx, rs=0x%lx, ric=0x%lx, "
215 		"prs=0x%lx, r=0x%lx", __entry->lpid, __entry->local,
216 		__entry->rb, __entry->rs, __entry->ric, __entry->prs,
217 		__entry->r)
218 );
219 
220 TRACE_EVENT(tlbia,
221 
222 	TP_PROTO(unsigned long id),
223 	TP_ARGS(id),
224 	TP_STRUCT__entry(
225 		__field(unsigned long, id)
226 		),
227 
228 	TP_fast_assign(
229 		__entry->id = id;
230 		),
231 
232 	TP_printk("ctx.id=0x%lx", __entry->id)
233 );
234 
235 #endif /* _TRACE_POWERPC_H */
236 
237 #undef TRACE_INCLUDE_PATH
238 #undef TRACE_INCLUDE_FILE
239 
240 #define TRACE_INCLUDE_PATH asm
241 #define TRACE_INCLUDE_FILE trace
242 
243 #include <trace/define_trace.h>
244