blob: 4803139bce14934e052d7b6bee9ae3f152fb58cc [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Peter Oberparleiter42248972015-12-18 12:59:36 +01002/*
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
24DECLARE_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)
Thomas Richterd1de8632018-07-03 11:21:06 +020033 __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)
Peter Oberparleiter42248972015-12-18 12:59:36 +010044 __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;
Thomas Richterd1de8632018-07-03 11:21:06 +020052 __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);
Peter Oberparleiter42248972015-12-18 12:59:36 +010063 __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,
Thomas Richterd1de8632018-07-03 11:21:06 +020069 __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
Peter Oberparleiter42248972015-12-18 12:59:36 +010075 )
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 */
84DEFINE_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 */
95DEFINE_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 */
106TRACE_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)
Thomas Richter933df442018-07-09 10:30:34 +0200114 __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)
Peter Oberparleiter42248972015-12-18 12:59:36 +0100121 __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;
Thomas Richter933df442018-07-09 10:30:34 +0200128 __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);
Peter Oberparleiter42248972015-12-18 12:59:36 +0100135 __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,
Thomas Richter933df442018-07-09 10:30:34 +0200140 __entry->scsw_dcc, __entry->scsw_pno,
141 __entry->scsw_fctl, __entry->scsw_actl,
142 __entry->scsw_stctl,
143 __entry->scsw_dstat, __entry->scsw_cstat
Peter Oberparleiter42248972015-12-18 12:59:36 +0100144 )
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 */
152TRACE_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)
Thomas Richter5925e812018-07-03 10:15:10 +0200161 __field(u8, adapter_IO)
162 __field(u8, isc)
163 __field(u8, type)
Peter Oberparleiter42248972015-12-18 12:59:36 +0100164 ),
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 memcpy(&__entry->tpi_info, &S390_lowcore.subchannel_id,
173 sizeof(struct tpi_info));
174 }
175 __entry->cssid = __entry->tpi_info.schid.cssid;
176 __entry->ssid = __entry->tpi_info.schid.ssid;
177 __entry->schno = __entry->tpi_info.schid.sch_no;
Thomas Richter5925e812018-07-03 10:15:10 +0200178 __entry->adapter_IO = __entry->tpi_info.adapter_IO;
179 __entry->isc = __entry->tpi_info.isc;
180 __entry->type = __entry->tpi_info.type;
Peter Oberparleiter42248972015-12-18 12:59:36 +0100181 ),
182 TP_printk("schid=%x.%x.%04x cc=%d a=%d isc=%d type=%d",
183 __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
Thomas Richter5925e812018-07-03 10:15:10 +0200184 __entry->adapter_IO, __entry->isc,
185 __entry->type
Peter Oberparleiter42248972015-12-18 12:59:36 +0100186 )
187);
188
189/**
190 * s390_cio_ssch - Start Subchannel instruction (SSCH) was performed
191 * @schid: Subchannel ID
192 * @orb: Operation-Request Block
193 * @cc: Condition code
194 */
195TRACE_EVENT(s390_cio_ssch,
196 TP_PROTO(struct subchannel_id schid, union orb *orb, int cc),
197 TP_ARGS(schid, orb, cc),
198 TP_STRUCT__entry(
199 __field(u8, cssid)
200 __field(u8, ssid)
201 __field(u16, schno)
202 __field_struct(union orb, orb)
203 __field(int, cc)
204 ),
205 TP_fast_assign(
206 __entry->cssid = schid.cssid;
207 __entry->ssid = schid.ssid;
208 __entry->schno = schid.sch_no;
209 __entry->orb = *orb;
210 __entry->cc = cc;
211 ),
212 TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
213 __entry->schno, __entry->cc
214 )
215);
216
217DECLARE_EVENT_CLASS(s390_class_schid,
218 TP_PROTO(struct subchannel_id schid, int cc),
219 TP_ARGS(schid, cc),
220 TP_STRUCT__entry(
221 __field(u8, cssid)
222 __field(u8, ssid)
223 __field(u16, schno)
224 __field(int, cc)
225 ),
226 TP_fast_assign(
227 __entry->cssid = schid.cssid;
228 __entry->ssid = schid.ssid;
229 __entry->schno = schid.sch_no;
230 __entry->cc = cc;
231 ),
232 TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
233 __entry->schno, __entry->cc
234 )
235);
236
237/**
238 * s390_cio_csch - Clear Subchannel instruction (CSCH) was performed
239 * @schid: Subchannel ID
240 * @cc: Condition code
241 */
242DEFINE_EVENT(s390_class_schid, s390_cio_csch,
243 TP_PROTO(struct subchannel_id schid, int cc),
244 TP_ARGS(schid, cc)
245);
246
247/**
248 * s390_cio_hsch - Halt Subchannel instruction (HSCH) was performed
249 * @schid: Subchannel ID
250 * @cc: Condition code
251 */
252DEFINE_EVENT(s390_class_schid, s390_cio_hsch,
253 TP_PROTO(struct subchannel_id schid, int cc),
254 TP_ARGS(schid, cc)
255);
256
257/**
258 * s390_cio_xsch - Cancel Subchannel instruction (XSCH) was performed
259 * @schid: Subchannel ID
260 * @cc: Condition code
261 */
262DEFINE_EVENT(s390_class_schid, s390_cio_xsch,
263 TP_PROTO(struct subchannel_id schid, int cc),
264 TP_ARGS(schid, cc)
265);
266
267/**
268 * s390_cio_rsch - Resume Subchannel instruction (RSCH) was performed
269 * @schid: Subchannel ID
270 * @cc: Condition code
271 */
272DEFINE_EVENT(s390_class_schid, s390_cio_rsch,
273 TP_PROTO(struct subchannel_id schid, int cc),
274 TP_ARGS(schid, cc)
275);
276
Peter Oberparleiter42248972015-12-18 12:59:36 +0100277#define CHSC_MAX_REQUEST_LEN 64
278#define CHSC_MAX_RESPONSE_LEN 64
279
280/**
281 * s390_cio_chsc - Channel Subsystem Call (CHSC) instruction was performed
282 * @chsc: CHSC block
283 * @cc: Condition code
284 */
285TRACE_EVENT(s390_cio_chsc,
286 TP_PROTO(struct chsc_header *chsc, int cc),
287 TP_ARGS(chsc, cc),
288 TP_STRUCT__entry(
289 __field(int, cc)
290 __field(u16, code)
291 __field(u16, rcode)
292 __array(u8, request, CHSC_MAX_REQUEST_LEN)
293 __array(u8, response, CHSC_MAX_RESPONSE_LEN)
294 ),
295 TP_fast_assign(
296 __entry->cc = cc;
297 __entry->code = chsc->code;
298 memcpy(&entry->request, chsc,
299 min_t(u16, chsc->length, CHSC_MAX_REQUEST_LEN));
300 chsc = (struct chsc_header *) ((char *) chsc + chsc->length);
301 __entry->rcode = chsc->code;
302 memcpy(&entry->response, chsc,
303 min_t(u16, chsc->length, CHSC_MAX_RESPONSE_LEN));
304 ),
305 TP_printk("code=0x%04x cc=%d rcode=0x%04x", __entry->code,
306 __entry->cc, __entry->rcode)
307);
308
309/**
310 * s390_cio_interrupt - An I/O interrupt occurred
311 * @tpi_info: Address of the I/O interruption code
312 */
313TRACE_EVENT(s390_cio_interrupt,
314 TP_PROTO(struct tpi_info *tpi_info),
315 TP_ARGS(tpi_info),
316 TP_STRUCT__entry(
317 __field_struct(struct tpi_info, tpi_info)
318 __field(u8, cssid)
319 __field(u8, ssid)
320 __field(u16, schno)
Thomas Richter661c9592018-07-03 09:41:12 +0200321 __field(u8, isc)
322 __field(u8, type)
Peter Oberparleiter42248972015-12-18 12:59:36 +0100323 ),
324 TP_fast_assign(
325 __entry->tpi_info = *tpi_info;
Thomas Richter661c9592018-07-03 09:41:12 +0200326 __entry->cssid = tpi_info->schid.cssid;
327 __entry->ssid = tpi_info->schid.ssid;
328 __entry->schno = tpi_info->schid.sch_no;
329 __entry->isc = tpi_info->isc;
330 __entry->type = tpi_info->type;
Peter Oberparleiter42248972015-12-18 12:59:36 +0100331 ),
332 TP_printk("schid=%x.%x.%04x isc=%d type=%d",
333 __entry->cssid, __entry->ssid, __entry->schno,
Thomas Richter661c9592018-07-03 09:41:12 +0200334 __entry->isc, __entry->type
Peter Oberparleiter42248972015-12-18 12:59:36 +0100335 )
336);
337
338/**
339 * s390_cio_adapter_int - An adapter interrupt occurred
340 * @tpi_info: Address of the I/O interruption code
341 */
342TRACE_EVENT(s390_cio_adapter_int,
343 TP_PROTO(struct tpi_info *tpi_info),
344 TP_ARGS(tpi_info),
345 TP_STRUCT__entry(
346 __field_struct(struct tpi_info, tpi_info)
Thomas Richter27c06202018-07-03 10:38:16 +0200347 __field(u8, isc)
Peter Oberparleiter42248972015-12-18 12:59:36 +0100348 ),
349 TP_fast_assign(
350 __entry->tpi_info = *tpi_info;
Thomas Richter27c06202018-07-03 10:38:16 +0200351 __entry->isc = tpi_info->isc;
Peter Oberparleiter42248972015-12-18 12:59:36 +0100352 ),
Thomas Richter27c06202018-07-03 10:38:16 +0200353 TP_printk("isc=%d", __entry->isc)
Peter Oberparleiter42248972015-12-18 12:59:36 +0100354);
355
356/**
357 * s390_cio_stcrw - Store Channel Report Word (STCRW) was performed
358 * @crw: Channel Report Word
359 * @cc: Condition code
360 */
361TRACE_EVENT(s390_cio_stcrw,
362 TP_PROTO(struct crw *crw, int cc),
363 TP_ARGS(crw, cc),
364 TP_STRUCT__entry(
365 __field_struct(struct crw, crw)
366 __field(int, cc)
Thomas Richter67faae12018-07-11 10:27:12 +0200367 __field(u8, slct)
368 __field(u8, oflw)
369 __field(u8, chn)
370 __field(u8, rsc)
371 __field(u8, anc)
372 __field(u8, erc)
373 __field(u16, rsid)
Peter Oberparleiter42248972015-12-18 12:59:36 +0100374 ),
375 TP_fast_assign(
376 __entry->crw = *crw;
377 __entry->cc = cc;
Thomas Richter67faae12018-07-11 10:27:12 +0200378 __entry->slct = crw->slct;
379 __entry->oflw = crw->oflw;
380 __entry->chn = crw->chn;
381 __entry->rsc = crw->rsc;
382 __entry->anc = crw->anc;
383 __entry->erc = crw->erc;
384 __entry->rsid = crw->rsid;
Peter Oberparleiter42248972015-12-18 12:59:36 +0100385 ),
386 TP_printk("cc=%d slct=%d oflw=%d chn=%d rsc=%d anc=%d erc=0x%x "
387 "rsid=0x%x",
Thomas Richter67faae12018-07-11 10:27:12 +0200388 __entry->cc, __entry->slct, __entry->oflw,
389 __entry->chn, __entry->rsc, __entry->anc,
390 __entry->erc, __entry->rsid
Peter Oberparleiter42248972015-12-18 12:59:36 +0100391 )
392);
393
394#endif /* _TRACE_S390_CIO_H */
395
396/* This part must be outside protection */
397#undef TRACE_INCLUDE_PATH
398#define TRACE_INCLUDE_PATH .
399
400#undef TRACE_INCLUDE_FILE
401#define TRACE_INCLUDE_FILE trace
402
403#include <trace/define_trace.h>