diff options
author | Soby Mathew <soby.mathew@arm.com> | 2016-07-13 17:55:08 +0100 |
---|---|---|
committer | Soby Mathew <soby.mathew@arm.com> | 2016-09-26 14:44:55 +0100 |
commit | 3dba8936dbf4745bc08475096bdb93be82a8e61d (patch) | |
tree | 035d31af77bc912ef769dd94b3beaef6cc40ea21 | |
parent | 93d4f89187e2bf24b1bf64736a7c0084683aebff (diff) |
AArch32: Rework SMC helpers
This patch introduces SMC framework for AArch32. The existing SMC helper
functions have been made architecture-agnostic. The `smc64_args` structure
is renamed to just `smc_args`. Similarly the `smc64_ret_values` is renamed
to `smc_ret_values`. All the users of the SMC helpers are also modified
in this patch.
This patch also removes the `noinline` directive from the function prototype
of `asm_tftf_smc64()`. This is because this assembly function is a separate
compilation unit and the compiler cannot inline it anyway hence making the
`noinline` directive redundant.
Change-Id: I6fc34fc95dc7c0ac030113e43f681dff8d2d7ccf
25 files changed, 262 insertions, 169 deletions
diff --git a/framework/framework.mk b/framework/framework.mk index 81cd632..0527c6b 100644 --- a/framework/framework.mk +++ b/framework/framework.mk @@ -67,8 +67,8 @@ FRAMEWORK_SOURCES := ${AUTOGEN_DIR}/tests_list.c \ lib/power_management/suspend/asm_tftf_suspend.S \ lib/power_management/suspend/tftf_suspend.c \ lib/psci/psci.c \ - lib/smc/asm_smc.S \ - lib/smc/smc.c \ + lib/smc/aarch64/asm_smc.S \ + lib/smc/aarch64/smc.c \ ${STD_LIB_SOURCES} \ lib/trusted_os/trusted_os.c \ lib/utils/mp_printf.c \ diff --git a/fwu/ns_bl1u/ns_bl1u.mk b/fwu/ns_bl1u/ns_bl1u.mk index d546e8c..a717f61 100644 --- a/fwu/ns_bl1u/ns_bl1u.mk +++ b/fwu/ns_bl1u/ns_bl1u.mk @@ -38,8 +38,8 @@ NS_BL1U_SOURCES := drivers/io/io_fip.c \ lib/aarch64/cache_helpers.S \ lib/aarch64/misc_helpers.S \ lib/locks/aarch64/spinlock.S \ - lib/smc/asm_smc.S \ - lib/smc/smc.c \ + lib/smc/aarch64/asm_smc.S \ + lib/smc/aarch64/smc.c \ ${STD_LIB_SOURCES} \ lib/utils/mp_printf.c \ lib/utils/uuid.c \ diff --git a/fwu/ns_bl1u/ns_bl1u_main.c b/fwu/ns_bl1u/ns_bl1u_main.c index 47f218c..35c2a7f 100644 --- a/fwu/ns_bl1u/ns_bl1u_main.c +++ b/fwu/ns_bl1u/ns_bl1u_main.c @@ -118,9 +118,9 @@ void ns_bl1u_fwu_smc_call(unsigned int smc_id, unsigned long x3, unsigned long x4) { - smc64_ret_values fwu_result = {0}; - smc64_args fwu_params = {smc_id, x1, x2, x3, x4}; - fwu_result = tftf_smc64(&fwu_params); + smc_ret_values fwu_result = {0}; + smc_args fwu_params = {smc_id, x1, x2, x3, x4}; + fwu_result = tftf_smc(&fwu_params); smc_result = fwu_result.ret0; } diff --git a/fwu/ns_bl2u/ns_bl2u.mk b/fwu/ns_bl2u/ns_bl2u.mk index a83b617..09aceb9 100644 --- a/fwu/ns_bl2u/ns_bl2u.mk +++ b/fwu/ns_bl2u/ns_bl2u.mk @@ -36,8 +36,8 @@ NS_BL2U_SOURCES := framework/aarch64/arch.c \ lib/aarch64/cache_helpers.S \ lib/aarch64/misc_helpers.S \ lib/locks/aarch64/spinlock.S \ - lib/smc/asm_smc.S \ - lib/smc/smc.c \ + lib/smc/aarch64/asm_smc.S \ + lib/smc/aarch64/smc.c \ ${STD_LIB_SOURCES} \ lib/utils/mp_printf.c \ lib/utils/uuid.c \ diff --git a/fwu/ns_bl2u/ns_bl2u_main.c b/fwu/ns_bl2u/ns_bl2u_main.c index e08e108..3513dd7 100644 --- a/fwu/ns_bl2u/ns_bl2u_main.c +++ b/fwu/ns_bl2u/ns_bl2u_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -39,8 +39,8 @@ extern const char version_string[]; void ns_bl2u_main(void) { - smc64_args fwu_params = {0}; - smc64_ret_values fwu_result = {0}; + smc_args fwu_params = {0}; + smc_ret_values fwu_result = {0}; NOTICE("NS_BL2U: %s\n", version_string); NOTICE("NS_BL2U: %s\n", build_message); @@ -76,7 +76,7 @@ void ns_bl2u_main(void) /* Call FWU_SMC_UPDATE_DONE to indicate image update done. */ INFO("NS_BL2U: Calling FWU_SMC_UPDATE_DONE\n"); fwu_params.arg0 = FWU_SMC_UPDATE_DONE; - fwu_result = tftf_smc64(&fwu_params); + fwu_result = tftf_smc(&fwu_params); ERROR("NS_BL2U: Unexpected return from FWU process (%d)\n", (int)fwu_result.ret0); panic(); diff --git a/include/lib/tftf_lib.h b/include/lib/tftf_lib.h index ae729a4..9308500 100644 --- a/include/lib/tftf_lib.h +++ b/include/lib/tftf_lib.h @@ -139,29 +139,29 @@ unsigned int tftf_is_psci_pstate_format_original(void); void waitms(uint64_t ms); -/* SMC64 calls can take up to 7 64-bit arguments */ +/* SMC calls can take up to 7 register arguments */ typedef struct { - uint64_t arg0; - uint64_t arg1; - uint64_t arg2; - uint64_t arg3; - uint64_t arg4; - uint64_t arg5; - uint64_t arg6; -} smc64_args; - -/* SMC64 calls can return up to 4 64-bit arguments */ + u_register_t arg0; + u_register_t arg1; + u_register_t arg2; + u_register_t arg3; + u_register_t arg4; + u_register_t arg5; + u_register_t arg6; +} smc_args; + +/* SMC calls can return up to 4 register values */ typedef struct { - uint64_t ret0; - uint64_t ret1; - uint64_t ret2; - uint64_t ret3; -} smc64_ret_values; + u_register_t ret0; + u_register_t ret1; + u_register_t ret2; + u_register_t ret3; +} smc_ret_values; /* - * Trigger an SMC64 call. + * Trigger an SMC call. */ -smc64_ret_values tftf_smc64(const smc64_args *args); +smc_ret_values tftf_smc(const smc_args *args); /* * Write a formatted string in the test output buffer. diff --git a/lib/power_management/suspend/tftf_suspend.c b/lib/power_management/suspend/tftf_suspend.c index 3e8cd93..e111968 100644 --- a/lib/power_management/suspend/tftf_suspend.c +++ b/lib/power_management/suspend/tftf_suspend.c @@ -27,20 +27,20 @@ int32_t tftf_enter_suspend(const suspend_info_t *info, tftf_suspend_ctx_t *ctx) { - smc64_args cpu_suspend_args = { + smc_args cpu_suspend_args = { info->psci_api, info->power_state, - (uint64_t)__tftf_cpu_resume_ep, - (uint64_t)ctx + (uintptr_t)__tftf_cpu_resume_ep, + (u_register_t)ctx }; - smc64_args system_suspend_args = { + smc_args system_suspend_args = { info->psci_api, - (uint64_t)__tftf_cpu_resume_ep, - (uint64_t)ctx + (uintptr_t)__tftf_cpu_resume_ep, + (u_register_t)ctx }; - smc64_ret_values rc; + smc_ret_values rc; if (info->save_system_context) { ctx->save_system_context = 1; @@ -60,9 +60,9 @@ int32_t tftf_enter_suspend(const suspend_info_t *info, flush_dcache_range((uint64_t)ctx, sizeof(*ctx)); if (info->psci_api == SMC_PSCI_CPU_SUSPEND_AARCH64) - rc = tftf_smc64(&cpu_suspend_args); + rc = tftf_smc(&cpu_suspend_args); else - rc = tftf_smc64(&system_suspend_args); + rc = tftf_smc(&system_suspend_args); /* * If execution reaches this point, The above SMC call was an invalid diff --git a/lib/psci/psci.c b/lib/psci/psci.c index 7b524a3..6768223 100644 --- a/lib/psci/psci.c +++ b/lib/psci/psci.c @@ -78,25 +78,25 @@ int32_t tftf_psci_cpu_on(u_register_t target_cpu, uintptr_t entry_point_address, u_register_t context_id) { - smc64_args args = { + smc_args args = { SMC_PSCI_CPU_ON_AARCH64, target_cpu, entry_point_address, context_id }; - smc64_ret_values ret_vals; + smc_ret_values ret_vals; - ret_vals = tftf_smc64(&args); + ret_vals = tftf_smc(&args); return ret_vals.ret0; } int32_t tftf_psci_cpu_off(void) { - smc64_args args = { SMC_PSCI_CPU_OFF }; - smc64_ret_values ret_vals; + smc_args args = { SMC_PSCI_CPU_OFF }; + smc_ret_values ret_vals; - ret_vals = tftf_smc64(&args); + ret_vals = tftf_smc(&args); return ret_vals.ret0; } @@ -104,68 +104,68 @@ int32_t tftf_psci_cpu_off(void) u_register_t tftf_psci_stat_residency(u_register_t target_cpu, uint32_t power_state) { - smc64_args args = { + smc_args args = { SMC_PSCI_STAT_RESIDENCY64, target_cpu, power_state, }; - smc64_ret_values ret_vals; + smc_ret_values ret_vals; - ret_vals = tftf_smc64(&args); + ret_vals = tftf_smc(&args); return ret_vals.ret0; } u_register_t tftf_psci_stat_count(u_register_t target_cpu, uint32_t power_state) { - smc64_args args = { + smc_args args = { SMC_PSCI_STAT_COUNT64, target_cpu, power_state, }; - smc64_ret_values ret_vals; + smc_ret_values ret_vals; - ret_vals = tftf_smc64(&args); + ret_vals = tftf_smc(&args); return ret_vals.ret0; } int32_t tftf_psci_affinity_info(u_register_t target_affinity, uint32_t lowest_affinity_level) { - smc64_ret_values ret_vals; + smc_ret_values ret_vals; - smc64_args args = { + smc_args args = { SMC_PSCI_AFFINITY_INFO_AARCH64, target_affinity, lowest_affinity_level }; - ret_vals = tftf_smc64(&args); + ret_vals = tftf_smc(&args); return ret_vals.ret0; } int32_t tftf_psci_node_hw_state(u_register_t target_cpu, uint32_t power_level) { - smc64_args args = { + smc_args args = { SMC_PSCI_CPU_HW_STATE64, target_cpu, power_level }; - smc64_ret_values ret; + smc_ret_values ret; - ret = tftf_smc64(&args); + ret = tftf_smc(&args); return ret.ret0; } int32_t tftf_get_psci_feature_info(uint32_t psci_func_id) { - smc64_args args = { + smc_args args = { SMC_PSCI_FEATURES, psci_func_id }; - smc64_ret_values ret; + smc_ret_values ret; - ret = tftf_smc64(&args); + ret = tftf_smc(&args); return ret.ret0; } @@ -341,10 +341,10 @@ unsigned int tftf_is_psci_pstate_format_original(void) unsigned int tftf_get_psci_version(void) { - smc64_args args = { SMC_PSCI_VERSION }; - smc64_ret_values ret; + smc_args args = { SMC_PSCI_VERSION }; + smc_ret_values ret; - ret = tftf_smc64(&args); + ret = tftf_smc(&args); return ret.ret0; } diff --git a/lib/smc/aarch32/asm_smc.S b/lib/smc/aarch32/asm_smc.S new file mode 100644 index 0000000..b2d724c --- /dev/null +++ b/lib/smc/aarch32/asm_smc.S @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of ARM nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <asm_macros.S> + + .globl asm_tftf_smc32 + +/* --------------------------------------------------------------------------- + * void asm_tftf_smc32(const smc_args *args, + * smc_ret_values *smc_ret); + * --------------------------------------------------------------------------- + */ +func asm_tftf_smc32 + push {r4 - r7} + /* Store the `smc_ret` pointer in a callee saved register */ + mov r7, r1 + ldm r0, {r0 - r6} + + smc #0 + + stm r7, {r0 - r3} + pop {r4 - r7} + bx lr +endfunc asm_tftf_smc32 diff --git a/lib/smc/aarch32/smc.c b/lib/smc/aarch32/smc.c new file mode 100644 index 0000000..0e7eb98 --- /dev/null +++ b/lib/smc/aarch32/smc.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016, ARM Limited. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the ARM nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <stdint.h> +#include <tftf.h> + +void asm_tftf_smc32(const smc_args *args, + smc_ret_values *smc_ret); + +smc_ret_values tftf_smc(const smc_args *args) +{ + smc_ret_values ret = {0}; + asm_tftf_smc32(args, &ret); + + return ret; +} diff --git a/lib/smc/asm_smc.S b/lib/smc/aarch64/asm_smc.S index 271083e..056e5cb 100644 --- a/lib/smc/asm_smc.S +++ b/lib/smc/aarch64/asm_smc.S @@ -36,7 +36,7 @@ /* --------------------------------------------------------------------------- - * __noinline smc64_ret_values asm_tftf_smc64(uint64_t arg0, + * smc_ret_values asm_tftf_smc64(uint64_t arg0, * uint64_t arg1, * uint64_t arg2, * uint64_t arg3, @@ -49,7 +49,7 @@ func asm_tftf_smc64 /* * According to the AAPCS64, x8 is the indirect result location * register. It contains the address of the memory block that the caller - * has reserved to hold the result, i.e. the smc64_ret_values structure + * has reserved to hold the result, i.e. the smc_ret_values structure * in our case. * x8 might be clobbered across the SMC call so save it on the stack. * Although x8 contains an 8 byte value, we are allocating 16bytes on the stack @@ -64,7 +64,7 @@ func asm_tftf_smc64 ldr x9, [sp], #16 /* - * Return values are stored in x0-x3, put them in the 'smc64_ret_values' + * Return values are stored in x0-x3, put them in the 'smc_ret_values' * return structure */ stp x0, x1, [x9, #0] diff --git a/lib/smc/smc.c b/lib/smc/aarch64/smc.c index 8449712..a71bb2f 100644 --- a/lib/smc/smc.c +++ b/lib/smc/aarch64/smc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, ARM Limited. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -31,19 +31,15 @@ #include <stdint.h> #include <tftf.h> -/* - * Note: This function must not be inlined, otherwise we can't rely on the - * AAPCS64. - */ -__noinline smc64_ret_values asm_tftf_smc64(uint64_t arg0, - uint64_t arg1, - uint64_t arg2, - uint64_t arg3, - uint64_t arg4, - uint64_t arg5, - uint64_t arg6); +smc_ret_values asm_tftf_smc64(u_register_t arg0, + u_register_t arg1, + u_register_t arg2, + u_register_t arg3, + u_register_t arg4, + u_register_t arg5, + u_register_t arg6); -smc64_ret_values tftf_smc64(const smc64_args *args) +smc_ret_values tftf_smc(const smc_args *args) { return asm_tftf_smc64(args->arg0, args->arg1, diff --git a/lib/trusted_os/trusted_os.c b/lib/trusted_os/trusted_os.c index 1785416..44f7fc0 100644 --- a/lib/trusted_os/trusted_os.c +++ b/lib/trusted_os/trusted_os.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, ARM Limited. All rights reserved. + * Copyright (c) 2014-2016, ARM Limited. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -36,11 +36,11 @@ unsigned int is_trusted_os_present(uuid_t *tos_uuid) { - smc64_args tos_uid_args = { SMC_TOS_UID }; - smc64_ret_values ret; + smc_args tos_uid_args = { SMC_TOS_UID }; + smc_ret_values ret; uint32_t *tos_uuid32; - ret = tftf_smc64(&tos_uid_args); + ret = tftf_smc(&tos_uid_args); if ((ret.ret0 == SMC_UNKNOWN) || ((ret.ret0 == 0) && (ret.ret1 == 0) && (ret.ret2 == 0) && diff --git a/tests/fwu_tests/test_fwu_auth.c b/tests/fwu_tests/test_fwu_auth.c index 6b0d283..09502ad 100644 --- a/tests/fwu_tests/test_fwu_auth.c +++ b/tests/fwu_tests/test_fwu_auth.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -50,8 +50,8 @@ test_result_t test_fwu_auth(void) { STATUS status; unsigned int flag; - smc64_args args = { SMC_PSCI_SYSTEM_RESET }; - smc64_ret_values ret = {0}; + smc_args args = { SMC_PSCI_SYSTEM_RESET }; + smc_ret_values ret = {0}; if (tftf_is_rebooted()) { /* @@ -96,7 +96,7 @@ test_result_t test_fwu_auth(void) tftf_notify_reboot(); /* Request PSCI system reset. */ - ret = tftf_smc64(&args); + ret = tftf_smc(&args); /* The PSCI SYSTEM_RESET call is not supposed to return */ tftf_testcase_printf("System didn't reboot properly (%d)\n", diff --git a/tests/fwu_tests/test_fwu_toc.c b/tests/fwu_tests/test_fwu_toc.c index fee7582..dbbaa17 100644 --- a/tests/fwu_tests/test_fwu_toc.c +++ b/tests/fwu_tests/test_fwu_toc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -49,8 +49,8 @@ test_result_t test_fwu_toc(void) { STATUS status; unsigned int toc_header; - smc64_args args = { SMC_PSCI_SYSTEM_RESET }; - smc64_ret_values ret = {0}; + smc_args args = { SMC_PSCI_SYSTEM_RESET }; + smc_ret_values ret = {0}; if (tftf_is_rebooted()) { /* @@ -85,7 +85,7 @@ test_result_t test_fwu_toc(void) tftf_notify_reboot(); /* Request PSCI system reset. */ - ret = tftf_smc64(&args); + ret = tftf_smc(&args); /* The PSCI SYSTEM_RESET call is not supposed to return */ tftf_testcase_printf("System didn't reboot properly (%d)\n", diff --git a/tests/performance_tests/smc_latencies.c b/tests/performance_tests/smc_latencies.c index 3317962..7fd66be 100644 --- a/tests/performance_tests/smc_latencies.c +++ b/tests/performance_tests/smc_latencies.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -78,7 +78,7 @@ static inline unsigned long long cycles_to_ns(unsigned long long cycles) * number of cycles for each SMC and the average number of cycles for an SMC * round trip. */ -static void test_measure_smc_latency(const smc64_args *smc_args, +static void test_measure_smc_latency(const smc_args *smc_args, struct latency_info *latency) { unsigned long long cycles; @@ -93,7 +93,7 @@ static void test_measure_smc_latency(const smc64_args *smc_args, for (unsigned int i = 0; i < ITERATIONS_CNT; ++i) { cycles = read_cntpct_el0(); - tftf_smc64(smc_args); + tftf_smc(smc_args); cycles = read_cntpct_el0() - cycles; min_cycles = MIN(min_cycles, cycles); @@ -125,7 +125,7 @@ static void test_measure_smc_latency(const smc64_args *smc_args, test_result_t smc_psci_version_latency(void) { struct latency_info latency; - smc64_args args = { PSCI_VERSION }; + smc_args args = { PSCI_VERSION }; test_measure_smc_latency(&args, &latency); tftf_testcase_printf( @@ -145,7 +145,7 @@ test_result_t smc_psci_version_latency(void) test_result_t smc_std_svc_call_uid_latency(void) { struct latency_info latency; - smc64_args args = { SMC_STD_SVC_UID }; + smc_args args = { SMC_STD_SVC_UID }; test_measure_smc_latency(&args, &latency); tftf_testcase_printf( diff --git a/tests/runtime_services/standard_service/psci/api_tests/migrate_info_type/test_migrate_info_type.c b/tests/runtime_services/standard_service/psci/api_tests/migrate_info_type/test_migrate_info_type.c index e211be1..4a981f0 100644 --- a/tests/runtime_services/standard_service/psci/api_tests/migrate_info_type/test_migrate_info_type.c +++ b/tests/runtime_services/standard_service/psci/api_tests/migrate_info_type/test_migrate_info_type.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -61,14 +61,14 @@ test_result_t test_migrate_info_type(void) { uuid_t tos_uuid; char tos_uuid_str[UUID_STR_SIZE]; - smc64_args args; - smc64_ret_values ret; + smc_args args; + smc_ret_values ret; int32_t mp_support; int32_t migrate_ret; /* Identify the level of multicore support present in the Trusted OS */ args.arg0 = SMC_PSCI_MIG_INFO_TYPE; - ret = tftf_smc64(&args); + ret = tftf_smc(&args); mp_support = (int32_t) ret.ret0; if (is_trusted_os_present(&tos_uuid)) { @@ -114,7 +114,7 @@ test_result_t test_migrate_info_type(void) * invalid parameters */ args.arg1 = read_mpidr_el1() & MPID_MASK; - ret = tftf_smc64(&args); + ret = tftf_smc(&args); migrate_ret = (int32_t) ret.ret0; if (migrate_ret != PSCI_E_NOT_SUPPORTED) { diff --git a/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c b/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c index 5058b8c..27e6d66 100644 --- a/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c +++ b/tests/runtime_services/standard_service/psci/api_tests/psci_stat/test_psci_stat.c @@ -875,7 +875,7 @@ static test_result_t verify_psci_stats_cold_boot(void) */ test_result_t test_psci_stats_after_shutdown(void) { - smc64_args args = { SMC_PSCI_SYSTEM_OFF }; + smc_args args = { SMC_PSCI_SYSTEM_OFF }; if (!is_psci_stat_supported()) return TEST_RESULT_SKIPPED; @@ -889,7 +889,7 @@ test_result_t test_psci_stats_after_shutdown(void) } tftf_notify_reboot(); - tftf_smc64(&args); + tftf_smc(&args); /* The PSCI SYSTEM_OFF call is not supposed to return */ tftf_testcase_printf("System didn't shutdown properly\n"); @@ -902,7 +902,7 @@ test_result_t test_psci_stats_after_shutdown(void) */ test_result_t test_psci_stats_after_reset(void) { - smc64_args args = { SMC_PSCI_SYSTEM_RESET }; + smc_args args = { SMC_PSCI_SYSTEM_RESET }; if (!is_psci_stat_supported()) return TEST_RESULT_SKIPPED; @@ -916,7 +916,7 @@ test_result_t test_psci_stats_after_reset(void) } tftf_notify_reboot(); - tftf_smc64(&args); + tftf_smc(&args); /* The PSCI SYSTEM_RESET call is not supposed to return */ tftf_testcase_printf("System didn't reset properly\n"); diff --git a/tests/runtime_services/standard_service/psci/api_tests/psci_version/test_psci_version.c b/tests/runtime_services/standard_service/psci/api_tests/psci_version/test_psci_version.c index 558bd3d..2194f05 100644 --- a/tests/runtime_services/standard_service/psci/api_tests/psci_version/test_psci_version.c +++ b/tests/runtime_services/standard_service/psci/api_tests/psci_version/test_psci_version.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -40,10 +40,10 @@ */ test_result_t test_psci_version(void) { - smc64_args args = { SMC_PSCI_VERSION }; - smc64_ret_values ret; + smc_args args = { SMC_PSCI_VERSION }; + smc_ret_values ret; - ret = tftf_smc64(&args); + ret = tftf_smc(&args); if (ret.ret0 != PSCI_VERSION) { tftf_testcase_printf( diff --git a/tests/runtime_services/standard_service/psci/api_tests/system_off/test_system_off.c b/tests/runtime_services/standard_service/psci/api_tests/system_off/test_system_off.c index 229016d..ef1ac8e 100644 --- a/tests/runtime_services/standard_service/psci/api_tests/system_off/test_system_off.c +++ b/tests/runtime_services/standard_service/psci/api_tests/system_off/test_system_off.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -39,7 +39,7 @@ */ test_result_t test_system_off(void) { - smc64_args args = { SMC_PSCI_SYSTEM_OFF }; + smc_args args = { SMC_PSCI_SYSTEM_OFF }; if (tftf_is_rebooted()) { /* Successfully resumed from system off */ @@ -47,7 +47,7 @@ test_result_t test_system_off(void) } tftf_notify_reboot(); - tftf_smc64(&args); + tftf_smc(&args); /* The PSCI SYSTEM_OFF call is not supposed to return */ tftf_testcase_printf("System didn't shutdown properly\n"); diff --git a/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c b/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c index 5cb0af1..aedfdc5 100644 --- a/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c +++ b/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c @@ -239,17 +239,17 @@ test_result_t test_system_suspend_from_all_cores(void) /* * Helper function to issue SYSTEM SUSPEND SMC with custom parameters. */ -int sys_suspend_helper(uint64_t entry_point_address, - uint64_t context_id) +int sys_suspend_helper(uintptr_t entry_point_address, + u_register_t context_id) { - smc64_args args = { + smc_args args = { SMC_PSCI_SYSTEM_SUSPEND64, - (uint64_t)entry_point_address, - (uint64_t)context_id + (uintptr_t)entry_point_address, + (u_register_t)context_id }; - smc64_ret_values ret_vals; + smc_ret_values ret_vals; - ret_vals = tftf_smc64(&args); + ret_vals = tftf_smc(&args); return ret_vals.ret0; } @@ -270,7 +270,7 @@ static test_result_t invalid_entrypoint_for_sys_suspend(void) while (!is_sys_suspend_state_ready()) ; - psci_ret = sys_suspend_helper((uint64_t) 0x1, 0); + psci_ret = sys_suspend_helper((uintptr_t) 0x1, 0); if (psci_ret != PSCI_E_INVALID_ADDRESS) { tftf_testcase_printf("Test failed with invalid entry addr %x\n", psci_ret); diff --git a/tests/runtime_services/standard_service/query_std_svc.c b/tests/runtime_services/standard_service/query_std_svc.c index d08c000..a9082e1 100644 --- a/tests/runtime_services/standard_service/query_std_svc.c +++ b/tests/runtime_services/standard_service/query_std_svc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -58,15 +58,15 @@ static const uuid_t armtf_std_svc_uuid = { */ test_result_t test_query_std_svc(void) { - smc64_args std_svc_args; - smc64_ret_values ret; + smc_args std_svc_args; + smc_ret_values ret; uuid_t std_svc_uuid; char uuid_str[UUID_STR_SIZE]; test_result_t test_result = TEST_RESULT_SUCCESS; /* Standard Service Call UID */ std_svc_args.arg0 = SMC_STD_SVC_UID; - ret = tftf_smc64(&std_svc_args); + ret = tftf_smc(&std_svc_args); make_uuid_from_4words(&std_svc_uuid, ret.ret0, ret.ret1, ret.ret2, ret.ret3); @@ -80,7 +80,7 @@ test_result_t test_query_std_svc(void) /* Standard Service Call Count */ std_svc_args.arg0 = SMC_STD_SVC_CALL_COUNT; - ret = tftf_smc64(&std_svc_args); + ret = tftf_smc(&std_svc_args); if (ret.ret0 == SMC_UNKNOWN) { tftf_testcase_printf("Querying STD service call count" @@ -88,19 +88,20 @@ test_result_t test_query_std_svc(void) test_result = TEST_RESULT_FAIL; } else { tftf_testcase_printf("STD Service Call Count reported by firmware:" - " %lu\n", ret.ret0); + " %llu\n", (unsigned long long)ret.ret0); } /* Standard Service Call Revision details */ std_svc_args.arg0 = SMC_STD_SVC_REVISION; - ret = tftf_smc64(&std_svc_args); + ret = tftf_smc(&std_svc_args); if ((ret.ret0 != STD_SVC_REVISION_MAJOR) || (ret.ret1 != STD_SVC_REVISION_MINOR)) { tftf_testcase_printf( - "Wrong Revision: expected {%u.%u}, got {%lu.%lu}\n", + "Wrong Revision: expected {%u.%u}, got {%llu.%llu}\n", STD_SVC_REVISION_MAJOR, STD_SVC_REVISION_MINOR, - ret.ret0, ret.ret1); + (unsigned long long)ret.ret0, + (unsigned long long)ret.ret1); test_result = TEST_RESULT_FAIL; } diff --git a/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c b/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c index 6f22769..7f7539d 100644 --- a/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c +++ b/tests/runtime_services/trusted_os/tsp/test_normal_int_switch.c @@ -53,7 +53,7 @@ * preempt_tsp_via_SGI routine. */ typedef struct { - smc64_ret_values tsp_result; + smc_ret_values tsp_result; int wait_for_fiq; } irq_handler_shared_data; @@ -77,7 +77,7 @@ static int sgi_handler(void *data) * This routine issues a SGI with interrupts disabled to make sure that the * pending SGI will preempt a STD SMC. */ -static test_result_t preempt_tsp_via_SGI(const smc64_args *tsp_svc_params, +static test_result_t preempt_tsp_via_SGI(const smc_args *tsp_svc_params, int hold_irq_handler_for_fiq) { int rc; @@ -114,11 +114,11 @@ static test_result_t preempt_tsp_via_SGI(const smc64_args *tsp_svc_params, * Invoke an STD SMC. Should be pre-empted because of the SGI that is * waiting. */ - shared_data.tsp_result = tftf_smc64(tsp_svc_params); + shared_data.tsp_result = tftf_smc(tsp_svc_params); if (shared_data.tsp_result.ret0 != TSP_SMC_PREEMPTED) { - tftf_testcase_printf("SMC returned 0x%lX instead of " + tftf_testcase_printf("SMC returned 0x%llX instead of " "TSP_SMC_PREEMPTED.\n", - shared_data.tsp_result.ret0); + (unsigned long long)shared_data.tsp_result.ret0); result = TEST_RESULT_FAIL; } @@ -148,8 +148,8 @@ static test_result_t preempt_tsp_via_SGI(const smc64_args *tsp_svc_params, */ test_result_t tsp_int_and_resume(void) { - smc64_args tsp_svc_params; - smc64_ret_values tsp_result = {0}; + smc_args tsp_svc_params; + smc_ret_values tsp_result = {0}; test_result_t res; uuid_t tos_uuid; char tos_uuid_str[UUID_STR_SIZE]; @@ -176,7 +176,7 @@ test_result_t tsp_int_and_resume(void) /* Now that we have ensured preemption, issue RESUME */ tsp_svc_params.arg0 = TSP_FID_RESUME; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); /* Check the result of the addition */ if (tsp_result.ret0 != 0 || tsp_result.ret1 != 8 || @@ -200,7 +200,7 @@ test_result_t tsp_int_and_resume(void) /* Now that we have ensured preemption, issue RESUME */ tsp_svc_params.arg0 = TSP_FID_RESUME; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); /* Check the result of the substraction */ if (tsp_result.ret0 != 0 || tsp_result.ret1 != 0 || @@ -223,7 +223,7 @@ test_result_t tsp_int_and_resume(void) /* Now that we have ensured preemption, issue RESUME */ tsp_svc_params.arg0 = TSP_FID_RESUME; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); /* Check the result of the multiplication */ if (tsp_result.ret0 != 0 || tsp_result.ret1 != 16 || @@ -246,7 +246,7 @@ test_result_t tsp_int_and_resume(void) /* Now that we have ensured preemption, issue RESUME */ tsp_svc_params.arg0 = TSP_FID_RESUME; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); /* Check the result of the division */ if (tsp_result.ret0 != 0 || tsp_result.ret1 != 1 || @@ -272,8 +272,8 @@ test_result_t tsp_int_and_resume(void) */ test_result_t test_fast_smc_when_tsp_preempted(void) { - smc64_args tsp_svc_params; - smc64_ret_values tsp_result = {0}; + smc_args tsp_svc_params; + smc_ret_values tsp_result = {0}; test_result_t res = TEST_RESULT_SUCCESS; uuid_t tos_uuid; char tos_uuid_str[UUID_STR_SIZE]; @@ -303,7 +303,7 @@ test_result_t test_fast_smc_when_tsp_preempted(void) tsp_svc_params.arg1 = 4; tsp_svc_params.arg2 = 6; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); if (tsp_result.ret0 != SMC_UNKNOWN) { tftf_testcase_printf("Fast SMC should not execute" @@ -313,7 +313,7 @@ test_result_t test_fast_smc_when_tsp_preempted(void) /* Issue RESUME */ tsp_svc_params.arg0 = TSP_FID_RESUME; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); /* Check the result of the addition */ if (tsp_result.ret0 != 0 || tsp_result.ret1 != 8 || @@ -341,8 +341,8 @@ test_result_t test_fast_smc_when_tsp_preempted(void) */ test_result_t test_std_smc_when_tsp_preempted(void) { - smc64_args tsp_svc_params; - smc64_ret_values tsp_result = {0}; + smc_args tsp_svc_params; + smc_ret_values tsp_result = {0}; test_result_t res = TEST_RESULT_SUCCESS; uuid_t tos_uuid; char tos_uuid_str[UUID_STR_SIZE]; @@ -372,7 +372,7 @@ test_result_t test_std_smc_when_tsp_preempted(void) tsp_svc_params.arg1 = 4; tsp_svc_params.arg2 = 6; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); if (tsp_result.ret0 != SMC_UNKNOWN) { tftf_testcase_printf("Standard SMC should not execute" @@ -382,7 +382,7 @@ test_result_t test_std_smc_when_tsp_preempted(void) /* Issue RESUME */ tsp_svc_params.arg0 = TSP_FID_RESUME; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); /* Check the result of the addition */ if (tsp_result.ret0 != 0 || tsp_result.ret1 != 8 || @@ -406,8 +406,8 @@ test_result_t test_std_smc_when_tsp_preempted(void) */ test_result_t test_resume_smc_without_preemption(void) { - smc64_args tsp_svc_params; - smc64_ret_values tsp_result = {0}; + smc_args tsp_svc_params; + smc_ret_values tsp_result = {0}; uuid_t tos_uuid; char tos_uuid_str[UUID_STR_SIZE]; @@ -425,7 +425,7 @@ test_result_t test_resume_smc_without_preemption(void) /* Issue RESUME */ tsp_svc_params.arg0 = TSP_FID_RESUME; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); if (tsp_result.ret0 != SMC_UNKNOWN) { tftf_testcase_printf("SMC Resume should return UNKNOWN, got:%d\n", \ @@ -445,8 +445,8 @@ test_result_t test_resume_smc_without_preemption(void) */ test_result_t tsp_int_and_resume_stress(void) { - smc64_args tsp_svc_params; - smc64_ret_values tsp_result = {0}; + smc_args tsp_svc_params; + smc_ret_values tsp_result = {0}; test_result_t res = TEST_RESULT_SUCCESS; uuid_t tos_uuid; char tos_uuid_str[UUID_STR_SIZE]; @@ -479,7 +479,7 @@ test_result_t tsp_int_and_resume_stress(void) /* Issue RESUME */ tsp_svc_params.arg0 = TSP_FID_RESUME; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); /* Check the result of the addition */ if (tsp_result.ret0 != 0 || tsp_result.ret1 != 8 || @@ -513,8 +513,8 @@ test_result_t tsp_int_and_resume_stress(void) */ test_result_t tsp_fiq_while_int(void) { - smc64_args tsp_svc_params; - smc64_ret_values tsp_result = {0}; + smc_args tsp_svc_params; + smc_ret_values tsp_result = {0}; test_result_t res; uuid_t tos_uuid; char tos_uuid_str[UUID_STR_SIZE]; @@ -541,7 +541,7 @@ test_result_t tsp_fiq_while_int(void) /* Now that we have ensured preemption, issue RESUME */ tsp_svc_params.arg0 = TSP_FID_RESUME; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); /* Check the result of the addition */ if (tsp_result.ret0 != 0 || tsp_result.ret1 != 8 || diff --git a/tests/runtime_services/trusted_os/tsp/test_smc_tsp_std_fn_call.c b/tests/runtime_services/trusted_os/tsp/test_smc_tsp_std_fn_call.c index dec1107..80854d7 100644 --- a/tests/runtime_services/trusted_os/tsp/test_smc_tsp_std_fn_call.c +++ b/tests/runtime_services/trusted_os/tsp/test_smc_tsp_std_fn_call.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -49,8 +49,8 @@ */ test_result_t test_smc_tsp_std_fns_call(void) { - smc64_args std_svc_args; - smc64_ret_values ret; + smc_args std_svc_args; + smc_ret_values ret; uuid_t tos_uuid; char tos_uuid_str[UUID_STR_SIZE]; @@ -68,22 +68,24 @@ test_result_t test_smc_tsp_std_fns_call(void) /* TrustedOS Service Call Count */ std_svc_args.arg0 = SMC_TOS_CALL_COUNT; - ret = tftf_smc64(&std_svc_args); + ret = tftf_smc(&std_svc_args); if (ret.ret0 != TSP_NUM_FID) { tftf_testcase_printf("Wrong Call Count: expected %u,\n" - " got %lu\n", TSP_NUM_FID, ret.ret0); + " got %llu\n", TSP_NUM_FID, + (unsigned long long)ret.ret0); return TEST_RESULT_FAIL; } /* TrustedOS Service Call Revision details */ std_svc_args.arg0 = SMC_TOS_REVISION; - ret = tftf_smc64(&std_svc_args); + ret = tftf_smc(&std_svc_args); if ((ret.ret0 != TSP_REVISION_MAJOR) || ret.ret1 != TSP_REVISION_MINOR) { tftf_testcase_printf("Wrong Revision: expected {%u.%u}\n" - " got {%lu.%lu}\n", + " got {%llu.%llu}\n", TSP_REVISION_MAJOR, TSP_REVISION_MINOR, - ret.ret0, ret.ret1); + (unsigned long long)ret.ret0, + (unsigned long long)ret.ret1); return TEST_RESULT_FAIL; } diff --git a/tests/runtime_services/trusted_os/tsp/test_tsp_fast_smc.c b/tests/runtime_services/trusted_os/tsp/test_tsp_fast_smc.c index c464690..aa27fb1 100644 --- a/tests/runtime_services/trusted_os/tsp/test_tsp_fast_smc.c +++ b/tests/runtime_services/trusted_os/tsp/test_tsp_fast_smc.c @@ -62,10 +62,10 @@ static test_result_t validate_tsp_operations(uint64_t fn_identifier, uint64_t ret1, uint64_t ret2) { - smc64_args tsp_svc_params = {fn_identifier, arg1, arg2}; - smc64_ret_values tsp_result; + smc_args tsp_svc_params = {fn_identifier, arg1, arg2}; + smc_ret_values tsp_result; - tsp_result = tftf_smc64(&tsp_svc_params); + tsp_result = tftf_smc(&tsp_svc_params); if (tsp_result.ret0) { tftf_testcase_printf("TSP operation 0x%x failed, error:0x%x\n", |