xref: /openbmc/linux/drivers/s390/cio/trace.h (revision e65e175b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Tracepoint header for the s390 Common I/O layer (CIO)
4  *
5  * Copyright IBM Corp. 2015
6  * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
7  */
8 
9 #include <linux/kernel.h>
10 #include <asm/crw.h>
11 #include <uapi/asm/chpid.h>
12 #include <uapi/asm/schid.h>
13 #include "cio.h"
14 #include "orb.h"
15 
16 #undef TRACE_SYSTEM
17 #define TRACE_SYSTEM s390
18 
19 #if !defined(_TRACE_S390_CIO_H) || defined(TRACE_HEADER_MULTI_READ)
20 #define _TRACE_S390_CIO_H
21 
22 #include <linux/tracepoint.h>
23 
24 DECLARE_EVENT_CLASS(s390_class_schib,
25 	TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc),
26 	TP_ARGS(schid, schib, cc),
27 	TP_STRUCT__entry(
28 		__field(u8, cssid)
29 		__field(u8, ssid)
30 		__field(u16, schno)
31 		__field(u16, devno)
32 		__field_struct(struct schib, schib)
33 		__field(u8, pmcw_ena)
34 		__field(u8, pmcw_st)
35 		__field(u8, pmcw_dnv)
36 		__field(u16, pmcw_dev)
37 		__field(u8, pmcw_lpm)
38 		__field(u8, pmcw_pnom)
39 		__field(u8, pmcw_lpum)
40 		__field(u8, pmcw_pim)
41 		__field(u8, pmcw_pam)
42 		__field(u8, pmcw_pom)
43 		__field(u64, pmcw_chpid)
44 		__field(int, cc)
45 	),
46 	TP_fast_assign(
47 		__entry->cssid = schid.cssid;
48 		__entry->ssid = schid.ssid;
49 		__entry->schno = schid.sch_no;
50 		__entry->devno = schib->pmcw.dev;
51 		__entry->schib = *schib;
52 		__entry->pmcw_ena = schib->pmcw.ena;
53 		__entry->pmcw_st = schib->pmcw.ena;
54 		__entry->pmcw_dnv = schib->pmcw.dnv;
55 		__entry->pmcw_dev = schib->pmcw.dev;
56 		__entry->pmcw_lpm = schib->pmcw.lpm;
57 		__entry->pmcw_pnom = schib->pmcw.pnom;
58 		__entry->pmcw_lpum = schib->pmcw.lpum;
59 		__entry->pmcw_pim = schib->pmcw.pim;
60 		__entry->pmcw_pam = schib->pmcw.pam;
61 		__entry->pmcw_pom = schib->pmcw.pom;
62 		memcpy(&__entry->pmcw_chpid, &schib->pmcw.chpid, 8);
63 		__entry->cc = cc;
64 	),
65 	TP_printk("schid=%x.%x.%04x cc=%d ena=%d st=%d dnv=%d dev=%04x "
66 		  "lpm=0x%02x pnom=0x%02x lpum=0x%02x pim=0x%02x pam=0x%02x "
67 		  "pom=0x%02x chpids=%016llx",
68 		  __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
69 		  __entry->pmcw_ena, __entry->pmcw_st,
70 		  __entry->pmcw_dnv, __entry->pmcw_dev,
71 		  __entry->pmcw_lpm, __entry->pmcw_pnom,
72 		  __entry->pmcw_lpum, __entry->pmcw_pim,
73 		  __entry->pmcw_pam, __entry->pmcw_pom,
74 		  __entry->pmcw_chpid
75 	)
76 );
77 
78 /**
79  * s390_cio_stsch -  Store Subchannel instruction (STSCH) was performed
80  * @schid: Subchannel ID
81  * @schib: Subchannel-Information block
82  * @cc: Condition code
83  */
84 DEFINE_EVENT(s390_class_schib, s390_cio_stsch,
85 	TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc),
86 	TP_ARGS(schid, schib, cc)
87 );
88 
89 /**
90  * s390_cio_msch -  Modify Subchannel instruction (MSCH) was performed
91  * @schid: Subchannel ID
92  * @schib: Subchannel-Information block
93  * @cc: Condition code
94  */
95 DEFINE_EVENT(s390_class_schib, s390_cio_msch,
96 	TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc),
97 	TP_ARGS(schid, schib, cc)
98 );
99 
100 /**
101  * s390_cio_tsch - Test Subchannel instruction (TSCH) was performed
102  * @schid: Subchannel ID
103  * @irb: Interruption-Response Block
104  * @cc: Condition code
105  */
106 TRACE_EVENT(s390_cio_tsch,
107 	TP_PROTO(struct subchannel_id schid, struct irb *irb, int cc),
108 	TP_ARGS(schid, irb, cc),
109 	TP_STRUCT__entry(
110 		__field(u8, cssid)
111 		__field(u8, ssid)
112 		__field(u16, schno)
113 		__field_struct(struct irb, irb)
114 		__field(u8, scsw_dcc)
115 		__field(u8, scsw_pno)
116 		__field(u8, scsw_fctl)
117 		__field(u8, scsw_actl)
118 		__field(u8, scsw_stctl)
119 		__field(u8, scsw_dstat)
120 		__field(u8, scsw_cstat)
121 		__field(int, cc)
122 	),
123 	TP_fast_assign(
124 		__entry->cssid = schid.cssid;
125 		__entry->ssid = schid.ssid;
126 		__entry->schno = schid.sch_no;
127 		__entry->irb = *irb;
128 		__entry->scsw_dcc = scsw_cc(&irb->scsw);
129 		__entry->scsw_pno = scsw_pno(&irb->scsw);
130 		__entry->scsw_fctl = scsw_fctl(&irb->scsw);
131 		__entry->scsw_actl = scsw_actl(&irb->scsw);
132 		__entry->scsw_stctl = scsw_stctl(&irb->scsw);
133 		__entry->scsw_dstat = scsw_dstat(&irb->scsw);
134 		__entry->scsw_cstat = scsw_cstat(&irb->scsw);
135 		__entry->cc = cc;
136 	),
137 	TP_printk("schid=%x.%x.%04x cc=%d dcc=%d pno=%d fctl=0x%x actl=0x%x "
138 		  "stctl=0x%x dstat=0x%x cstat=0x%x",
139 		  __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
140 		  __entry->scsw_dcc, __entry->scsw_pno,
141 		  __entry->scsw_fctl, __entry->scsw_actl,
142 		  __entry->scsw_stctl,
143 		  __entry->scsw_dstat, __entry->scsw_cstat
144 	)
145 );
146 
147 /**
148  * s390_cio_tpi - Test Pending Interruption instruction (TPI) was performed
149  * @addr: Address of the I/O interruption code or %NULL
150  * @cc: Condition code
151  */
152 TRACE_EVENT(s390_cio_tpi,
153 	TP_PROTO(struct tpi_info *addr, int cc),
154 	TP_ARGS(addr, cc),
155 	TP_STRUCT__entry(
156 		__field(int, cc)
157 		__field_struct(struct tpi_info, tpi_info)
158 		__field(u8, cssid)
159 		__field(u8, ssid)
160 		__field(u16, schno)
161 		__field(u8, adapter_IO)
162 		__field(u8, isc)
163 		__field(u8, type)
164 	),
165 	TP_fast_assign(
166 		__entry->cc = cc;
167 		if (cc != 0)
168 			memset(&__entry->tpi_info, 0, sizeof(struct tpi_info));
169 		else if (addr)
170 			__entry->tpi_info = *addr;
171 		else
172 			__entry->tpi_info = S390_lowcore.tpi_info;
173 		__entry->cssid = __entry->tpi_info.schid.cssid;
174 		__entry->ssid = __entry->tpi_info.schid.ssid;
175 		__entry->schno = __entry->tpi_info.schid.sch_no;
176 		__entry->adapter_IO = __entry->tpi_info.adapter_IO;
177 		__entry->isc = __entry->tpi_info.isc;
178 		__entry->type = __entry->tpi_info.type;
179 	),
180 	TP_printk("schid=%x.%x.%04x cc=%d a=%d isc=%d type=%d",
181 		  __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
182 		  __entry->adapter_IO, __entry->isc,
183 		  __entry->type
184 	)
185 );
186 
187 /**
188  * s390_cio_ssch - Start Subchannel instruction (SSCH) was performed
189  * @schid: Subchannel ID
190  * @orb: Operation-Request Block
191  * @cc: Condition code
192  */
193 TRACE_EVENT(s390_cio_ssch,
194 	TP_PROTO(struct subchannel_id schid, union orb *orb, int cc),
195 	TP_ARGS(schid, orb, cc),
196 	TP_STRUCT__entry(
197 		__field(u8, cssid)
198 		__field(u8, ssid)
199 		__field(u16, schno)
200 		__field_struct(union orb, orb)
201 		__field(int, cc)
202 	),
203 	TP_fast_assign(
204 		__entry->cssid = schid.cssid;
205 		__entry->ssid = schid.ssid;
206 		__entry->schno = schid.sch_no;
207 		__entry->orb = *orb;
208 		__entry->cc = cc;
209 	),
210 	TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
211 		  __entry->schno, __entry->cc
212 	)
213 );
214 
215 DECLARE_EVENT_CLASS(s390_class_schid,
216 	TP_PROTO(struct subchannel_id schid, int cc),
217 	TP_ARGS(schid, cc),
218 	TP_STRUCT__entry(
219 		__field(u8, cssid)
220 		__field(u8, ssid)
221 		__field(u16, schno)
222 		__field(int, cc)
223 	),
224 	TP_fast_assign(
225 		__entry->cssid = schid.cssid;
226 		__entry->ssid = schid.ssid;
227 		__entry->schno = schid.sch_no;
228 		__entry->cc = cc;
229 	),
230 	TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
231 		  __entry->schno, __entry->cc
232 	)
233 );
234 
235 /**
236  * s390_cio_csch - Clear Subchannel instruction (CSCH) was performed
237  * @schid: Subchannel ID
238  * @cc: Condition code
239  */
240 DEFINE_EVENT(s390_class_schid, s390_cio_csch,
241 	TP_PROTO(struct subchannel_id schid, int cc),
242 	TP_ARGS(schid, cc)
243 );
244 
245 /**
246  * s390_cio_hsch - Halt Subchannel instruction (HSCH) was performed
247  * @schid: Subchannel ID
248  * @cc: Condition code
249  */
250 DEFINE_EVENT(s390_class_schid, s390_cio_hsch,
251 	TP_PROTO(struct subchannel_id schid, int cc),
252 	TP_ARGS(schid, cc)
253 );
254 
255 /**
256  * s390_cio_xsch - Cancel Subchannel instruction (XSCH) was performed
257  * @schid: Subchannel ID
258  * @cc: Condition code
259  */
260 DEFINE_EVENT(s390_class_schid, s390_cio_xsch,
261 	TP_PROTO(struct subchannel_id schid, int cc),
262 	TP_ARGS(schid, cc)
263 );
264 
265 /**
266  * s390_cio_rsch - Resume Subchannel instruction (RSCH) was performed
267  * @schid: Subchannel ID
268  * @cc: Condition code
269  */
270 DEFINE_EVENT(s390_class_schid, s390_cio_rsch,
271 	TP_PROTO(struct subchannel_id schid, int cc),
272 	TP_ARGS(schid, cc)
273 );
274 
275 #define CHSC_MAX_REQUEST_LEN		64
276 #define CHSC_MAX_RESPONSE_LEN		64
277 
278 /**
279  * s390_cio_chsc - Channel Subsystem Call (CHSC) instruction was performed
280  * @chsc: CHSC block
281  * @cc: Condition code
282  */
283 TRACE_EVENT(s390_cio_chsc,
284 	TP_PROTO(struct chsc_header *chsc, int cc),
285 	TP_ARGS(chsc, cc),
286 	TP_STRUCT__entry(
287 		__field(int, cc)
288 		__field(u16, code)
289 		__field(u16, rcode)
290 		__array(u8, request, CHSC_MAX_REQUEST_LEN)
291 		__array(u8, response, CHSC_MAX_RESPONSE_LEN)
292 	),
293 	TP_fast_assign(
294 		__entry->cc = cc;
295 		__entry->code = chsc->code;
296 		memcpy(&entry->request, chsc,
297 		       min_t(u16, chsc->length, CHSC_MAX_REQUEST_LEN));
298 		chsc = (struct chsc_header *) ((char *) chsc + chsc->length);
299 		__entry->rcode = chsc->code;
300 		memcpy(&entry->response, chsc,
301 		       min_t(u16, chsc->length, CHSC_MAX_RESPONSE_LEN));
302 	),
303 	TP_printk("code=0x%04x cc=%d rcode=0x%04x", __entry->code,
304 		  __entry->cc, __entry->rcode)
305 );
306 
307 /**
308  * s390_cio_interrupt - An I/O interrupt occurred
309  * @tpi_info: Address of the I/O interruption code
310  */
311 TRACE_EVENT(s390_cio_interrupt,
312 	TP_PROTO(struct tpi_info *tpi_info),
313 	TP_ARGS(tpi_info),
314 	TP_STRUCT__entry(
315 		__field_struct(struct tpi_info, tpi_info)
316 		__field(u8, cssid)
317 		__field(u8, ssid)
318 		__field(u16, schno)
319 		__field(u8, isc)
320 		__field(u8, type)
321 	),
322 	TP_fast_assign(
323 		__entry->tpi_info = *tpi_info;
324 		__entry->cssid = tpi_info->schid.cssid;
325 		__entry->ssid = tpi_info->schid.ssid;
326 		__entry->schno = tpi_info->schid.sch_no;
327 		__entry->isc = tpi_info->isc;
328 		__entry->type = tpi_info->type;
329 	),
330 	TP_printk("schid=%x.%x.%04x isc=%d type=%d",
331 		  __entry->cssid, __entry->ssid, __entry->schno,
332 		  __entry->isc, __entry->type
333 	)
334 );
335 
336 /**
337  * s390_cio_adapter_int - An adapter interrupt occurred
338  * @tpi_info: Address of the I/O interruption code
339  */
340 TRACE_EVENT(s390_cio_adapter_int,
341 	TP_PROTO(struct tpi_info *tpi_info),
342 	TP_ARGS(tpi_info),
343 	TP_STRUCT__entry(
344 		__field_struct(struct tpi_info, tpi_info)
345 		__field(u8, isc)
346 	),
347 	TP_fast_assign(
348 		__entry->tpi_info = *tpi_info;
349 		__entry->isc = tpi_info->isc;
350 	),
351 	TP_printk("isc=%d", __entry->isc)
352 );
353 
354 /**
355  * s390_cio_stcrw - Store Channel Report Word (STCRW) was performed
356  * @crw: Channel Report Word
357  * @cc: Condition code
358  */
359 TRACE_EVENT(s390_cio_stcrw,
360 	TP_PROTO(struct crw *crw, int cc),
361 	TP_ARGS(crw, cc),
362 	TP_STRUCT__entry(
363 		__field_struct(struct crw, crw)
364 		__field(int, cc)
365 		__field(u8, slct)
366 		__field(u8, oflw)
367 		__field(u8, chn)
368 		__field(u8, rsc)
369 		__field(u8, anc)
370 		__field(u8, erc)
371 		__field(u16, rsid)
372 	),
373 	TP_fast_assign(
374 		__entry->crw = *crw;
375 		__entry->cc = cc;
376 		__entry->slct = crw->slct;
377 		__entry->oflw = crw->oflw;
378 		__entry->chn = crw->chn;
379 		__entry->rsc = crw->rsc;
380 		__entry->anc = crw->anc;
381 		__entry->erc = crw->erc;
382 		__entry->rsid = crw->rsid;
383 	),
384 	TP_printk("cc=%d slct=%d oflw=%d chn=%d rsc=%d anc=%d erc=0x%x "
385 		  "rsid=0x%x",
386 		  __entry->cc, __entry->slct, __entry->oflw,
387 		  __entry->chn, __entry->rsc,  __entry->anc,
388 		  __entry->erc, __entry->rsid
389 	)
390 );
391 
392 #endif /* _TRACE_S390_CIO_H */
393 
394 /* This part must be outside protection */
395 #undef TRACE_INCLUDE_PATH
396 #define TRACE_INCLUDE_PATH .
397 
398 #undef TRACE_INCLUDE_FILE
399 #define TRACE_INCLUDE_FILE trace
400 
401 #include <trace/define_trace.h>
402