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),
13 	TP_ARGS(vq, hdr),
14 	TP_STRUCT__entry(
15 			 __field(int, dev)
16 			 __field(unsigned int, vq)
17 			 __field(const char *, name)
18 			 __field(u32, type)
19 			 __field(u32, flags)
20 			 __field(u64, fence_id)
21 			 __field(u32, ctx_id)
22 			 ),
23 	TP_fast_assign(
24 		       __entry->dev = vq->vdev->index;
25 		       __entry->vq = vq->index;
26 		       __entry->name = vq->name;
27 		       __entry->type = le32_to_cpu(hdr->type);
28 		       __entry->flags = le32_to_cpu(hdr->flags);
29 		       __entry->fence_id = le64_to_cpu(hdr->fence_id);
30 		       __entry->ctx_id = le32_to_cpu(hdr->ctx_id);
31 		       ),
32 	TP_printk("vdev=%d vq=%u name=%s type=0x%x flags=0x%x fence_id=%llu ctx_id=%u",
33 		  __entry->dev, __entry->vq, __entry->name,
34 		  __entry->type, __entry->flags, __entry->fence_id,
35 		  __entry->ctx_id)
36 );
37 
38 DEFINE_EVENT(virtio_gpu_cmd, virtio_gpu_cmd_queue,
39 	TP_PROTO(struct virtqueue *vq, struct virtio_gpu_ctrl_hdr *hdr),
40 	TP_ARGS(vq, hdr)
41 );
42 
43 DEFINE_EVENT(virtio_gpu_cmd, virtio_gpu_cmd_response,
44 	TP_PROTO(struct virtqueue *vq, struct virtio_gpu_ctrl_hdr *hdr),
45 	TP_ARGS(vq, hdr)
46 );
47 
48 #endif
49 
50 #undef TRACE_INCLUDE_PATH
51 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/virtio
52 #include <trace/define_trace.h>
53