162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#if !defined(_VIRTGPU_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
362306a36Sopenharmony_ci#define _VIRTGPU_TRACE_H_
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/tracepoint.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#undef TRACE_SYSTEM
862306a36Sopenharmony_ci#define TRACE_SYSTEM virtio_gpu
962306a36Sopenharmony_ci#define TRACE_INCLUDE_FILE virtgpu_trace
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ciDECLARE_EVENT_CLASS(virtio_gpu_cmd,
1262306a36Sopenharmony_ci	TP_PROTO(struct virtqueue *vq, struct virtio_gpu_ctrl_hdr *hdr, u32 seqno),
1362306a36Sopenharmony_ci	TP_ARGS(vq, hdr, seqno),
1462306a36Sopenharmony_ci	TP_STRUCT__entry(
1562306a36Sopenharmony_ci			 __field(int, dev)
1662306a36Sopenharmony_ci			 __field(unsigned int, vq)
1762306a36Sopenharmony_ci			 __string(name, vq->name)
1862306a36Sopenharmony_ci			 __field(u32, type)
1962306a36Sopenharmony_ci			 __field(u32, flags)
2062306a36Sopenharmony_ci			 __field(u64, fence_id)
2162306a36Sopenharmony_ci			 __field(u32, ctx_id)
2262306a36Sopenharmony_ci			 __field(u32, num_free)
2362306a36Sopenharmony_ci			 __field(u32, seqno)
2462306a36Sopenharmony_ci			 ),
2562306a36Sopenharmony_ci	TP_fast_assign(
2662306a36Sopenharmony_ci		       __entry->dev = vq->vdev->index;
2762306a36Sopenharmony_ci		       __entry->vq = vq->index;
2862306a36Sopenharmony_ci		       __assign_str(name, vq->name);
2962306a36Sopenharmony_ci		       __entry->type = le32_to_cpu(hdr->type);
3062306a36Sopenharmony_ci		       __entry->flags = le32_to_cpu(hdr->flags);
3162306a36Sopenharmony_ci		       __entry->fence_id = le64_to_cpu(hdr->fence_id);
3262306a36Sopenharmony_ci		       __entry->ctx_id = le32_to_cpu(hdr->ctx_id);
3362306a36Sopenharmony_ci		       __entry->num_free = vq->num_free;
3462306a36Sopenharmony_ci		       __entry->seqno = seqno;
3562306a36Sopenharmony_ci		       ),
3662306a36Sopenharmony_ci	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",
3762306a36Sopenharmony_ci		  __entry->dev, __entry->vq, __get_str(name),
3862306a36Sopenharmony_ci		  __entry->type, __entry->flags, __entry->fence_id,
3962306a36Sopenharmony_ci		  __entry->ctx_id, __entry->num_free, __entry->seqno)
4062306a36Sopenharmony_ci);
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciDEFINE_EVENT(virtio_gpu_cmd, virtio_gpu_cmd_queue,
4362306a36Sopenharmony_ci	TP_PROTO(struct virtqueue *vq, struct virtio_gpu_ctrl_hdr *hdr, u32 seqno),
4462306a36Sopenharmony_ci	TP_ARGS(vq, hdr, seqno)
4562306a36Sopenharmony_ci);
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciDEFINE_EVENT(virtio_gpu_cmd, virtio_gpu_cmd_response,
4862306a36Sopenharmony_ci	TP_PROTO(struct virtqueue *vq, struct virtio_gpu_ctrl_hdr *hdr, u32 seqno),
4962306a36Sopenharmony_ci	TP_ARGS(vq, hdr, seqno)
5062306a36Sopenharmony_ci);
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#endif
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#undef TRACE_INCLUDE_PATH
5562306a36Sopenharmony_ci#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/virtio
5662306a36Sopenharmony_ci#include <trace/define_trace.h>
57