xref: /linux/drivers/gpu/drm/xe/xe_trace_guc.h (revision 170aafe35cb98e0f3fbacb446ea86389fbce22ea)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright © 2024 Intel Corporation
4  */
5 
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM xe
8 
9 #if !defined(_XE_TRACE_GUC_H_) || defined(TRACE_HEADER_MULTI_READ)
10 #define _XE_TRACE_GUC_H_
11 
12 #include <linux/tracepoint.h>
13 #include <linux/types.h>
14 
15 #include "xe_device_types.h"
16 #include "xe_guc_exec_queue_types.h"
17 
18 #define __dev_name_xe(xe)	dev_name((xe)->drm.dev)
19 
20 DECLARE_EVENT_CLASS(xe_guc_ct_flow_control,
21 		    TP_PROTO(struct xe_device *xe, u32 _head, u32 _tail, u32 size, u32 space, u32 len),
22 		    TP_ARGS(xe, _head, _tail, size, space, len),
23 
24 		    TP_STRUCT__entry(
25 			     __string(dev, __dev_name_xe(xe))
26 			     __field(u32, _head)
27 			     __field(u32, _tail)
28 			     __field(u32, size)
29 			     __field(u32, space)
30 			     __field(u32, len)
31 			     ),
32 
33 		    TP_fast_assign(
34 			   __assign_str(dev);
35 			   __entry->_head = _head;
36 			   __entry->_tail = _tail;
37 			   __entry->size = size;
38 			   __entry->space = space;
39 			   __entry->len = len;
40 			   ),
41 
42 		    TP_printk("h2g flow control: dev=%s, head=%u, tail=%u, size=%u, space=%u, len=%u",
43 			      __get_str(dev), __entry->_head, __entry->_tail, __entry->size,
44 			      __entry->space, __entry->len)
45 );
46 
47 DEFINE_EVENT(xe_guc_ct_flow_control, xe_guc_ct_h2g_flow_control,
48 	     TP_PROTO(struct xe_device *xe, u32 _head, u32 _tail, u32 size, u32 space, u32 len),
49 	     TP_ARGS(xe, _head, _tail, size, space, len)
50 );
51 
52 DEFINE_EVENT_PRINT(xe_guc_ct_flow_control, xe_guc_ct_g2h_flow_control,
53 		   TP_PROTO(struct xe_device *xe, u32 _head, u32 _tail, u32 size, u32 space, u32 len),
54 		   TP_ARGS(xe, _head, _tail, size, space, len),
55 
56 		   TP_printk("g2h flow control: dev=%s, head=%u, tail=%u, size=%u, space=%u, len=%u",
57 			     __get_str(dev), __entry->_head, __entry->_tail, __entry->size,
58 			     __entry->space, __entry->len)
59 );
60 
61 DECLARE_EVENT_CLASS(xe_guc_ctb,
62 		    TP_PROTO(struct xe_device *xe, u8 gt_id, u32 action, u32 len, u32 _head, u32 tail),
63 		    TP_ARGS(xe, gt_id, action, len, _head, tail),
64 
65 		    TP_STRUCT__entry(
66 				__string(dev, __dev_name_xe(xe))
67 				__field(u8, gt_id)
68 				__field(u32, action)
69 				__field(u32, len)
70 				__field(u32, tail)
71 				__field(u32, _head)
72 		    ),
73 
74 		    TP_fast_assign(
75 			    __assign_str(dev);
76 			    __entry->gt_id = gt_id;
77 			    __entry->action = action;
78 			    __entry->len = len;
79 			    __entry->tail = tail;
80 			    __entry->_head = _head;
81 		    ),
82 
83 		    TP_printk("H2G CTB: dev=%s, gt%d: action=0x%x, len=%d, tail=%d, head=%d\n",
84 			      __get_str(dev), __entry->gt_id, __entry->action, __entry->len,
85 			      __entry->tail, __entry->_head)
86 );
87 
88 DEFINE_EVENT(xe_guc_ctb, xe_guc_ctb_h2g,
89 	     TP_PROTO(struct xe_device *xe, u8 gt_id, u32 action, u32 len, u32 _head, u32 tail),
90 	     TP_ARGS(xe, gt_id, action, len, _head, tail)
91 );
92 
93 DEFINE_EVENT_PRINT(xe_guc_ctb, xe_guc_ctb_g2h,
94 		   TP_PROTO(struct xe_device *xe, u8 gt_id, u32 action, u32 len, u32 _head, u32 tail),
95 		   TP_ARGS(xe, gt_id, action, len, _head, tail),
96 
97 		   TP_printk("G2H CTB: dev=%s, gt%d: action=0x%x, len=%d, tail=%d, head=%d\n",
98 			     __get_str(dev), __entry->gt_id, __entry->action, __entry->len,
99 			     __entry->tail, __entry->_head)
100 
101 );
102 
103 #endif
104 
105 /* This part must be outside protection */
106 #undef TRACE_INCLUDE_PATH
107 #undef TRACE_INCLUDE_FILE
108 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/xe
109 #define TRACE_INCLUDE_FILE xe_trace_guc
110 #include <trace/define_trace.h>
111