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