xref: /openbmc/linux/arch/powerpc/include/asm/trace.h (revision 711aab1d)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM powerpc
3 
4 #if !defined(_TRACE_POWERPC_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_POWERPC_H
6 
7 #include <linux/tracepoint.h>
8 
9 struct pt_regs;
10 
11 DECLARE_EVENT_CLASS(ppc64_interrupt_class,
12 
13 	TP_PROTO(struct pt_regs *regs),
14 
15 	TP_ARGS(regs),
16 
17 	TP_STRUCT__entry(
18 		__field(struct pt_regs *, regs)
19 	),
20 
21 	TP_fast_assign(
22 		__entry->regs = regs;
23 	),
24 
25 	TP_printk("pt_regs=%p", __entry->regs)
26 );
27 
28 DEFINE_EVENT(ppc64_interrupt_class, irq_entry,
29 
30 	TP_PROTO(struct pt_regs *regs),
31 
32 	TP_ARGS(regs)
33 );
34 
35 DEFINE_EVENT(ppc64_interrupt_class, irq_exit,
36 
37 	TP_PROTO(struct pt_regs *regs),
38 
39 	TP_ARGS(regs)
40 );
41 
42 DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_entry,
43 
44 	TP_PROTO(struct pt_regs *regs),
45 
46 	TP_ARGS(regs)
47 );
48 
49 DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_exit,
50 
51 	TP_PROTO(struct pt_regs *regs),
52 
53 	TP_ARGS(regs)
54 );
55 
56 #ifdef CONFIG_PPC_PSERIES
57 extern int hcall_tracepoint_regfunc(void);
58 extern void hcall_tracepoint_unregfunc(void);
59 
60 TRACE_EVENT_FN_COND(hcall_entry,
61 
62 	TP_PROTO(unsigned long opcode, unsigned long *args),
63 
64 	TP_ARGS(opcode, args),
65 
66 	TP_CONDITION(cpu_online(raw_smp_processor_id())),
67 
68 	TP_STRUCT__entry(
69 		__field(unsigned long, opcode)
70 	),
71 
72 	TP_fast_assign(
73 		__entry->opcode = opcode;
74 	),
75 
76 	TP_printk("opcode=%lu", __entry->opcode),
77 
78 	hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
79 );
80 
81 TRACE_EVENT_FN_COND(hcall_exit,
82 
83 	TP_PROTO(unsigned long opcode, unsigned long retval,
84 		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(unsigned long, retval)
93 	),
94 
95 	TP_fast_assign(
96 		__entry->opcode = opcode;
97 		__entry->retval = retval;
98 	),
99 
100 	TP_printk("opcode=%lu retval=%lu", __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 #endif /* _TRACE_POWERPC_H */
205 
206 #undef TRACE_INCLUDE_PATH
207 #undef TRACE_INCLUDE_FILE
208 
209 #define TRACE_INCLUDE_PATH asm
210 #define TRACE_INCLUDE_FILE trace
211 
212 #include <trace/define_trace.h>
213