xref: /linux/include/trace/events/amdxdna.h (revision 96c84703f1cf6ea43617f9565166681cd71df104)
1b87f920bSLizhi Hou /* SPDX-License-Identifier: GPL-2.0 */
2b87f920bSLizhi Hou /*
3b87f920bSLizhi Hou  * Copyright (C) 2023-2024, Advanced Micro Devices, Inc.
4b87f920bSLizhi Hou  */
5b87f920bSLizhi Hou 
6b87f920bSLizhi Hou #undef TRACE_SYSTEM
7b87f920bSLizhi Hou #define TRACE_SYSTEM amdxdna
8b87f920bSLizhi Hou 
9b87f920bSLizhi Hou #if !defined(_TRACE_AMDXDNA_H) || defined(TRACE_HEADER_MULTI_READ)
10b87f920bSLizhi Hou #define _TRACE_AMDXDNA_H
11b87f920bSLizhi Hou 
12*aac24309SLizhi Hou #include <drm/gpu_scheduler.h>
13b87f920bSLizhi Hou #include <linux/tracepoint.h>
14b87f920bSLizhi Hou 
15*aac24309SLizhi Hou TRACE_EVENT(amdxdna_debug_point,
16*aac24309SLizhi Hou 	    TP_PROTO(const char *name, u64 number, const char *str),
17*aac24309SLizhi Hou 
18*aac24309SLizhi Hou 	    TP_ARGS(name, number, str),
19*aac24309SLizhi Hou 
20*aac24309SLizhi Hou 	    TP_STRUCT__entry(__string(name, name)
21*aac24309SLizhi Hou 			     __field(u64, number)
22*aac24309SLizhi Hou 			     __string(str, str)),
23*aac24309SLizhi Hou 
24*aac24309SLizhi Hou 	    TP_fast_assign(__assign_str(name);
25*aac24309SLizhi Hou 			   __entry->number = number;
26*aac24309SLizhi Hou 			   __assign_str(str);),
27*aac24309SLizhi Hou 
28*aac24309SLizhi Hou 	    TP_printk("%s:%llu %s", __get_str(name), __entry->number,
29*aac24309SLizhi Hou 		      __get_str(str))
30*aac24309SLizhi Hou );
31*aac24309SLizhi Hou 
32*aac24309SLizhi Hou TRACE_EVENT(xdna_job,
33*aac24309SLizhi Hou 	    TP_PROTO(struct drm_sched_job *sched_job, const char *name, const char *str, u64 seq),
34*aac24309SLizhi Hou 
35*aac24309SLizhi Hou 	    TP_ARGS(sched_job, name, str, seq),
36*aac24309SLizhi Hou 
37*aac24309SLizhi Hou 	    TP_STRUCT__entry(__string(name, name)
38*aac24309SLizhi Hou 			     __string(str, str)
39*aac24309SLizhi Hou 			     __field(u64, fence_context)
40*aac24309SLizhi Hou 			     __field(u64, fence_seqno)
41*aac24309SLizhi Hou 			     __field(u64, seq)),
42*aac24309SLizhi Hou 
43*aac24309SLizhi Hou 	    TP_fast_assign(__assign_str(name);
44*aac24309SLizhi Hou 			   __assign_str(str);
45*aac24309SLizhi Hou 			   __entry->fence_context = sched_job->s_fence->finished.context;
46*aac24309SLizhi Hou 			   __entry->fence_seqno = sched_job->s_fence->finished.seqno;
47*aac24309SLizhi Hou 			   __entry->seq = seq;),
48*aac24309SLizhi Hou 
49*aac24309SLizhi Hou 	    TP_printk("fence=(context:%llu, seqno:%lld), %s seq#:%lld %s",
50*aac24309SLizhi Hou 		      __entry->fence_context, __entry->fence_seqno,
51*aac24309SLizhi Hou 		      __get_str(name), __entry->seq,
52*aac24309SLizhi Hou 		      __get_str(str))
53*aac24309SLizhi Hou );
54*aac24309SLizhi Hou 
55b87f920bSLizhi Hou DECLARE_EVENT_CLASS(xdna_mbox_msg,
56b87f920bSLizhi Hou 		    TP_PROTO(char *name, u8 chann_id, u32 opcode, u32 msg_id),
57b87f920bSLizhi Hou 
58b87f920bSLizhi Hou 		    TP_ARGS(name, chann_id, opcode, msg_id),
59b87f920bSLizhi Hou 
60b87f920bSLizhi Hou 		    TP_STRUCT__entry(__string(name, name)
61b87f920bSLizhi Hou 				     __field(u32, chann_id)
62b87f920bSLizhi Hou 				     __field(u32, opcode)
63b87f920bSLizhi Hou 				     __field(u32, msg_id)),
64b87f920bSLizhi Hou 
65b87f920bSLizhi Hou 		    TP_fast_assign(__assign_str(name);
66b87f920bSLizhi Hou 				   __entry->chann_id = chann_id;
67b87f920bSLizhi Hou 				   __entry->opcode = opcode;
68b87f920bSLizhi Hou 				   __entry->msg_id = msg_id;),
69b87f920bSLizhi Hou 
70b87f920bSLizhi Hou 		    TP_printk("%s.%d id 0x%x opcode 0x%x", __get_str(name),
71b87f920bSLizhi Hou 			      __entry->chann_id, __entry->msg_id, __entry->opcode)
72b87f920bSLizhi Hou );
73b87f920bSLizhi Hou 
74b87f920bSLizhi Hou DEFINE_EVENT(xdna_mbox_msg, mbox_set_tail,
75b87f920bSLizhi Hou 	     TP_PROTO(char *name, u8 chann_id, u32 opcode, u32 id),
76b87f920bSLizhi Hou 	     TP_ARGS(name, chann_id, opcode, id)
77b87f920bSLizhi Hou );
78b87f920bSLizhi Hou 
79b87f920bSLizhi Hou DEFINE_EVENT(xdna_mbox_msg, mbox_set_head,
80b87f920bSLizhi Hou 	     TP_PROTO(char *name, u8 chann_id, u32 opcode, u32 id),
81b87f920bSLizhi Hou 	     TP_ARGS(name, chann_id, opcode, id)
82b87f920bSLizhi Hou );
83b87f920bSLizhi Hou 
84b87f920bSLizhi Hou TRACE_EVENT(mbox_irq_handle,
85b87f920bSLizhi Hou 	    TP_PROTO(char *name, int irq),
86b87f920bSLizhi Hou 
87b87f920bSLizhi Hou 	    TP_ARGS(name, irq),
88b87f920bSLizhi Hou 
89b87f920bSLizhi Hou 	    TP_STRUCT__entry(__string(name, name)
90b87f920bSLizhi Hou 			     __field(int, irq)),
91b87f920bSLizhi Hou 
92b87f920bSLizhi Hou 	    TP_fast_assign(__assign_str(name);
93b87f920bSLizhi Hou 			   __entry->irq = irq;),
94b87f920bSLizhi Hou 
95b87f920bSLizhi Hou 	    TP_printk("%s.%d", __get_str(name), __entry->irq)
96b87f920bSLizhi Hou );
97b87f920bSLizhi Hou 
98b87f920bSLizhi Hou #endif /* !defined(_TRACE_AMDXDNA_H) || defined(TRACE_HEADER_MULTI_READ) */
99b87f920bSLizhi Hou 
100b87f920bSLizhi Hou /* This part must be outside protection */
101b87f920bSLizhi Hou #include <trace/define_trace.h>
102