xref: /linux/drivers/accel/ivpu/ivpu_trace.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2020-2024 Intel Corporation
4  */
5 
6 #if !defined(__IVPU_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
7 #define __IVPU_TRACE_H__
8 
9 #include <linux/tracepoint.h>
10 #include "ivpu_drv.h"
11 #include "ivpu_job.h"
12 #include "vpu_jsm_api.h"
13 #include "ivpu_jsm_msg.h"
14 #include "ivpu_ipc.h"
15 
16 #undef TRACE_SYSTEM
17 #define TRACE_SYSTEM vpu
18 #define TRACE_INCLUDE_FILE ivpu_trace
19 
20 TRACE_EVENT(pm,
21 	    TP_PROTO(const char *event),
22 	    TP_ARGS(event),
23 	    TP_STRUCT__entry(__field(const char *, event)),
24 	    TP_fast_assign(__entry->event = event;),
25 	    TP_printk("%s", __entry->event)
26 );
27 
28 TRACE_EVENT(job,
29 	    TP_PROTO(const char *event, struct ivpu_job *job),
30 	    TP_ARGS(event, job),
31 	    TP_STRUCT__entry(__field(const char *, event)
32 		__field(u32, ctx_id)
33 		__field(u32, engine_id)
34 		__field(u32, job_id)
35 		),
36 	    TP_fast_assign(__entry->event = event;
37 		__entry->ctx_id = job->file_priv->ctx.id;
38 		__entry->engine_id = job->engine_idx;
39 		__entry->job_id = job->job_id;),
40 	    TP_printk("%s context:%d engine:%d job:%d",
41 		      __entry->event,
42 		      __entry->ctx_id,
43 		      __entry->engine_id,
44 		      __entry->job_id)
45 );
46 
47 TRACE_EVENT(jsm,
48 	    TP_PROTO(const char *event, struct vpu_jsm_msg *msg),
49 	    TP_ARGS(event, msg),
50 	    TP_STRUCT__entry(__field(const char *, event)
51 		__field(const char *, type)
52 		__field(enum vpu_ipc_msg_status, status)
53 		__field(u32, request_id)
54 		__field(u32, result)
55 		),
56 	    TP_fast_assign(__entry->event = event;
57 		__entry->type = ivpu_jsm_msg_type_to_str(msg->type);
58 		__entry->status = msg->status;
59 		__entry->request_id = msg->request_id;
60 		__entry->result = msg->result;),
61 	    TP_printk("%s type:%s, status:%#x, id:%#x, result:%#x",
62 		      __entry->event,
63 		      __entry->type,
64 		      __entry->status,
65 		      __entry->request_id,
66 		      __entry->result)
67 );
68 
69 #endif /* __IVPU_TRACE_H__ */
70 
71 #undef TRACE_INCLUDE_PATH
72 #define TRACE_INCLUDE_PATH .
73 #include <trace/define_trace.h>
74