1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Tracepoints for vfio_ccw driver
3  *
4  * Copyright IBM Corp. 2018
5  *
6  * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
7  *            Halil Pasic <pasic@linux.vnet.ibm.com>
8  */
9 
10 #include "cio.h"
11 
12 #undef TRACE_SYSTEM
13 #define TRACE_SYSTEM vfio_ccw
14 
15 #if !defined(_VFIO_CCW_TRACE_) || defined(TRACE_HEADER_MULTI_READ)
16 #define _VFIO_CCW_TRACE_
17 
18 #include <linux/tracepoint.h>
19 
20 TRACE_EVENT(vfio_ccw_chp_event,
21 	TP_PROTO(struct subchannel_id schid,
22 		 int mask,
23 		 int event),
24 	TP_ARGS(schid, mask, event),
25 
26 	TP_STRUCT__entry(
27 		__field(u8, cssid)
28 		__field(u8, ssid)
29 		__field(u16, sch_no)
30 		__field(int, mask)
31 		__field(int, event)
32 	),
33 
34 	TP_fast_assign(
35 		__entry->cssid = schid.cssid;
36 		__entry->ssid = schid.ssid;
37 		__entry->sch_no = schid.sch_no;
38 		__entry->mask = mask;
39 		__entry->event = event;
40 	),
41 
42 	TP_printk("schid=%x.%x.%04x mask=0x%x event=%d",
43 		  __entry->cssid,
44 		  __entry->ssid,
45 		  __entry->sch_no,
46 		  __entry->mask,
47 		  __entry->event)
48 );
49 
50 TRACE_EVENT(vfio_ccw_fsm_async_request,
51 	TP_PROTO(struct subchannel_id schid,
52 		 int command,
53 		 int errno),
54 	TP_ARGS(schid, command, errno),
55 
56 	TP_STRUCT__entry(
57 		__field(u8, cssid)
58 		__field(u8, ssid)
59 		__field(u16, sch_no)
60 		__field(int, command)
61 		__field(int, errno)
62 	),
63 
64 	TP_fast_assign(
65 		__entry->cssid = schid.cssid;
66 		__entry->ssid = schid.ssid;
67 		__entry->sch_no = schid.sch_no;
68 		__entry->command = command;
69 		__entry->errno = errno;
70 	),
71 
72 	TP_printk("schid=%x.%x.%04x command=0x%x errno=%d",
73 		  __entry->cssid,
74 		  __entry->ssid,
75 		  __entry->sch_no,
76 		  __entry->command,
77 		  __entry->errno)
78 );
79 
80 TRACE_EVENT(vfio_ccw_fsm_event,
81 	TP_PROTO(struct subchannel_id schid, int state, int event),
82 	TP_ARGS(schid, state, event),
83 
84 	TP_STRUCT__entry(
85 		__field(u8, cssid)
86 		__field(u8, ssid)
87 		__field(u16, schno)
88 		__field(int, state)
89 		__field(int, event)
90 	),
91 
92 	TP_fast_assign(
93 		__entry->cssid = schid.cssid;
94 		__entry->ssid = schid.ssid;
95 		__entry->schno = schid.sch_no;
96 		__entry->state = state;
97 		__entry->event = event;
98 	),
99 
100 	TP_printk("schid=%x.%x.%04x state=%d event=%d",
101 		__entry->cssid, __entry->ssid, __entry->schno,
102 		__entry->state,
103 		__entry->event)
104 );
105 
106 TRACE_EVENT(vfio_ccw_fsm_io_request,
107 	TP_PROTO(int fctl, struct subchannel_id schid, int errno, char *errstr),
108 	TP_ARGS(fctl, schid, errno, errstr),
109 
110 	TP_STRUCT__entry(
111 		__field(u8, cssid)
112 		__field(u8, ssid)
113 		__field(u16, sch_no)
114 		__field(int, fctl)
115 		__field(int, errno)
116 		__field(char*, errstr)
117 	),
118 
119 	TP_fast_assign(
120 		__entry->cssid = schid.cssid;
121 		__entry->ssid = schid.ssid;
122 		__entry->sch_no = schid.sch_no;
123 		__entry->fctl = fctl;
124 		__entry->errno = errno;
125 		__entry->errstr = errstr;
126 	),
127 
128 	TP_printk("schid=%x.%x.%04x fctl=0x%x errno=%d info=%s",
129 		  __entry->cssid,
130 		  __entry->ssid,
131 		  __entry->sch_no,
132 		  __entry->fctl,
133 		  __entry->errno,
134 		  __entry->errstr)
135 );
136 
137 #endif /* _VFIO_CCW_TRACE_ */
138 
139 /* This part must be outside protection */
140 
141 #undef TRACE_INCLUDE_PATH
142 #define TRACE_INCLUDE_PATH .
143 #undef TRACE_INCLUDE_FILE
144 #define TRACE_INCLUDE_FILE vfio_ccw_trace
145 
146 #include <trace/define_trace.h>
147