1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_VIRTGPU_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
3 #define _VIRTGPU_TRACE_H_
4 
5 #include <linux/tracepoint.h>
6 
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM virtio_gpu
9 #define TRACE_INCLUDE_FILE virtgpu_trace
10 
11 DECLARE_EVENT_CLASS(virtio_gpu_cmd,
12 	TP_PROTO(struct virtqueue *vq, struct virtio_gpu_ctrl_hdr *hdr, u32 seqno),
13 	TP_ARGS(vq, hdr, seqno),
14 	TP_STRUCT__entry(
15 			 __field(int, dev)
16 			 __field(unsigned int, vq)
17 			 __string(name, vq->name)
18 			 __field(u32, type)
19 			 __field(u32, flags)
20 			 __field(u64, fence_id)
21 			 __field(u32, ctx_id)
22 			 __field(u32, num_free)
23 			 __field(u32, seqno)
24 			 ),
25 	TP_fast_assign(
26 		       __entry->dev = vq->vdev->index;
27 		       __entry->vq = vq->index;
28 		       __assign_str(name, vq->name);
29 		       __entry->type = le32_to_cpu(hdr->type);
30 		       __entry->flags = le32_to_cpu(hdr->flags);
31 		       __entry->fence_id = le64_to_cpu(hdr->fence_id);
32 		       __entry->ctx_id = le32_to_cpu(hdr->ctx_id);
33 		       __entry->num_free = vq->num_free;
34 		       __entry->seqno = seqno;
35 		       ),
36 	TP_printk("vdev=%d vq=%u name=%s type=0x%x flags=0x%x fence_id=%llu ctx_id=%u num_free=%u seqno=%u",
37 		  __entry->dev, __entry->vq, __get_str(name),
38 		  __entry->type, __entry->flags, __entry->fence_id,
39 		  __entry->ctx_id, __entry->num_free, __entry->seqno)
40 );
41 
42 DEFINE_EVENT(virtio_gpu_cmd, virtio_gpu_cmd_queue,
43 	TP_PROTO(struct virtqueue *vq, struct virtio_gpu_ctrl_hdr *hdr, u32 seqno),
44 	TP_ARGS(vq, hdr, seqno)
45 );
46 
47 DEFINE_EVENT(virtio_gpu_cmd, virtio_gpu_cmd_response,
48 	TP_PROTO(struct virtqueue *vq, struct virtio_gpu_ctrl_hdr *hdr, u32 seqno),
49 	TP_ARGS(vq, hdr, seqno)
50 );
51 
52 #endif
53 
54 #undef TRACE_INCLUDE_PATH
55 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/virtio
56 #include <trace/define_trace.h>
57