xref: /openbmc/linux/drivers/misc/ocxl/trace.h (revision bc05aa6e)
1 // SPDX-License-Identifier: GPL-2.0+
2 // Copyright 2017 IBM Corp.
3 #undef TRACE_SYSTEM
4 #define TRACE_SYSTEM ocxl
5 
6 #if !defined(_TRACE_OCXL_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define _TRACE_OCXL_H
8 
9 #include <linux/tracepoint.h>
10 
11 DECLARE_EVENT_CLASS(ocxl_context,
12 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
13 	TP_ARGS(pid, spa, pasid, pidr, tidr),
14 
15 	TP_STRUCT__entry(
16 		__field(pid_t, pid)
17 		__field(void*, spa)
18 		__field(int, pasid)
19 		__field(u32, pidr)
20 		__field(u32, tidr)
21 	),
22 
23 	TP_fast_assign(
24 		__entry->pid = pid;
25 		__entry->spa = spa;
26 		__entry->pasid = pasid;
27 		__entry->pidr = pidr;
28 		__entry->tidr = tidr;
29 	),
30 
31 	TP_printk("linux pid=%d spa=0x%p pasid=0x%x pidr=0x%x tidr=0x%x",
32 		__entry->pid,
33 		__entry->spa,
34 		__entry->pasid,
35 		__entry->pidr,
36 		__entry->tidr
37 	)
38 );
39 
40 DEFINE_EVENT(ocxl_context, ocxl_context_add,
41 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
42 	TP_ARGS(pid, spa, pasid, pidr, tidr)
43 );
44 
45 DEFINE_EVENT(ocxl_context, ocxl_context_remove,
46 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
47 	TP_ARGS(pid, spa, pasid, pidr, tidr)
48 );
49 
50 TRACE_EVENT(ocxl_terminate_pasid,
51 	TP_PROTO(int pasid, int rc),
52 	TP_ARGS(pasid, rc),
53 
54 	TP_STRUCT__entry(
55 		__field(int, pasid)
56 		__field(int, rc)
57 	),
58 
59 	TP_fast_assign(
60 		__entry->pasid = pasid;
61 		__entry->rc = rc;
62 	),
63 
64 	TP_printk("pasid=0x%x rc=%d",
65 		__entry->pasid,
66 		__entry->rc
67 	)
68 );
69 
70 DECLARE_EVENT_CLASS(ocxl_fault_handler,
71 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
72 	TP_ARGS(spa, pe, dsisr, dar, tfc),
73 
74 	TP_STRUCT__entry(
75 		__field(void *, spa)
76 		__field(u64, pe)
77 		__field(u64, dsisr)
78 		__field(u64, dar)
79 		__field(u64, tfc)
80 	),
81 
82 	TP_fast_assign(
83 		__entry->spa = spa;
84 		__entry->pe = pe;
85 		__entry->dsisr = dsisr;
86 		__entry->dar = dar;
87 		__entry->tfc = tfc;
88 	),
89 
90 	TP_printk("spa=%p pe=0x%llx dsisr=0x%llx dar=0x%llx tfc=0x%llx",
91 		__entry->spa,
92 		__entry->pe,
93 		__entry->dsisr,
94 		__entry->dar,
95 		__entry->tfc
96 	)
97 );
98 
99 DEFINE_EVENT(ocxl_fault_handler, ocxl_fault,
100 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
101 	TP_ARGS(spa, pe, dsisr, dar, tfc)
102 );
103 
104 DEFINE_EVENT(ocxl_fault_handler, ocxl_fault_ack,
105 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
106 	TP_ARGS(spa, pe, dsisr, dar, tfc)
107 );
108 
109 TRACE_EVENT(ocxl_afu_irq_alloc,
110 	TP_PROTO(int pasid, int irq_id, unsigned int virq, int hw_irq,
111 		u64 irq_offset),
112 	TP_ARGS(pasid, irq_id, virq, hw_irq, irq_offset),
113 
114 	TP_STRUCT__entry(
115 		__field(int, pasid)
116 		__field(int, irq_id)
117 		__field(unsigned int, virq)
118 		__field(int, hw_irq)
119 		__field(u64, irq_offset)
120 	),
121 
122 	TP_fast_assign(
123 		__entry->pasid = pasid;
124 		__entry->irq_id = irq_id;
125 		__entry->virq = virq;
126 		__entry->hw_irq = hw_irq;
127 		__entry->irq_offset = irq_offset;
128 	),
129 
130 	TP_printk("pasid=0x%x irq_id=%d virq=%u hw_irq=%d irq_offset=0x%llx",
131 		__entry->pasid,
132 		__entry->irq_id,
133 		__entry->virq,
134 		__entry->hw_irq,
135 		__entry->irq_offset
136 	)
137 );
138 
139 TRACE_EVENT(ocxl_afu_irq_free,
140 	TP_PROTO(int pasid, int irq_id),
141 	TP_ARGS(pasid, irq_id),
142 
143 	TP_STRUCT__entry(
144 		__field(int, pasid)
145 		__field(int, irq_id)
146 	),
147 
148 	TP_fast_assign(
149 		__entry->pasid = pasid;
150 		__entry->irq_id = irq_id;
151 	),
152 
153 	TP_printk("pasid=0x%x irq_id=%d",
154 		__entry->pasid,
155 		__entry->irq_id
156 	)
157 );
158 
159 TRACE_EVENT(ocxl_afu_irq_receive,
160 	TP_PROTO(int virq),
161 	TP_ARGS(virq),
162 
163 	TP_STRUCT__entry(
164 		__field(int, virq)
165 	),
166 
167 	TP_fast_assign(
168 		__entry->virq = virq;
169 	),
170 
171 	TP_printk("virq=%d",
172 		__entry->virq
173 	)
174 );
175 
176 #endif /* _TRACE_OCXL_H */
177 
178 /* This part must be outside protection */
179 #undef TRACE_INCLUDE_PATH
180 #define TRACE_INCLUDE_PATH .
181 #define TRACE_INCLUDE_FILE trace
182 #include <trace/define_trace.h>
183