trace.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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 <[email protected]>
  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. #undef TRACE_SYSTEM
  15. #define TRACE_SYSTEM s390
  16. #if !defined(_TRACE_S390_CIO_H) || defined(TRACE_HEADER_MULTI_READ)
  17. #define _TRACE_S390_CIO_H
  18. #include <linux/tracepoint.h>
  19. DECLARE_EVENT_CLASS(s390_class_schib,
  20. TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc),
  21. TP_ARGS(schid, schib, cc),
  22. TP_STRUCT__entry(
  23. __field(u8, cssid)
  24. __field(u8, ssid)
  25. __field(u16, schno)
  26. __field(u16, devno)
  27. __field_struct(struct schib, schib)
  28. __field(u8, pmcw_ena)
  29. __field(u8, pmcw_st)
  30. __field(u8, pmcw_dnv)
  31. __field(u16, pmcw_dev)
  32. __field(u8, pmcw_lpm)
  33. __field(u8, pmcw_pnom)
  34. __field(u8, pmcw_lpum)
  35. __field(u8, pmcw_pim)
  36. __field(u8, pmcw_pam)
  37. __field(u8, pmcw_pom)
  38. __field(u64, pmcw_chpid)
  39. __field(int, cc)
  40. ),
  41. TP_fast_assign(
  42. __entry->cssid = schid.cssid;
  43. __entry->ssid = schid.ssid;
  44. __entry->schno = schid.sch_no;
  45. __entry->devno = schib->pmcw.dev;
  46. __entry->schib = *schib;
  47. __entry->pmcw_ena = schib->pmcw.ena;
  48. __entry->pmcw_st = schib->pmcw.ena;
  49. __entry->pmcw_dnv = schib->pmcw.dnv;
  50. __entry->pmcw_dev = schib->pmcw.dev;
  51. __entry->pmcw_lpm = schib->pmcw.lpm;
  52. __entry->pmcw_pnom = schib->pmcw.pnom;
  53. __entry->pmcw_lpum = schib->pmcw.lpum;
  54. __entry->pmcw_pim = schib->pmcw.pim;
  55. __entry->pmcw_pam = schib->pmcw.pam;
  56. __entry->pmcw_pom = schib->pmcw.pom;
  57. memcpy(&__entry->pmcw_chpid, &schib->pmcw.chpid, 8);
  58. __entry->cc = cc;
  59. ),
  60. TP_printk("schid=%x.%x.%04x cc=%d ena=%d st=%d dnv=%d dev=%04x "
  61. "lpm=0x%02x pnom=0x%02x lpum=0x%02x pim=0x%02x pam=0x%02x "
  62. "pom=0x%02x chpids=%016llx",
  63. __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
  64. __entry->pmcw_ena, __entry->pmcw_st,
  65. __entry->pmcw_dnv, __entry->pmcw_dev,
  66. __entry->pmcw_lpm, __entry->pmcw_pnom,
  67. __entry->pmcw_lpum, __entry->pmcw_pim,
  68. __entry->pmcw_pam, __entry->pmcw_pom,
  69. __entry->pmcw_chpid
  70. )
  71. );
  72. /**
  73. * s390_cio_stsch - Store Subchannel instruction (STSCH) was performed
  74. * @schid: Subchannel ID
  75. * @schib: Subchannel-Information block
  76. * @cc: Condition code
  77. */
  78. DEFINE_EVENT(s390_class_schib, s390_cio_stsch,
  79. TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc),
  80. TP_ARGS(schid, schib, cc)
  81. );
  82. /**
  83. * s390_cio_msch - Modify Subchannel instruction (MSCH) was performed
  84. * @schid: Subchannel ID
  85. * @schib: Subchannel-Information block
  86. * @cc: Condition code
  87. */
  88. DEFINE_EVENT(s390_class_schib, s390_cio_msch,
  89. TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc),
  90. TP_ARGS(schid, schib, cc)
  91. );
  92. /**
  93. * s390_cio_tsch - Test Subchannel instruction (TSCH) was performed
  94. * @schid: Subchannel ID
  95. * @irb: Interruption-Response Block
  96. * @cc: Condition code
  97. */
  98. TRACE_EVENT(s390_cio_tsch,
  99. TP_PROTO(struct subchannel_id schid, struct irb *irb, int cc),
  100. TP_ARGS(schid, irb, cc),
  101. TP_STRUCT__entry(
  102. __field(u8, cssid)
  103. __field(u8, ssid)
  104. __field(u16, schno)
  105. __field_struct(struct irb, irb)
  106. __field(u8, scsw_dcc)
  107. __field(u8, scsw_pno)
  108. __field(u8, scsw_fctl)
  109. __field(u8, scsw_actl)
  110. __field(u8, scsw_stctl)
  111. __field(u8, scsw_dstat)
  112. __field(u8, scsw_cstat)
  113. __field(int, cc)
  114. ),
  115. TP_fast_assign(
  116. __entry->cssid = schid.cssid;
  117. __entry->ssid = schid.ssid;
  118. __entry->schno = schid.sch_no;
  119. __entry->irb = *irb;
  120. __entry->scsw_dcc = scsw_cc(&irb->scsw);
  121. __entry->scsw_pno = scsw_pno(&irb->scsw);
  122. __entry->scsw_fctl = scsw_fctl(&irb->scsw);
  123. __entry->scsw_actl = scsw_actl(&irb->scsw);
  124. __entry->scsw_stctl = scsw_stctl(&irb->scsw);
  125. __entry->scsw_dstat = scsw_dstat(&irb->scsw);
  126. __entry->scsw_cstat = scsw_cstat(&irb->scsw);
  127. __entry->cc = cc;
  128. ),
  129. TP_printk("schid=%x.%x.%04x cc=%d dcc=%d pno=%d fctl=0x%x actl=0x%x "
  130. "stctl=0x%x dstat=0x%x cstat=0x%x",
  131. __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
  132. __entry->scsw_dcc, __entry->scsw_pno,
  133. __entry->scsw_fctl, __entry->scsw_actl,
  134. __entry->scsw_stctl,
  135. __entry->scsw_dstat, __entry->scsw_cstat
  136. )
  137. );
  138. /**
  139. * s390_cio_tpi - Test Pending Interruption instruction (TPI) was performed
  140. * @addr: Address of the I/O interruption code or %NULL
  141. * @cc: Condition code
  142. */
  143. TRACE_EVENT(s390_cio_tpi,
  144. TP_PROTO(struct tpi_info *addr, int cc),
  145. TP_ARGS(addr, cc),
  146. TP_STRUCT__entry(
  147. __field(int, cc)
  148. __field_struct(struct tpi_info, tpi_info)
  149. __field(u8, cssid)
  150. __field(u8, ssid)
  151. __field(u16, schno)
  152. __field(u8, adapter_IO)
  153. __field(u8, isc)
  154. __field(u8, type)
  155. ),
  156. TP_fast_assign(
  157. __entry->cc = cc;
  158. if (cc != 0)
  159. memset(&__entry->tpi_info, 0, sizeof(struct tpi_info));
  160. else if (addr)
  161. __entry->tpi_info = *addr;
  162. else
  163. __entry->tpi_info = S390_lowcore.tpi_info;
  164. __entry->cssid = __entry->tpi_info.schid.cssid;
  165. __entry->ssid = __entry->tpi_info.schid.ssid;
  166. __entry->schno = __entry->tpi_info.schid.sch_no;
  167. __entry->adapter_IO = __entry->tpi_info.adapter_IO;
  168. __entry->isc = __entry->tpi_info.isc;
  169. __entry->type = __entry->tpi_info.type;
  170. ),
  171. TP_printk("schid=%x.%x.%04x cc=%d a=%d isc=%d type=%d",
  172. __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
  173. __entry->adapter_IO, __entry->isc,
  174. __entry->type
  175. )
  176. );
  177. /**
  178. * s390_cio_ssch - Start Subchannel instruction (SSCH) was performed
  179. * @schid: Subchannel ID
  180. * @orb: Operation-Request Block
  181. * @cc: Condition code
  182. */
  183. TRACE_EVENT(s390_cio_ssch,
  184. TP_PROTO(struct subchannel_id schid, union orb *orb, int cc),
  185. TP_ARGS(schid, orb, cc),
  186. TP_STRUCT__entry(
  187. __field(u8, cssid)
  188. __field(u8, ssid)
  189. __field(u16, schno)
  190. __field_struct(union orb, orb)
  191. __field(int, cc)
  192. ),
  193. TP_fast_assign(
  194. __entry->cssid = schid.cssid;
  195. __entry->ssid = schid.ssid;
  196. __entry->schno = schid.sch_no;
  197. __entry->orb = *orb;
  198. __entry->cc = cc;
  199. ),
  200. TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
  201. __entry->schno, __entry->cc
  202. )
  203. );
  204. DECLARE_EVENT_CLASS(s390_class_schid,
  205. TP_PROTO(struct subchannel_id schid, int cc),
  206. TP_ARGS(schid, cc),
  207. TP_STRUCT__entry(
  208. __field(u8, cssid)
  209. __field(u8, ssid)
  210. __field(u16, schno)
  211. __field(int, cc)
  212. ),
  213. TP_fast_assign(
  214. __entry->cssid = schid.cssid;
  215. __entry->ssid = schid.ssid;
  216. __entry->schno = schid.sch_no;
  217. __entry->cc = cc;
  218. ),
  219. TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
  220. __entry->schno, __entry->cc
  221. )
  222. );
  223. /**
  224. * s390_cio_csch - Clear Subchannel instruction (CSCH) was performed
  225. * @schid: Subchannel ID
  226. * @cc: Condition code
  227. */
  228. DEFINE_EVENT(s390_class_schid, s390_cio_csch,
  229. TP_PROTO(struct subchannel_id schid, int cc),
  230. TP_ARGS(schid, cc)
  231. );
  232. /**
  233. * s390_cio_hsch - Halt Subchannel instruction (HSCH) was performed
  234. * @schid: Subchannel ID
  235. * @cc: Condition code
  236. */
  237. DEFINE_EVENT(s390_class_schid, s390_cio_hsch,
  238. TP_PROTO(struct subchannel_id schid, int cc),
  239. TP_ARGS(schid, cc)
  240. );
  241. /**
  242. * s390_cio_xsch - Cancel Subchannel instruction (XSCH) was performed
  243. * @schid: Subchannel ID
  244. * @cc: Condition code
  245. */
  246. DEFINE_EVENT(s390_class_schid, s390_cio_xsch,
  247. TP_PROTO(struct subchannel_id schid, int cc),
  248. TP_ARGS(schid, cc)
  249. );
  250. /**
  251. * s390_cio_rsch - Resume Subchannel instruction (RSCH) was performed
  252. * @schid: Subchannel ID
  253. * @cc: Condition code
  254. */
  255. DEFINE_EVENT(s390_class_schid, s390_cio_rsch,
  256. TP_PROTO(struct subchannel_id schid, int cc),
  257. TP_ARGS(schid, cc)
  258. );
  259. #define CHSC_MAX_REQUEST_LEN 64
  260. #define CHSC_MAX_RESPONSE_LEN 64
  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. * 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. __field(u8, isc)
  302. __field(u8, type)
  303. ),
  304. TP_fast_assign(
  305. __entry->tpi_info = *tpi_info;
  306. __entry->cssid = tpi_info->schid.cssid;
  307. __entry->ssid = tpi_info->schid.ssid;
  308. __entry->schno = tpi_info->schid.sch_no;
  309. __entry->isc = tpi_info->isc;
  310. __entry->type = tpi_info->type;
  311. ),
  312. TP_printk("schid=%x.%x.%04x isc=%d type=%d",
  313. __entry->cssid, __entry->ssid, __entry->schno,
  314. __entry->isc, __entry->type
  315. )
  316. );
  317. /**
  318. * s390_cio_adapter_int - An adapter interrupt occurred
  319. * @tpi_info: Address of the I/O interruption code
  320. */
  321. TRACE_EVENT(s390_cio_adapter_int,
  322. TP_PROTO(struct tpi_info *tpi_info),
  323. TP_ARGS(tpi_info),
  324. TP_STRUCT__entry(
  325. __field_struct(struct tpi_info, tpi_info)
  326. __field(u8, isc)
  327. ),
  328. TP_fast_assign(
  329. __entry->tpi_info = *tpi_info;
  330. __entry->isc = tpi_info->isc;
  331. ),
  332. TP_printk("isc=%d", __entry->isc)
  333. );
  334. /**
  335. * s390_cio_stcrw - Store Channel Report Word (STCRW) was performed
  336. * @crw: Channel Report Word
  337. * @cc: Condition code
  338. */
  339. TRACE_EVENT(s390_cio_stcrw,
  340. TP_PROTO(struct crw *crw, int cc),
  341. TP_ARGS(crw, cc),
  342. TP_STRUCT__entry(
  343. __field_struct(struct crw, crw)
  344. __field(int, cc)
  345. __field(u8, slct)
  346. __field(u8, oflw)
  347. __field(u8, chn)
  348. __field(u8, rsc)
  349. __field(u8, anc)
  350. __field(u8, erc)
  351. __field(u16, rsid)
  352. ),
  353. TP_fast_assign(
  354. __entry->crw = *crw;
  355. __entry->cc = cc;
  356. __entry->slct = crw->slct;
  357. __entry->oflw = crw->oflw;
  358. __entry->chn = crw->chn;
  359. __entry->rsc = crw->rsc;
  360. __entry->anc = crw->anc;
  361. __entry->erc = crw->erc;
  362. __entry->rsid = crw->rsid;
  363. ),
  364. TP_printk("cc=%d slct=%d oflw=%d chn=%d rsc=%d anc=%d erc=0x%x "
  365. "rsid=0x%x",
  366. __entry->cc, __entry->slct, __entry->oflw,
  367. __entry->chn, __entry->rsc, __entry->anc,
  368. __entry->erc, __entry->rsid
  369. )
  370. );
  371. #endif /* _TRACE_S390_CIO_H */
  372. /* This part must be outside protection */
  373. #undef TRACE_INCLUDE_PATH
  374. #define TRACE_INCLUDE_PATH .
  375. #undef TRACE_INCLUDE_FILE
  376. #define TRACE_INCLUDE_FILE trace
  377. #include <trace/define_trace.h>