summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorCharles Tan <ctan@nvidia.com>2012-10-25 23:09:37 -0700
committerSimone Willett <swillett@nvidia.com>2012-11-28 17:43:43 -0800
commitc7faf7f382c9330a487195ae13cc19cc0c018471 (patch)
tree6e902aa101c28a736d431ff276cd1a6d8f31e0ef /security
parent87ddc4f69789603c7f1f61b95bf650020f99ed6d (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 'security')
-rw-r--r--security/tf_driver/tf_comm_tz.c8
-rw-r--r--security/tf_driver/tf_device.c7
-rw-r--r--security/tf_driver/tf_util.c17
-rw-r--r--security/tf_driver/tf_util.h9
4 files changed, 38 insertions, 3 deletions
diff --git a/security/tf_driver/tf_comm_tz.c b/security/tf_driver/tf_comm_tz.c
index 4628f24f3cf2..a0e9941832f5 100644
--- a/security/tf_driver/tf_comm_tz.c
+++ b/security/tf_driver/tf_comm_tz.c
@@ -2,6 +2,8 @@
* Copyright (c) 2011 Trusted Logic S.A.
* All Rights Reserved.
*
+ * Copyright (C) 2011-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
* version 2 as published by the Free Software Foundation.
@@ -27,6 +29,8 @@
#include <linux/vmalloc.h>
#include <linux/jiffies.h>
+#include <trace/events/nvsecurity.h>
+
#include "tf_defs.h"
#include "tf_comm.h"
#include "tf_protocol.h"
@@ -63,6 +67,8 @@ static inline void tf_smc_generic_call(
dprintk(KERN_ERR "sched_setaffinity #1 -> 0x%lX", ret);
#endif
+ trace_smc_generic_call(NVSEC_SMC_START);
+
__asm__ volatile(
"mov r0, %2\n"
"mov r1, %3\n"
@@ -78,6 +84,8 @@ static inline void tf_smc_generic_call(
"r" (generic_smc->reg4)
: "r0", "r1", "r2", "r3", "r4");
+ trace_smc_generic_call(NVSEC_SMC_DONE);
+
#ifdef CONFIG_SMP
ret = sched_setaffinity(0, &saved_cpu_mask);
if (ret != 0)
diff --git a/security/tf_driver/tf_device.c b/security/tf_driver/tf_device.c
index 1bdf5acb177d..51dbb37dbdec 100644
--- a/security/tf_driver/tf_device.c
+++ b/security/tf_driver/tf_device.c
@@ -2,6 +2,8 @@
* Copyright (c) 2011 Trusted Logic S.A.
* All Rights Reserved.
*
+ * Copyright (C) 2011-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
* version 2 as published by the Free Software Foundation.
@@ -46,6 +48,9 @@
#include "s_version.h"
+#define CREATE_TRACE_POINTS
+#include <trace/events/nvsecurity.h>
+
/*----------------------------------------------------------------------------
* Forward Declarations
*----------------------------------------------------------------------------*/
@@ -733,8 +738,10 @@ static long tf_device_ioctl(struct file *file, unsigned int ioctl_num,
break;
case TF_MESSAGE_TYPE_INVOKE_CLIENT_COMMAND:
+ trace_invoke_client_command(NVSEC_INVOKE_CMD_START);
result = tf_invoke_client_command(connection,
&command, &answer);
+ trace_invoke_client_command(NVSEC_INVOKE_CMD_DONE);
break;
case TF_MESSAGE_TYPE_CANCEL_CLIENT_COMMAND:
diff --git a/security/tf_driver/tf_util.c b/security/tf_driver/tf_util.c
index 78f90bf677e0..936f8e16c247 100644
--- a/security/tf_driver/tf_util.c
+++ b/security/tf_driver/tf_util.c
@@ -2,6 +2,8 @@
* Copyright (c) 2011 Trusted Logic S.A.
* All Rights Reserved.
*
+ * Copyright (C) 2011-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
* version 2 as published by the Free Software Foundation.
@@ -21,6 +23,19 @@
#include "tf_util.h"
/*----------------------------------------------------------------------------
+ * Tegra-specific routines
+ *----------------------------------------------------------------------------*/
+
+u32 notrace tegra_read_cycle(void)
+{
+ u32 cycle_count;
+
+ asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(cycle_count));
+
+ return cycle_count;
+}
+
+/*----------------------------------------------------------------------------
* Debug printing routines
*----------------------------------------------------------------------------*/
#ifdef CONFIG_TF_DRIVER_DEBUG_SUPPORT
@@ -1139,5 +1154,3 @@ void internal_page_cache_release(struct page *page)
page_cache_release(page);
}
-
-
diff --git a/security/tf_driver/tf_util.h b/security/tf_driver/tf_util.h
index 14bc78952d86..2fabf0127a2f 100644
--- a/security/tf_driver/tf_util.h
+++ b/security/tf_driver/tf_util.h
@@ -2,6 +2,8 @@
* Copyright (c) 2011 Trusted Logic S.A.
* All Rights Reserved.
*
+ * Copyright (C) 2011-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
* version 2 as published by the Free Software Foundation.
@@ -35,6 +37,12 @@
#include "tf_defs.h"
/*----------------------------------------------------------------------------
+ * Tegra-specific routines
+ *----------------------------------------------------------------------------*/
+
+u32 notrace tegra_read_cycle(void);
+
+/*----------------------------------------------------------------------------
* Debug printing routines
*----------------------------------------------------------------------------*/
@@ -119,4 +127,3 @@ int internal_get_user_pages(
void internal_get_page(struct page *page);
void internal_page_cache_release(struct page *page);
#endif /* __TF_UTIL_H__ */
-