xref: /openbmc/linux/arch/powerpc/include/asm/trace.h (revision 82e6fdd6)
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, unsigned long retval,
85 		unsigned long *retbuf),
86 
87 	TP_ARGS(opcode, retval, retbuf),
88 
89 	TP_CONDITION(cpu_online(raw_smp_processor_id())),
90 
91 	TP_STRUCT__entry(
92 		__field(unsigned long, opcode)
93 		__field(unsigned long, retval)
94 	),
95 
96 	TP_fast_assign(
97 		__entry->opcode = opcode;
98 		__entry->retval = retval;
99 	),
100 
101 	TP_printk("opcode=%lu retval=%lu", __entry->opcode, __entry->retval),
102 
103 	hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
104 );
105 #endif
106 
107 #ifdef CONFIG_PPC_POWERNV
108 extern int opal_tracepoint_regfunc(void);
109 extern void opal_tracepoint_unregfunc(void);
110 
111 TRACE_EVENT_FN(opal_entry,
112 
113 	TP_PROTO(unsigned long opcode, unsigned long *args),
114 
115 	TP_ARGS(opcode, args),
116 
117 	TP_STRUCT__entry(
118 		__field(unsigned long, opcode)
119 	),
120 
121 	TP_fast_assign(
122 		__entry->opcode = opcode;
123 	),
124 
125 	TP_printk("opcode=%lu", __entry->opcode),
126 
127 	opal_tracepoint_regfunc, opal_tracepoint_unregfunc
128 );
129 
130 TRACE_EVENT_FN(opal_exit,
131 
132 	TP_PROTO(unsigned long opcode, unsigned long retval),
133 
134 	TP_ARGS(opcode, retval),
135 
136 	TP_STRUCT__entry(
137 		__field(unsigned long, opcode)
138 		__field(unsigned long, retval)
139 	),
140 
141 	TP_fast_assign(
142 		__entry->opcode = opcode;
143 		__entry->retval = retval;
144 	),
145 
146 	TP_printk("opcode=%lu retval=%lu", __entry->opcode, __entry->retval),
147 
148 	opal_tracepoint_regfunc, opal_tracepoint_unregfunc
149 );
150 #endif
151 
152 TRACE_EVENT(hash_fault,
153 
154 	    TP_PROTO(unsigned long addr, unsigned long access, unsigned long trap),
155 	    TP_ARGS(addr, access, trap),
156 	    TP_STRUCT__entry(
157 		    __field(unsigned long, addr)
158 		    __field(unsigned long, access)
159 		    __field(unsigned long, trap)
160 		    ),
161 
162 	    TP_fast_assign(
163 		    __entry->addr = addr;
164 		    __entry->access = access;
165 		    __entry->trap = trap;
166 		    ),
167 
168 	    TP_printk("hash fault with addr 0x%lx and access = 0x%lx trap = 0x%lx",
169 		      __entry->addr, __entry->access, __entry->trap)
170 );
171 
172 
173 TRACE_EVENT(tlbie,
174 
175 	TP_PROTO(unsigned long lpid, unsigned long local, unsigned long rb,
176 		unsigned long rs, unsigned long ric, unsigned long prs,
177 		unsigned long r),
178 	TP_ARGS(lpid, local, rb, rs, ric, prs, r),
179 	TP_STRUCT__entry(
180 		__field(unsigned long, lpid)
181 		__field(unsigned long, local)
182 		__field(unsigned long, rb)
183 		__field(unsigned long, rs)
184 		__field(unsigned long, ric)
185 		__field(unsigned long, prs)
186 		__field(unsigned long, r)
187 		),
188 
189 	TP_fast_assign(
190 		__entry->lpid = lpid;
191 		__entry->local = local;
192 		__entry->rb = rb;
193 		__entry->rs = rs;
194 		__entry->ric = ric;
195 		__entry->prs = prs;
196 		__entry->r = r;
197 		),
198 
199 	TP_printk("lpid=%ld, local=%ld, rb=0x%lx, rs=0x%lx, ric=0x%lx, "
200 		"prs=0x%lx, r=0x%lx", __entry->lpid, __entry->local,
201 		__entry->rb, __entry->rs, __entry->ric, __entry->prs,
202 		__entry->r)
203 );
204 
205 #endif /* _TRACE_POWERPC_H */
206 
207 #undef TRACE_INCLUDE_PATH
208 #undef TRACE_INCLUDE_FILE
209 
210 #define TRACE_INCLUDE_PATH asm
211 #define TRACE_INCLUDE_FILE trace
212 
213 #include <trace/define_trace.h>
214