summaryrefslogtreecommitdiff
path: root/drivers/firmware/qcom/qcom_scm_trace.h
blob: 6c911124fc56b6582813a40fe2a8427ed63e2b8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
 */

#undef TRACE_SYSTEM
#define TRACE_SYSTEM qcom_scm

#if !defined(_TRACE_SCM_SMC_INTERFACE_H) || defined(TRACE_HEADER_MULTI_READ)

#define _TRACE_SCM_SMC_INTERFACE_H

#include <linux/tracepoint.h>

TRACE_EVENT(scm_smc_request,

	TP_PROTO(unsigned long a0, const struct arm_smccc_args *smc),

	TP_ARGS(a0, smc),

	TP_STRUCT__entry(
		__field(u64, smc_id)
		__field(u8, svc_id)
		__field(u8, cmd_id)
		__field(u8, args_cnt)
		__dynamic_array(unsigned long, args,
				min_t(u8, (smc->args[1] & 0xF), (u8)6))
	),

	TP_fast_assign(
		__entry->smc_id = a0;
		__entry->svc_id = (smc->args[0] >> 8) & 0xFF;
		__entry->cmd_id = smc->args[0] & 0xFF;
		u8 n = min_t(u8, (smc->args[1] & 0xF), (u8)6);

		__entry->args_cnt = n;

		unsigned long *dst = __get_dynamic_array(args);

		for (int i = 0; i < n; i++)
			dst[i] = smc->args[2 + i];
	),

	TP_printk("smc_id:0x%08llx svc_id:0x%02x cmd_id:0x%02x args_cnt:%u args:%s",
		  __entry->smc_id, __entry->svc_id, __entry->cmd_id, __entry->args_cnt,
		  __print_dynamic_array(args, sizeof(unsigned long)))
);

TRACE_EVENT(scm_waitq_sleep,

	TP_PROTO(u32 wq_ctx, u32 smc_ctx),

	TP_ARGS(wq_ctx, smc_ctx),

	TP_STRUCT__entry(
		__field(u32, wq_ctx)
		__field(u32, smc_call_ctx)
	),

	TP_fast_assign(
		__entry->wq_ctx = wq_ctx;
		__entry->smc_call_ctx = smc_ctx;
	),

	TP_printk("wq_ctx:%u, smc_call_ctx:%u", __entry->wq_ctx, __entry->smc_call_ctx)
);

TRACE_EVENT(scm_waitq_resume,

	TP_PROTO(u32 smc_ctx),

	TP_ARGS(smc_ctx),

	TP_STRUCT__entry(
		__field(u32, smc_call_ctx)
	),

	TP_fast_assign(
		__entry->smc_call_ctx = smc_ctx;
	),

	TP_printk("smc_call_ctx:%u", __entry->smc_call_ctx)
);

TRACE_EVENT(scm_waitq_get_wq_ctx,

	TP_PROTO(u32 wq_ctx, u32 flags, u32 pending),

	TP_ARGS(wq_ctx, flags, pending),

	TP_STRUCT__entry(
		__field(u32, wq_ctx)
		__field(u32, flags)
		__field(u32, more_pending)
	),

	TP_fast_assign(
		__entry->wq_ctx = wq_ctx;
		__entry->flags = flags;
		__entry->more_pending = pending;
	),

	TP_printk("wq_ctx:%u, flags:%u, more_pending:%u",
		  __entry->wq_ctx, __entry->flags, __entry->more_pending)
);

TRACE_EVENT(scm_smc_done,

	TP_PROTO(int ret, u64 smc_id, struct arm_smccc_res *smc_res),

	TP_ARGS(ret, smc_id, smc_res),

	TP_STRUCT__entry(
		__field(int, ret)
		__field(u64, smc_id)
		__field(unsigned long, res)
		__field(unsigned long, res0)
		__field(unsigned long, res1)
		__field(unsigned long, res2)
	),

	TP_fast_assign(
		__entry->ret = ret;
		__entry->smc_id = smc_id;
		__entry->res = smc_res->a0;
		__entry->res0 = smc_res->a1;
		__entry->res1 = smc_res->a2;
		__entry->res2 = smc_res->a3;
	),

	TP_printk("smc_id:0x%08llx, ret:%d res_to_callee:0x%lx res0:0x%lx res1:0x%lx res2:0x%lx",
		  __entry->smc_id, __entry->ret, __entry->res,
		  __entry->res0, __entry->res1, __entry->res2)
);

#endif /* _TRACE_SCM_SMC_INTERFACE_H */

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#define TRACE_INCLUDE_FILE qcom_scm_trace

#include <trace/define_trace.h>