diff options
author | Charles Tan <ctan@nvidia.com> | 2012-10-25 23:09:37 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 12:43:34 -0700 |
commit | c9443832bc34f74ae131acfab915a31a7281c60a (patch) | |
tree | 782fb10d5465b04966b2286bd885a27e7096c0a4 /include/trace | |
parent | 4bf507d60c42c8fdfa14a2e899de29d7e9e7cfea (diff) |
security: Add tracing for SecureOS measurements
Add new tracepoint events for SecureOS-related tracing.
The timestamp traces measure the number of cycles taken
to switch between normal world and secure world using the
CP15 cycle counter.
Bug 1042455
Change-Id: Ia7f0718a0fcc399875a175670b80dfe33f79b95e
Signed-off-by: Charles Tan <ctan@nvidia.com>
Reviewed-on: http://git-master/r/159367
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Antti Miettinen <amiettinen@nvidia.com>
Tested-by: Antti Miettinen <amiettinen@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/events/nvsecurity.h | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/include/trace/events/nvsecurity.h b/include/trace/events/nvsecurity.h new file mode 100644 index 000000000000..25e90a9f9387 --- /dev/null +++ b/include/trace/events/nvsecurity.h @@ -0,0 +1,152 @@ +/* + * include/trace/events/nvsecurity.h + * + * Security event logging to ftrace. + * + * Copyright (c) 2012, NVIDIA Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM nvsecurity + +#if !defined(_TRACE_NVSECURITY_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_NVSECURITY_H + +#include <linux/ktime.h> +#include <linux/tracepoint.h> + +extern u32 notrace tegra_read_usec_raw(void); + +DECLARE_EVENT_CLASS(usec_profiling, + + TP_PROTO(unsigned long state), + + TP_ARGS(state), + + TP_STRUCT__entry( + __field(u32, counter) + __field(u32, state) + ), + + TP_fast_assign( + __entry->counter = tegra_read_usec_raw(); + __entry->state = state; + ), + + TP_printk("counter=%lu, state=%lu", + (unsigned long)__entry->counter, + (unsigned long)__entry->state + ) +); + +DEFINE_EVENT(usec_profiling, smc_sleep_cpu, + + TP_PROTO(unsigned long state), + + TP_ARGS(state) +); + +DEFINE_EVENT(usec_profiling, smc_sleep_core, + + TP_PROTO(unsigned long state), + + TP_ARGS(state) +); + +DEFINE_EVENT(usec_profiling, smc_init_cache, + + TP_PROTO(unsigned long state), + + TP_ARGS(state) +); + +DEFINE_EVENT(usec_profiling, smc_wake, + + TP_PROTO(unsigned long state), + + TP_ARGS(state) +); + +DEFINE_EVENT(usec_profiling, secureos_init, + + TP_PROTO(unsigned long state), + + TP_ARGS(state) +); + +extern u32 notrace tegra_read_cycle(void); + +DECLARE_EVENT_CLASS(cycle_profiling, + + TP_PROTO(unsigned long state), + + TP_ARGS(state), + + TP_STRUCT__entry( + __field(u32, counter) + __field(u32, state) + ), + + TP_fast_assign( + __entry->counter = tegra_read_cycle(); + __entry->state = state; + ), + + TP_printk("counter=%lu, state=%lu", + (unsigned long)__entry->counter, + (unsigned long)__entry->state + ) +); + +DEFINE_EVENT(cycle_profiling, invoke_client_command, + + TP_PROTO(unsigned long state), + + TP_ARGS(state) +); + +DEFINE_EVENT(cycle_profiling, smc_generic_call, + + TP_PROTO(unsigned long state), + + TP_ARGS(state) +); + +/* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */ +#ifndef _NVSEC_EVENT_AVOID_DOUBLE_DEFINING +#define _NVSEC_EVENT_AVOID_DOUBLE_DEFINING + +enum { + NVSEC_SMC_START, + NVSEC_SMC_DONE +}; + +enum { + NVSEC_INVOKE_CMD_START, + NVSEC_INVOKE_CMD_DONE +}; + +enum { + NVSEC_SUSPEND_EXIT_START, + NVSEC_SUSPEND_EXIT_DONE +}; + +#endif +#endif /* _TRACE_NVSECURITY_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> |