Add tracepoints around calls to secure world

-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmBPRKkaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJerWw/+MzCwNF4MflbsntlfnFLn
 rVz7HuJ0WtnQU1jhu2xcN43nKnNp/jhWxK0hWmlfV17v9mBoRS4FXzP4FLqLl1UV
 +VzoJLW1LJXUzU9NClPulwiR68fSVN4rZVlrfc9d6La02qvZzu6ILDGsiibETZeX
 xCtbuAYVbW2R2LnGwKXxnU19P6Ta1nm7VfodJqMphgAxpGfaoNN2OpgKqYVLW5VB
 mRe32+Vkn2mxgFtueZ4yIYOAnqf+9xudpkMcHcK40efglXB5CFMyznnEuyPTTUMp
 sGpsriKWY6ETkL3Z9Pss3NUo872C6RhyIZzKvxxK/7igKcf+fbH1flXAo5x37XcM
 luXteg9aUGkn24KkmiKSZqlZ7ZuqxZKSAsxBS8npuxrX79k+Gh+DlUxu3f0tqptR
 VF+WByzxL8dCkddkUAvVzxW9OI6kItveY46DO7Rk/DV+72q0qaF+/1MTP3spBg8Z
 1gMGfFY+8ZGMfy83cZ1ctQoocnndSxL/CWHxTcAhybjYoUV2WrvZ5Cl/p8xQ3u7m
 eUsSx32EEzY6gn+IXi9VwN2ESimHv/u9ByM9hOHg7b5styExUbgh3r6C4ENAkdnK
 1HaQv74d8MFH20PR6ez2VUc8osPd+PYxBis1M2cGGhwW9FrSzVWR5PEE0jKA6Bv3
 x5doGJZyeQmlOzKIXrMrCHY=
 =csrx
 -----END PGP SIGNATURE-----

Merge tag 'optee-tracepoints-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee into arm/drivers

Add tracepoints around calls to secure world

* tag 'optee-tracepoints-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: optee: add invoke_fn tracepoints

Link: https://lore.kernel.org/r/20210315113733.GA1944243@jade
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2021-03-23 18:13:00 +01:00
commit 9a752ebe6b
2 changed files with 71 additions and 0 deletions

View File

@ -14,6 +14,8 @@
#include <linux/uaccess.h>
#include "optee_private.h"
#include "optee_smc.h"
#define CREATE_TRACE_POINTS
#include "optee_trace.h"
struct optee_call_waiter {
struct list_head list_node;
@ -138,9 +140,11 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
while (true) {
struct arm_smccc_res res;
trace_optee_invoke_fn_begin(&param);
optee->invoke_fn(param.a0, param.a1, param.a2, param.a3,
param.a4, param.a5, param.a6, param.a7,
&res);
trace_optee_invoke_fn_end(&param, &res);
if (res.a0 == OPTEE_SMC_RETURN_ETHREAD_LIMIT) {
/*

View File

@ -0,0 +1,67 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* optee trace points
*
* Copyright (C) 2021 Synaptics Incorporated
* Author: Jisheng Zhang <jszhang@kernel.org>
*/
#undef TRACE_SYSTEM
#define TRACE_SYSTEM optee
#if !defined(_TRACE_OPTEE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_OPTEE_H
#include <linux/arm-smccc.h>
#include <linux/tracepoint.h>
#include "optee_private.h"
TRACE_EVENT(optee_invoke_fn_begin,
TP_PROTO(struct optee_rpc_param *param),
TP_ARGS(param),
TP_STRUCT__entry(
__field(void *, param)
__array(u32, args, 8)
),
TP_fast_assign(
__entry->param = param;
BUILD_BUG_ON(sizeof(*param) < sizeof(__entry->args));
memcpy(__entry->args, param, sizeof(__entry->args));
),
TP_printk("param=%p (%x, %x, %x, %x, %x, %x, %x, %x)", __entry->param,
__entry->args[0], __entry->args[1], __entry->args[2],
__entry->args[3], __entry->args[4], __entry->args[5],
__entry->args[6], __entry->args[7])
);
TRACE_EVENT(optee_invoke_fn_end,
TP_PROTO(struct optee_rpc_param *param, struct arm_smccc_res *res),
TP_ARGS(param, res),
TP_STRUCT__entry(
__field(void *, param)
__array(unsigned long, rets, 4)
),
TP_fast_assign(
__entry->param = param;
BUILD_BUG_ON(sizeof(*res) < sizeof(__entry->rets));
memcpy(__entry->rets, res, sizeof(__entry->rets));
),
TP_printk("param=%p ret (%lx, %lx, %lx, %lx)", __entry->param,
__entry->rets[0], __entry->rets[1], __entry->rets[2],
__entry->rets[3])
);
#endif /* _TRACE_OPTEE_H */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE optee_trace
/* This part must be outside protection */
#include <trace/define_trace.h>