summaryrefslogtreecommitdiff
path: root/drivers/s390/cio/trace.h
blob: 5b807a09f21b277e16f7308f5a8c1e061ac98756 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
/*
 * Tracepoint header for the s390 Common I/O layer (CIO)
 *
 * Copyright IBM Corp. 2015
 * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
 */

#include <linux/kernel.h>
#include <asm/crw.h>
#include <uapi/asm/chpid.h>
#include <uapi/asm/schid.h>
#include "cio.h"
#include "orb.h"

#undef TRACE_SYSTEM
#define TRACE_SYSTEM s390

#if !defined(_TRACE_S390_CIO_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_S390_CIO_H

#include <linux/tracepoint.h>

DECLARE_EVENT_CLASS(s390_class_schib,
	TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc),
	TP_ARGS(schid, schib, cc),
	TP_STRUCT__entry(
		__field(u8, cssid)
		__field(u8, ssid)
		__field(u16, schno)
		__field(u16, devno)
		__field_struct(struct schib, schib)
		__field(int, cc)
	),
	TP_fast_assign(
		__entry->cssid = schid.cssid;
		__entry->ssid = schid.ssid;
		__entry->schno = schid.sch_no;
		__entry->devno = schib->pmcw.dev;
		__entry->schib = *schib;
		__entry->cc = cc;
	),
	TP_printk("schid=%x.%x.%04x cc=%d ena=%d st=%d dnv=%d dev=%04x "
		  "lpm=0x%02x pnom=0x%02x lpum=0x%02x pim=0x%02x pam=0x%02x "
		  "pom=0x%02x chpids=%016llx",
		  __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
		  __entry->schib.pmcw.ena, __entry->schib.pmcw.st,
		  __entry->schib.pmcw.dnv, __entry->schib.pmcw.dev,
		  __entry->schib.pmcw.lpm, __entry->schib.pmcw.pnom,
		  __entry->schib.pmcw.lpum, __entry->schib.pmcw.pim,
		  __entry->schib.pmcw.pam, __entry->schib.pmcw.pom,
		  *((u64 *) __entry->schib.pmcw.chpid)
	)
);

/**
 * s390_cio_stsch -  Store Subchannel instruction (STSCH) was performed
 * @schid: Subchannel ID
 * @schib: Subchannel-Information block
 * @cc: Condition code
 */
DEFINE_EVENT(s390_class_schib, s390_cio_stsch,
	TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc),
	TP_ARGS(schid, schib, cc)
);

/**
 * s390_cio_msch -  Modify Subchannel instruction (MSCH) was performed
 * @schid: Subchannel ID
 * @schib: Subchannel-Information block
 * @cc: Condition code
 */
DEFINE_EVENT(s390_class_schib, s390_cio_msch,
	TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc),
	TP_ARGS(schid, schib, cc)
);

/**
 * s390_cio_tsch - Test Subchannel instruction (TSCH) was performed
 * @schid: Subchannel ID
 * @irb: Interruption-Response Block
 * @cc: Condition code
 */
TRACE_EVENT(s390_cio_tsch,
	TP_PROTO(struct subchannel_id schid, struct irb *irb, int cc),
	TP_ARGS(schid, irb, cc),
	TP_STRUCT__entry(
		__field(u8, cssid)
		__field(u8, ssid)
		__field(u16, schno)
		__field_struct(struct irb, irb)
		__field(int, cc)
	),
	TP_fast_assign(
		__entry->cssid = schid.cssid;
		__entry->ssid = schid.ssid;
		__entry->schno = schid.sch_no;
		__entry->irb = *irb;
		__entry->cc = cc;
	),
	TP_printk("schid=%x.%x.%04x cc=%d dcc=%d pno=%d fctl=0x%x actl=0x%x "
		  "stctl=0x%x dstat=0x%x cstat=0x%x",
		  __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
		  scsw_cc(&__entry->irb.scsw), scsw_pno(&__entry->irb.scsw),
		  scsw_fctl(&__entry->irb.scsw), scsw_actl(&__entry->irb.scsw),
		  scsw_stctl(&__entry->irb.scsw),
		  scsw_dstat(&__entry->irb.scsw), scsw_cstat(&__entry->irb.scsw)
	)
);

/**
 * s390_cio_tpi - Test Pending Interruption instruction (TPI) was performed
 * @addr: Address of the I/O interruption code or %NULL
 * @cc: Condition code
 */
TRACE_EVENT(s390_cio_tpi,
	TP_PROTO(struct tpi_info *addr, int cc),
	TP_ARGS(addr, cc),
	TP_STRUCT__entry(
		__field(int, cc)
		__field_struct(struct tpi_info, tpi_info)
		__field(u8, cssid)
		__field(u8, ssid)
		__field(u16, schno)
	),
	TP_fast_assign(
		__entry->cc = cc;
		if (cc != 0)
			memset(&__entry->tpi_info, 0, sizeof(struct tpi_info));
		else if (addr)
			__entry->tpi_info = *addr;
		else {
			memcpy(&__entry->tpi_info, &S390_lowcore.subchannel_id,
			       sizeof(struct tpi_info));
		}
		__entry->cssid = __entry->tpi_info.schid.cssid;
		__entry->ssid = __entry->tpi_info.schid.ssid;
		__entry->schno = __entry->tpi_info.schid.sch_no;
	),
	TP_printk("schid=%x.%x.%04x cc=%d a=%d isc=%d type=%d",
		  __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
		  __entry->tpi_info.adapter_IO, __entry->tpi_info.isc,
		  __entry->tpi_info.type
	)
);

/**
 * s390_cio_ssch - Start Subchannel instruction (SSCH) was performed
 * @schid: Subchannel ID
 * @orb: Operation-Request Block
 * @cc: Condition code
 */
TRACE_EVENT(s390_cio_ssch,
	TP_PROTO(struct subchannel_id schid, union orb *orb, int cc),
	TP_ARGS(schid, orb, cc),
	TP_STRUCT__entry(
		__field(u8, cssid)
		__field(u8, ssid)
		__field(u16, schno)
		__field_struct(union orb, orb)
		__field(int, cc)
	),
	TP_fast_assign(
		__entry->cssid = schid.cssid;
		__entry->ssid = schid.ssid;
		__entry->schno = schid.sch_no;
		__entry->orb = *orb;
		__entry->cc = cc;
	),
	TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
		  __entry->schno, __entry->cc
	)
);

DECLARE_EVENT_CLASS(s390_class_schid,
	TP_PROTO(struct subchannel_id schid, int cc),
	TP_ARGS(schid, cc),
	TP_STRUCT__entry(
		__field(u8, cssid)
		__field(u8, ssid)
		__field(u16, schno)
		__field(int, cc)
	),
	TP_fast_assign(
		__entry->cssid = schid.cssid;
		__entry->ssid = schid.ssid;
		__entry->schno = schid.sch_no;
		__entry->cc = cc;
	),
	TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
		  __entry->schno, __entry->cc
	)
);

/**
 * s390_cio_csch - Clear Subchannel instruction (CSCH) was performed
 * @schid: Subchannel ID
 * @cc: Condition code
 */
DEFINE_EVENT(s390_class_schid, s390_cio_csch,
	TP_PROTO(struct subchannel_id schid, int cc),
	TP_ARGS(schid, cc)
);

/**
 * s390_cio_hsch - Halt Subchannel instruction (HSCH) was performed
 * @schid: Subchannel ID
 * @cc: Condition code
 */
DEFINE_EVENT(s390_class_schid, s390_cio_hsch,
	TP_PROTO(struct subchannel_id schid, int cc),
	TP_ARGS(schid, cc)
);

/**
 * s390_cio_xsch - Cancel Subchannel instruction (XSCH) was performed
 * @schid: Subchannel ID
 * @cc: Condition code
 */
DEFINE_EVENT(s390_class_schid, s390_cio_xsch,
	TP_PROTO(struct subchannel_id schid, int cc),
	TP_ARGS(schid, cc)
);

/**
 * s390_cio_rsch - Resume Subchannel instruction (RSCH) was performed
 * @schid: Subchannel ID
 * @cc: Condition code
 */
DEFINE_EVENT(s390_class_schid, s390_cio_rsch,
	TP_PROTO(struct subchannel_id schid, int cc),
	TP_ARGS(schid, cc)
);

/**
 * s390_cio_rchp - Reset Channel Path (RCHP) instruction was performed
 * @chpid: Channel-Path Identifier
 * @cc: Condition code
 */
TRACE_EVENT(s390_cio_rchp,
	TP_PROTO(struct chp_id chpid, int cc),
	TP_ARGS(chpid, cc),
	TP_STRUCT__entry(
		__field(u8, cssid)
		__field(u8, id)
		__field(int, cc)
	),
	TP_fast_assign(
		__entry->cssid = chpid.cssid;
		__entry->id = chpid.id;
		__entry->cc = cc;
	),
	TP_printk("chpid=%x.%02x cc=%d", __entry->cssid, __entry->id,
		  __entry->cc
	)
);

#define CHSC_MAX_REQUEST_LEN		64
#define CHSC_MAX_RESPONSE_LEN		64

/**
 * s390_cio_chsc - Channel Subsystem Call (CHSC) instruction was performed
 * @chsc: CHSC block
 * @cc: Condition code
 */
TRACE_EVENT(s390_cio_chsc,
	TP_PROTO(struct chsc_header *chsc, int cc),
	TP_ARGS(chsc, cc),
	TP_STRUCT__entry(
		__field(int, cc)
		__field(u16, code)
		__field(u16, rcode)
		__array(u8, request, CHSC_MAX_REQUEST_LEN)
		__array(u8, response, CHSC_MAX_RESPONSE_LEN)
	),
	TP_fast_assign(
		__entry->cc = cc;
		__entry->code = chsc->code;
		memcpy(&entry->request, chsc,
		       min_t(u16, chsc->length, CHSC_MAX_REQUEST_LEN));
		chsc = (struct chsc_header *) ((char *) chsc + chsc->length);
		__entry->rcode = chsc->code;
		memcpy(&entry->response, chsc,
		       min_t(u16, chsc->length, CHSC_MAX_RESPONSE_LEN));
	),
	TP_printk("code=0x%04x cc=%d rcode=0x%04x", __entry->code,
		  __entry->cc, __entry->rcode)
);

/**
 * s390_cio_interrupt - An I/O interrupt occurred
 * @tpi_info: Address of the I/O interruption code
 */
TRACE_EVENT(s390_cio_interrupt,
	TP_PROTO(struct tpi_info *tpi_info),
	TP_ARGS(tpi_info),
	TP_STRUCT__entry(
		__field_struct(struct tpi_info, tpi_info)
		__field(u8, cssid)
		__field(u8, ssid)
		__field(u16, schno)
	),
	TP_fast_assign(
		__entry->tpi_info = *tpi_info;
		__entry->cssid = __entry->tpi_info.schid.cssid;
		__entry->ssid = __entry->tpi_info.schid.ssid;
		__entry->schno = __entry->tpi_info.schid.sch_no;
	),
	TP_printk("schid=%x.%x.%04x isc=%d type=%d",
		  __entry->cssid, __entry->ssid, __entry->schno,
		  __entry->tpi_info.isc, __entry->tpi_info.type
	)
);

/**
 * s390_cio_adapter_int - An adapter interrupt occurred
 * @tpi_info: Address of the I/O interruption code
 */
TRACE_EVENT(s390_cio_adapter_int,
	TP_PROTO(struct tpi_info *tpi_info),
	TP_ARGS(tpi_info),
	TP_STRUCT__entry(
		__field_struct(struct tpi_info, tpi_info)
	),
	TP_fast_assign(
		__entry->tpi_info = *tpi_info;
	),
	TP_printk("isc=%d", __entry->tpi_info.isc)
);

/**
 * s390_cio_stcrw - Store Channel Report Word (STCRW) was performed
 * @crw: Channel Report Word
 * @cc: Condition code
 */
TRACE_EVENT(s390_cio_stcrw,
	TP_PROTO(struct crw *crw, int cc),
	TP_ARGS(crw, cc),
	TP_STRUCT__entry(
		__field_struct(struct crw, crw)
		__field(int, cc)
	),
	TP_fast_assign(
		__entry->crw = *crw;
		__entry->cc = cc;
	),
	TP_printk("cc=%d slct=%d oflw=%d chn=%d rsc=%d anc=%d erc=0x%x "
		  "rsid=0x%x",
		  __entry->cc, __entry->crw.slct, __entry->crw.oflw,
		  __entry->crw.chn, __entry->crw.rsc,  __entry->crw.anc,
		  __entry->crw.erc, __entry->crw.rsid
	)
);

#endif /* _TRACE_S390_CIO_H */

/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .

#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace

#include <trace/define_trace.h>