xref: /openbmc/linux/drivers/tee/optee/optee_trace.h (revision ee65728e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * optee trace points
4  *
5  * Copyright (C) 2021 Synaptics Incorporated
6  * Author: Jisheng Zhang <jszhang@kernel.org>
7  */
8 
9 #undef TRACE_SYSTEM
10 #define TRACE_SYSTEM optee
11 
12 #if !defined(_TRACE_OPTEE_H) || defined(TRACE_HEADER_MULTI_READ)
13 #define _TRACE_OPTEE_H
14 
15 #include <linux/arm-smccc.h>
16 #include <linux/tracepoint.h>
17 #include "optee_private.h"
18 
19 TRACE_EVENT(optee_invoke_fn_begin,
20 	TP_PROTO(struct optee_rpc_param *param),
21 	TP_ARGS(param),
22 
23 	TP_STRUCT__entry(
24 		__field(void *, param)
25 		__array(u32, args, 8)
26 	),
27 
28 	TP_fast_assign(
29 		__entry->param = param;
30 		BUILD_BUG_ON(sizeof(*param) < sizeof(__entry->args));
31 		memcpy(__entry->args, param, sizeof(__entry->args));
32 	),
33 
34 	TP_printk("param=%p (%x, %x, %x, %x, %x, %x, %x, %x)", __entry->param,
35 		  __entry->args[0], __entry->args[1], __entry->args[2],
36 		  __entry->args[3], __entry->args[4], __entry->args[5],
37 		  __entry->args[6], __entry->args[7])
38 );
39 
40 TRACE_EVENT(optee_invoke_fn_end,
41 	TP_PROTO(struct optee_rpc_param *param, struct arm_smccc_res *res),
42 	TP_ARGS(param, res),
43 
44 	TP_STRUCT__entry(
45 		__field(void *, param)
46 		__array(unsigned long, rets, 4)
47 	),
48 
49 	TP_fast_assign(
50 		__entry->param = param;
51 		BUILD_BUG_ON(sizeof(*res) < sizeof(__entry->rets));
52 		memcpy(__entry->rets, res, sizeof(__entry->rets));
53 	),
54 
55 	TP_printk("param=%p ret (%lx, %lx, %lx, %lx)", __entry->param,
56 		  __entry->rets[0], __entry->rets[1], __entry->rets[2],
57 		  __entry->rets[3])
58 );
59 #endif /* _TRACE_OPTEE_H */
60 
61 #undef TRACE_INCLUDE_PATH
62 #define TRACE_INCLUDE_PATH .
63 #undef TRACE_INCLUDE_FILE
64 #define TRACE_INCLUDE_FILE optee_trace
65 
66 /* This part must be outside protection */
67 #include <trace/define_trace.h>
68