diff options
author | James Kung <kong1191@gmail.com> | 2015-03-09 12:56:09 +0800 |
---|---|---|
committer | James Kung <kong1191@gmail.com> | 2015-03-09 12:56:09 +0800 |
commit | 557ded3cc00d21f0ae0e27d5c1743969adbe7aee (patch) | |
tree | 20693c45c578b503fc65d5160403b03703132b00 | |
parent | 724298b6e425d9ce6daae3131bb4b1029190aa2a (diff) |
- Print out CNTVCT value for smc call performance measurement
- Enable/disable print message by Makefile CONFIG_TEE_TRACE_PERFORMANCE option
- Update .travis.yml to test compile error for CONFIG_TEE_TRACE_PERFORMANCE flag
Signed-off-by: James Kung <kong1191@gmail.com>
Tested-by: James Kung <kong1191@gmail.com> (QEMU, FVP platform)
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | armtz/Makefile | 2 | ||||
-rw-r--r-- | armtz/tee_tz_drv.c | 38 |
3 files changed, 42 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml index d4f9f4f..83a3d6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,7 @@ script: - make multi_v7_defconfig - make -j`getconf _NPROCESSORS_ONLN` zImage - make -j`getconf _NPROCESSORS_ONLN` M=$MYHOME modules + - make -j`getconf _NPROCESSORS_ONLN` CONFIG_TEE_TRACE_PERFORMANCE=y M=$MYHOME modules # arm64 compilation - export ARCH=arm64 @@ -52,4 +53,5 @@ script: - make defconfig - make -j`getconf _NPROCESSORS_ONLN` all - make -j`getconf _NPROCESSORS_ONLN` M=$MYHOME modules + - make -j`getconf _NPROCESSORS_ONLN` CONFIG_TEE_TRACE_PERFORMANCE=y M=$MYHOME modules diff --git a/armtz/Makefile b/armtz/Makefile index af2b10c..aa26b07 100644 --- a/armtz/Makefile +++ b/armtz/Makefile @@ -6,6 +6,7 @@ CFG_TEE_DRV_DEBUGFS?=0 CFG_TEE_CORE_LOG_LEVEL?=2 CFG_TEE_TA_LOG_LEVEL?=2 +CONFIG_TEE_TRACE_PERFORMANCE?=n ccflags-y+=-Werror ccflags-y+=-I$(M)/include/arm_common @@ -16,6 +17,7 @@ ccflags-y+=-I$(M)/core ccflags-y+=-DCFG_TEE_DRV_DEBUGFS=${CFG_TEE_DRV_DEBUGFS} ccflags-y+=-DCFG_TEE_CORE_LOG_LEVEL=${CFG_TEE_CORE_LOG_LEVEL} ccflags-y+=-DCFG_TEE_TA_LOG_LEVEL=${CFG_TEE_TA_LOG_LEVEL} +ccflags-$(CONFIG_TEE_TRACE_PERFORMANCE)+=-DCFG_TEE_TRACE_PERFORMANCE obj-m += optee_armtz.o diff --git a/armtz/tee_tz_drv.c b/armtz/tee_tz_drv.c index fa5e4e9..6916069 100644 --- a/armtz/tee_tz_drv.c +++ b/armtz/tee_tz_drv.c @@ -305,6 +305,42 @@ static u32 handle_rpc(struct tee_tz *ptee, struct smc_param *param) return TEESMC32_CALL_RETURN_FROM_RPC; } +#ifdef CFG_TEE_TRACE_PERFORMANCE + +static inline void print_cntvct_with_message(struct tee_tz *ptee, + u32 cmd, const char *msg) +{ +#ifdef CONFIG_ARM64 + + u64 val; + + __asm__ volatile("mrs %0, cntvct_el0" : "=r"(val)); + dev_info(DEV, "%s, cmd=%d, cntvct=0x%llx\n", msg, cmd, val); + +#else + + u32 cntvct_low, cntvct_high; + + __asm__ volatile("mrrc p15, 1, %0, %1, c14" + : "=r"(cntvct_low), "=r"(cntvct_high)); + dev_info(DEV, "%s, cmd=%d, cntvct=0x%x%08x\n", + msg, cmd, cntvct_high, cntvct_low); + +#endif +} + +#else + +static inline void print_cntvct_with_message(struct tee_tz *ptee, + u32 cmd, const char *msg) +{ + (void)&ptee; /*unused*/ + (void)&cmd; /*unused*/ + (void)&msg; /*unused*/ +} + +#endif + static void call_tee(struct tee_tz *ptee, uintptr_t parg32, struct teesmc32_arg *arg32) { @@ -330,6 +366,7 @@ static void call_tee(struct tee_tz *ptee, param.a1 = parg32; e_lock_teez(ptee); + print_cntvct_with_message(ptee, arg32->cmd, "TEEDriver: do smc call"); while (true) { param.a0 = funcid; @@ -354,6 +391,7 @@ static void call_tee(struct tee_tz *ptee, break; } } + print_cntvct_with_message(ptee, arg32->cmd, "TEEDriver: finish smc call"); e_unlock_teez(ptee); switch (ret) { |