diff options
author | Dimitris Papastamos <dimitris.papastamos@arm.com> | 2018-01-29 11:52:02 +0000 |
---|---|---|
committer | Dimitris Papastamos <dimitris.papastamos@arm.com> | 2018-02-13 11:47:29 +0000 |
commit | 6febe734d0485015b457238fcb7b197c6bf65b6e (patch) | |
tree | 1ecfc8dae160c8b66b2809613514cb3ab78d5a02 | |
parent | 5f9423b80b9eea52610dd9d151c6072c2bead569 (diff) |
Implement latency test for SMCCC_ARCH_WORKAROUND_1
Change-Id: I88d8b479c1025659a90c84d8f635998d791c4a49
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
-rw-r--r-- | include/runtime_services/arm_arch_svc.h | 14 | ||||
-rw-r--r-- | include/runtime_services/smc.h | 5 | ||||
-rw-r--r-- | tests/performance_tests/smc_latencies.c | 43 | ||||
-rw-r--r-- | tests/tests-performance.xml | 1 |
4 files changed, 63 insertions, 0 deletions
diff --git a/include/runtime_services/arm_arch_svc.h b/include/runtime_services/arm_arch_svc.h new file mode 100644 index 0000000..9531ebc --- /dev/null +++ b/include/runtime_services/arm_arch_svc.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __ARM_ARCH_SVC_H__ +#define __ARM_ARCH_SVC_H__ + +#define SMCCC_VERSION 0x80000000 +#define SMCCC_ARCH_FEATURES 0x80000001 +#define SMCCC_ARCH_WORKAROUND_1 0x80008000 + +#endif /* __ARM_ARCH_SVC_H__ */ diff --git a/include/runtime_services/smc.h b/include/runtime_services/smc.h index 188de0e..2ce2da5 100644 --- a/include/runtime_services/smc.h +++ b/include/runtime_services/smc.h @@ -31,6 +31,11 @@ #ifndef __SMC_H__ #define __SMC_H__ +#define SMCCC_MAJOR_VERSION 1 +#define SMCCC_MINOR_VERSION 1 + +#define MAKE_SMCCC_VERSION(_major, _minor) (((_major) << 16) | (_minor)) + #define SMC_UNKNOWN 0xffffffff /******************************************************************************* diff --git a/tests/performance_tests/smc_latencies.c b/tests/performance_tests/smc_latencies.c index b01e80b..85d031a 100644 --- a/tests/performance_tests/smc_latencies.c +++ b/tests/performance_tests/smc_latencies.c @@ -36,8 +36,10 @@ */ #include <arch_helpers.h> +#include <arm_arch_svc.h> #include <debug.h> #include <psci.h> +#include <smc.h> #include <std_svc.h> #include <string.h> #include <tftf_lib.h> @@ -156,3 +158,44 @@ test_result_t smc_std_svc_call_uid_latency(void) return TEST_RESULT_SUCCESS; } + +test_result_t smc_arch_workaround_1(void) +{ + struct latency_info latency; + smc_args args; + smc_ret_values ret; + int32_t expected_ver; + + /* Check if SMCCC version is at least v1.1 */ + expected_ver = MAKE_SMCCC_VERSION(1, 1); + memset(&args, 0, sizeof(args)); + args.arg0 = SMCCC_VERSION; + ret = tftf_smc(&args); + if ((int32_t)ret.ret0 < expected_ver) { + printf("Unexpected SMCCC version: 0x%x\n", + (int)ret.ret0); + return TEST_RESULT_SKIPPED; + } + + /* Check if SMCCC_ARCH_WORKAROUND_1 is implemented */ + memset(&args, 0, sizeof(args)); + args.arg0 = SMCCC_ARCH_FEATURES; + args.arg1 = SMCCC_ARCH_WORKAROUND_1; + ret = tftf_smc(&args); + if (ret.ret0 != 0) { + printf("SMCCC_ARCH_WORKAROUND_1 is not implemented\n"); + return TEST_RESULT_SKIPPED; + } + + memset(&args, 0, sizeof(args)); + args.arg0 = SMCCC_ARCH_WORKAROUND_1; + + test_measure_smc_latency(&args, &latency); + tftf_testcase_printf( + "Average time: %llu ns (ranging from %llu to %llu)\n", + (unsigned long long) latency.avg, + (unsigned long long) latency.min, + (unsigned long long) latency.max); + + return TEST_RESULT_SUCCESS; +} diff --git a/tests/tests-performance.xml b/tests/tests-performance.xml index 750eb03..f4239c7 100644 --- a/tests/tests-performance.xml +++ b/tests/tests-performance.xml @@ -17,6 +17,7 @@ <testsuite name="Performance tests" description="Measure some performance"> <testcase name="PSCI_VERSION latency" function="smc_psci_version_latency" /> <testcase name="Standard Service Call UID latency" function="smc_std_svc_call_uid_latency" /> + <testcase name="SMCCC_ARCH_WORKAROUND_1 latency" function="smc_arch_workaround_1" /> </testsuite> </testsuites> |