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