trace.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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. #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. memcpy(&__entry->tpi_info, &S390_lowcore.subchannel_id,
  164. sizeof(struct tpi_info));
  165. }
  166. __entry->cssid = __entry->tpi_info.schid.cssid;
  167. __entry->ssid = __entry->tpi_info.schid.ssid;
  168. __entry->schno = __entry->tpi_info.schid.sch_no;
  169. __entry->adapter_IO = __entry->tpi_info.adapter_IO;
  170. __entry->isc = __entry->tpi_info.isc;
  171. __entry->type = __entry->tpi_info.type;
  172. ),
  173. TP_printk("schid=%x.%x.%04x cc=%d a=%d isc=%d type=%d",
  174. __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
  175. __entry->adapter_IO, __entry->isc,
  176. __entry->type
  177. )
  178. );
  179. /**
  180. * s390_cio_ssch - Start Subchannel instruction (SSCH) was performed
  181. * @schid: Subchannel ID
  182. * @orb: Operation-Request Block
  183. * @cc: Condition code
  184. */
  185. TRACE_EVENT(s390_cio_ssch,
  186. TP_PROTO(struct subchannel_id schid, union orb *orb, int cc),
  187. TP_ARGS(schid, orb, cc),
  188. TP_STRUCT__entry(
  189. __field(u8, cssid)
  190. __field(u8, ssid)
  191. __field(u16, schno)
  192. __field_struct(union orb, orb)
  193. __field(int, cc)
  194. ),
  195. TP_fast_assign(
  196. __entry->cssid = schid.cssid;
  197. __entry->ssid = schid.ssid;
  198. __entry->schno = schid.sch_no;
  199. __entry->orb = *orb;
  200. __entry->cc = cc;
  201. ),
  202. TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
  203. __entry->schno, __entry->cc
  204. )
  205. );
  206. DECLARE_EVENT_CLASS(s390_class_schid,
  207. TP_PROTO(struct subchannel_id schid, int cc),
  208. TP_ARGS(schid, cc),
  209. TP_STRUCT__entry(
  210. __field(u8, cssid)
  211. __field(u8, ssid)
  212. __field(u16, schno)
  213. __field(int, cc)
  214. ),
  215. TP_fast_assign(
  216. __entry->cssid = schid.cssid;
  217. __entry->ssid = schid.ssid;
  218. __entry->schno = schid.sch_no;
  219. __entry->cc = cc;
  220. ),
  221. TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid,
  222. __entry->schno, __entry->cc
  223. )
  224. );
  225. /**
  226. * s390_cio_csch - Clear Subchannel instruction (CSCH) was performed
  227. * @schid: Subchannel ID
  228. * @cc: Condition code
  229. */
  230. DEFINE_EVENT(s390_class_schid, s390_cio_csch,
  231. TP_PROTO(struct subchannel_id schid, int cc),
  232. TP_ARGS(schid, cc)
  233. );
  234. /**
  235. * s390_cio_hsch - Halt Subchannel instruction (HSCH) was performed
  236. * @schid: Subchannel ID
  237. * @cc: Condition code
  238. */
  239. DEFINE_EVENT(s390_class_schid, s390_cio_hsch,
  240. TP_PROTO(struct subchannel_id schid, int cc),
  241. TP_ARGS(schid, cc)
  242. );
  243. /**
  244. * s390_cio_xsch - Cancel Subchannel instruction (XSCH) was performed
  245. * @schid: Subchannel ID
  246. * @cc: Condition code
  247. */
  248. DEFINE_EVENT(s390_class_schid, s390_cio_xsch,
  249. TP_PROTO(struct subchannel_id schid, int cc),
  250. TP_ARGS(schid, cc)
  251. );
  252. /**
  253. * s390_cio_rsch - Resume Subchannel instruction (RSCH) was performed
  254. * @schid: Subchannel ID
  255. * @cc: Condition code
  256. */
  257. DEFINE_EVENT(s390_class_schid, s390_cio_rsch,
  258. TP_PROTO(struct subchannel_id schid, int cc),
  259. TP_ARGS(schid, cc)
  260. );
  261. /**
  262. * s390_cio_rchp - Reset Channel Path (RCHP) instruction was performed
  263. * @chpid: Channel-Path Identifier
  264. * @cc: Condition code
  265. */
  266. TRACE_EVENT(s390_cio_rchp,
  267. TP_PROTO(struct chp_id chpid, int cc),
  268. TP_ARGS(chpid, cc),
  269. TP_STRUCT__entry(
  270. __field(u8, cssid)
  271. __field(u8, id)
  272. __field(int, cc)
  273. ),
  274. TP_fast_assign(
  275. __entry->cssid = chpid.cssid;
  276. __entry->id = chpid.id;
  277. __entry->cc = cc;
  278. ),
  279. TP_printk("chpid=%x.%02x cc=%d", __entry->cssid, __entry->id,
  280. __entry->cc
  281. )
  282. );
  283. #define CHSC_MAX_REQUEST_LEN 64
  284. #define CHSC_MAX_RESPONSE_LEN 64
  285. /**
  286. * s390_cio_chsc - Channel Subsystem Call (CHSC) instruction was performed
  287. * @chsc: CHSC block
  288. * @cc: Condition code
  289. */
  290. TRACE_EVENT(s390_cio_chsc,
  291. TP_PROTO(struct chsc_header *chsc, int cc),
  292. TP_ARGS(chsc, cc),
  293. TP_STRUCT__entry(
  294. __field(int, cc)
  295. __field(u16, code)
  296. __field(u16, rcode)
  297. __array(u8, request, CHSC_MAX_REQUEST_LEN)
  298. __array(u8, response, CHSC_MAX_RESPONSE_LEN)
  299. ),
  300. TP_fast_assign(
  301. __entry->cc = cc;
  302. __entry->code = chsc->code;
  303. memcpy(&entry->request, chsc,
  304. min_t(u16, chsc->length, CHSC_MAX_REQUEST_LEN));
  305. chsc = (struct chsc_header *) ((char *) chsc + chsc->length);
  306. __entry->rcode = chsc->code;
  307. memcpy(&entry->response, chsc,
  308. min_t(u16, chsc->length, CHSC_MAX_RESPONSE_LEN));
  309. ),
  310. TP_printk("code=0x%04x cc=%d rcode=0x%04x", __entry->code,
  311. __entry->cc, __entry->rcode)
  312. );
  313. /**
  314. * s390_cio_interrupt - An I/O interrupt occurred
  315. * @tpi_info: Address of the I/O interruption code
  316. */
  317. TRACE_EVENT(s390_cio_interrupt,
  318. TP_PROTO(struct tpi_info *tpi_info),
  319. TP_ARGS(tpi_info),
  320. TP_STRUCT__entry(
  321. __field_struct(struct tpi_info, tpi_info)
  322. __field(u8, cssid)
  323. __field(u8, ssid)
  324. __field(u16, schno)
  325. __field(u8, isc)
  326. __field(u8, type)
  327. ),
  328. TP_fast_assign(
  329. __entry->tpi_info = *tpi_info;
  330. __entry->cssid = tpi_info->schid.cssid;
  331. __entry->ssid = tpi_info->schid.ssid;
  332. __entry->schno = tpi_info->schid.sch_no;
  333. __entry->isc = tpi_info->isc;
  334. __entry->type = tpi_info->type;
  335. ),
  336. TP_printk("schid=%x.%x.%04x isc=%d type=%d",
  337. __entry->cssid, __entry->ssid, __entry->schno,
  338. __entry->isc, __entry->type
  339. )
  340. );
  341. /**
  342. * s390_cio_adapter_int - An adapter interrupt occurred
  343. * @tpi_info: Address of the I/O interruption code
  344. */
  345. TRACE_EVENT(s390_cio_adapter_int,
  346. TP_PROTO(struct tpi_info *tpi_info),
  347. TP_ARGS(tpi_info),
  348. TP_STRUCT__entry(
  349. __field_struct(struct tpi_info, tpi_info)
  350. __field(u8, isc)
  351. ),
  352. TP_fast_assign(
  353. __entry->tpi_info = *tpi_info;
  354. __entry->isc = tpi_info->isc;
  355. ),
  356. TP_printk("isc=%d", __entry->isc)
  357. );
  358. /**
  359. * s390_cio_stcrw - Store Channel Report Word (STCRW) was performed
  360. * @crw: Channel Report Word
  361. * @cc: Condition code
  362. */
  363. TRACE_EVENT(s390_cio_stcrw,
  364. TP_PROTO(struct crw *crw, int cc),
  365. TP_ARGS(crw, cc),
  366. TP_STRUCT__entry(
  367. __field_struct(struct crw, crw)
  368. __field(int, cc)
  369. __field(u8, slct)
  370. __field(u8, oflw)
  371. __field(u8, chn)
  372. __field(u8, rsc)
  373. __field(u8, anc)
  374. __field(u8, erc)
  375. __field(u16, rsid)
  376. ),
  377. TP_fast_assign(
  378. __entry->crw = *crw;
  379. __entry->cc = cc;
  380. __entry->slct = crw->slct;
  381. __entry->oflw = crw->oflw;
  382. __entry->chn = crw->chn;
  383. __entry->rsc = crw->rsc;
  384. __entry->anc = crw->anc;
  385. __entry->erc = crw->erc;
  386. __entry->rsid = crw->rsid;
  387. ),
  388. TP_printk("cc=%d slct=%d oflw=%d chn=%d rsc=%d anc=%d erc=0x%x "
  389. "rsid=0x%x",
  390. __entry->cc, __entry->slct, __entry->oflw,
  391. __entry->chn, __entry->rsc, __entry->anc,
  392. __entry->erc, __entry->rsid
  393. )
  394. );
  395. #endif /* _TRACE_S390_CIO_H */
  396. /* This part must be outside protection */
  397. #undef TRACE_INCLUDE_PATH
  398. #define TRACE_INCLUDE_PATH .
  399. #undef TRACE_INCLUDE_FILE
  400. #define TRACE_INCLUDE_FILE trace
  401. #include <trace/define_trace.h>