diff options
42 files changed, 944 insertions, 612 deletions
diff --git a/docs/about/features.rst b/docs/about/features.rst index b6fc2d03d..dbaec1279 100644 --- a/docs/about/features.rst +++ b/docs/about/features.rst @@ -42,9 +42,9 @@ Still to come -------------- -*Copyright (c) 2019, Arm Limited. All rights reserved.* +*Copyright (c) 2019-2020, Arm Limited. All rights reserved.* -.. _SMC Calling Convention: http://infocenter.arm.com/help/topic/com.arm.doc.den0028b/ARM_DEN0028B_SMC_Calling_Convention.pdf +.. _SMC Calling Convention: https://developer.arm.com/docs/den0028/latest .. _Power State Coordination Interface (PSCI): PSCI_ .. _PSCI: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf .. _Software Delegated Exception Interface (SDEI): SDEI_ diff --git a/docs/getting_started/docs-build.rst b/docs/getting_started/docs-build.rst new file mode 100644 index 000000000..6a6992baf --- /dev/null +++ b/docs/getting_started/docs-build.rst @@ -0,0 +1,84 @@ +Building Documentation +====================== + +To create a rendered copy of this documentation locally you can use the +`Sphinx`_ tool to build and package the plain-text documents into HTML-formatted +pages. + +If you are building the documentation for the first time then you will need to +check that you have the required software packages, as described in the +*Prerequisites* section that follows. + +.. note:: + An online copy of the documentation is available at + https://trustedfirmware-a-tests.readthedocs.io, if you want to view a + rendered copy without doing a local build. + +Prerequisites +------------- + +For building a local copy of the documentation you will need, at minimum: + +- Python 3 (3.5 or later) +- PlantUML (1.2017.15 or later) + +You must also install the Python modules that are specified in the +``requirements.txt`` file in the root of the ``docs`` directory. These modules +can be installed using ``pip3`` (the Python Package Installer). Passing this +requirements file as an argument to ``pip3`` automatically installs the specific +module versions required by TF-A Tests. + +An example set of installation commands for Ubuntu 18.04 LTS follows, assuming +that the working directory is ``docs``: + +.. code:: shell + + sudo apt install python3 python3-pip plantuml + pip3 install [--user] -r requirements.txt + +.. note:: + Several other modules will be installed as dependencies. Please review + the list to ensure that there will be no conflicts with other modules already + installed in your environment. + +Passing the optional ``--user`` argument to ``pip3`` will install the Python +packages only for the current user. Omitting this argument will attempt to +install the packages globally and this will likely require the command to be run +as root or using ``sudo``. + +.. note:: + More advanced usage instructions for *pip* are beyond the scope of this + document but you can refer to the `pip homepage`_ for detailed guides. + +Building rendered documentation +------------------------------- + +The documentation can be built into HTML-formatted pages from the project's root +directory by running the following command. + +.. code:: shell + + make doc + +Output from the build process will be placed in: + +:: + + docs/build/html/ + +We also support building documentation in other formats. From the ``docs`` +directory of the project, run the following command to see the supported +formats. It is important to note that you will not get the correct result if the +command is run from the project's root directory, as that would invoke the +top-level Makefile for TF-A Tests themselves. + +.. code:: shell + + make help + +-------------- + +*Copyright (c) 2020, Arm Limited. All rights reserved.* + +.. _Sphinx: http://www.sphinx-doc.org/en/master/ +.. _pip homepage: https://pip.pypa.io/en/stable/ diff --git a/docs/getting_started/index.rst b/docs/getting_started/index.rst index a956efb39..42a0b5bf0 100644 --- a/docs/getting_started/index.rst +++ b/docs/getting_started/index.rst @@ -5,6 +5,7 @@ Getting Started :maxdepth: 1 requirements + docs-build obtain build build-options @@ -16,6 +17,6 @@ experience building and running `Trusted Firmware-A (TF-A)`_. -------------- -*Copyright (c) 2019, Arm Limited. All rights reserved.* +*Copyright (c) 2019-2020, Arm Limited. All rights reserved.* .. _Trusted Firmware-A (TF-A): https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git diff --git a/docs/implementing-tests.rst b/docs/implementing-tests.rst index e72a27723..8df667c24 100644 --- a/docs/implementing-tests.rst +++ b/docs/implementing-tests.rst @@ -110,7 +110,4 @@ See the template test manifest for reference: ``tftf/tests/tests-template.xml``. -------------- -*Copyright (c) 2018-2019, Arm Limited. All rights reserved.* - -.. _SMC Calling Convention: SMCCC_ -.. _SMCCC: http://infocenter.arm.com/help/topic/com.arm.doc.den0028b/ARM_DEN0028B_SMC_Calling_Convention.pdf +*Copyright (c) 2018-2020, Arm Limited. All rights reserved.* diff --git a/drivers/arm/pl011/aarch32/pl011_console.S b/drivers/arm/pl011/aarch32/pl011_console.S index c65c4f688..b201f047a 100644 --- a/drivers/arm/pl011/aarch32/pl011_console.S +++ b/drivers/arm/pl011/aarch32/pl011_console.S @@ -10,7 +10,7 @@ #include <drivers/console.h> .globl console_init - .globl console_putc + .globl console_pl011_putc .globl console_getc .globl console_try_getc .globl console_flush @@ -97,17 +97,19 @@ core_init_fail: bx lr endfunc console_core_init - /* --------------------------------------------- - * int console_putc(int c) + /* ------------------------------------------------- + * To allow alternate implementation of putc, pl011 + * is appended in the function name. + * int console_pl011_putc(int c) * * Clobber list : r1, r2 - * --------------------------------------------- + * ------------------------------------------------- */ -func console_putc +func console_pl011_putc ldr r1, =console_base ldr r1, [r1] b console_core_putc -endfunc console_putc +endfunc console_pl011_putc /* -------------------------------------------------------- * int console_core_putc(int c, uintptr_t base_addr) diff --git a/drivers/arm/pl011/aarch64/pl011_console.S b/drivers/arm/pl011/aarch64/pl011_console.S index 8b1e0624c..0d607b915 100644 --- a/drivers/arm/pl011/aarch64/pl011_console.S +++ b/drivers/arm/pl011/aarch64/pl011_console.S @@ -10,7 +10,7 @@ #include <drivers/console.h> .globl console_init - .globl console_putc + .globl console_pl011_putc .globl console_getc .globl console_try_getc .globl console_flush @@ -93,17 +93,20 @@ init_fail: ret endfunc console_core_init - /* --------------------------------------------- - * int console_putc(int c) + /* ------------------------------------------------- + * To allow alternate implementation of putc, pl011 + * is appended in the function name. + * + * int console_pl011_putc(int c) * * Clobber list : x1, x2 - * --------------------------------------------- + * ------------------------------------------------- */ -func console_putc +func console_pl011_putc adrp x1, console_base ldr x1, [x1, :lo12:console_base] b console_core_putc -endfunc console_putc +endfunc console_pl011_putc /* --------------------------------------------- * int console_core_putc(int c, uintptr_t base_addr) diff --git a/drivers/console/console.c b/drivers/console/console.c new file mode 100644 index 000000000..b2bae2843 --- /dev/null +++ b/drivers/console/console.c @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2020, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <drivers/arm/pl011.h> + +int console_putc(int c) +{ + return console_pl011_putc(c); +} diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h index 5c0f090e5..33fce5375 100644 --- a/include/common/test_helpers.h +++ b/include/common/test_helpers.h @@ -10,7 +10,7 @@ #include <arch_features.h> #include <plat_topology.h> #include <psci.h> -#include <spci_svc.h> +#include <ffa_svc.h> #include <tftf_lib.h> #include <trusted_os.h> #include <tsp.h> @@ -97,6 +97,24 @@ typedef test_result_t (*test_function_arg_t)(void *arg); } \ } while (0) +#define SKIP_TEST_IF_FGT_NOT_SUPPORTED() \ + do { \ + if (!is_armv8_6_fgt_present()) { \ + tftf_testcase_printf( \ + "Fine Grained Traps not supported\n"); \ + return TEST_RESULT_SKIPPED; \ + } \ + } while (0) + +#define SKIP_TEST_IF_ECV_NOT_SELF_SYNC() \ + do { \ + if (get_armv8_6_ecv_support() != \ + ID_AA64MMFR0_EL1_ECV_SELF_SYNCH) { \ + tftf_testcase_printf("ARMv8.6-ECV not supported\n"); \ + return TEST_RESULT_SKIPPED; \ + } \ + } while (0) + #define SKIP_TEST_IF_MM_NOT_PRESENT() \ do { \ smc_args version_smc = { MM_VERSION_AARCH32 }; \ @@ -143,27 +161,27 @@ typedef test_result_t (*test_function_arg_t)(void *arg); version & MM_VERSION_MINOR_MASK); \ } while (0) -#define SKIP_TEST_IF_SPCI_VERSION_LESS_THAN(major, minor) \ +#define SKIP_TEST_IF_FFA_VERSION_LESS_THAN(major, minor) \ do { \ - smc_args version_smc = { SPCI_VERSION }; \ + smc_args version_smc = { FFA_VERSION }; \ smc_ret_values smc_ret = tftf_smc(&version_smc); \ uint32_t version = smc_ret.ret2; \ \ - if (smc_ret.ret0 != SPCI_SUCCESS_SMC32) { \ + if (smc_ret.ret0 != FFA_SUCCESS_SMC32) { \ tftf_testcase_printf("SPM not detected.\n"); \ return TEST_RESULT_SKIPPED; \ } \ \ - if ((version & SPCI_VERSION_BIT31_MASK) != 0) { \ - tftf_testcase_printf("SPCI_VERSION bad response.\n"); \ + if ((version & FFA_VERSION_BIT31_MASK) != 0) { \ + tftf_testcase_printf("FFA_VERSION bad response.\n"); \ return TEST_RESULT_SKIPPED; \ } \ \ - if (version < MAKE_SPCI_VERSION(major, minor)) { \ - tftf_testcase_printf("SPCI_VERSION returned %d.%d\n" \ + if (version < MAKE_FFA_VERSION(major, minor)) { \ + tftf_testcase_printf("FFA_VERSION returned %d.%d\n" \ "The required version is %d.%d\n", \ - version >> SPCI_VERSION_MAJOR_SHIFT,\ - version & SPCI_VERSION_MINOR_MASK, \ + version >> FFA_VERSION_MAJOR_SHIFT,\ + version & FFA_VERSION_MINOR_MASK, \ major, minor); \ return TEST_RESULT_SKIPPED; \ } \ diff --git a/include/drivers/arm/pl011.h b/include/drivers/arm/pl011.h index cba325d5a..3e19ee895 100644 --- a/include/drivers/arm/pl011.h +++ b/include/drivers/arm/pl011.h @@ -75,4 +75,13 @@ /* Constants */ #define PL011_BAUDRATE 115200 +#ifndef __ASSEMBLER__ +#include <stdint.h> + +/* Functions */ + +int console_pl011_putc(int); + +#endif /* __ASSEMBLER__ */ + #endif /* __PL011_H__ */ diff --git a/include/lib/aarch64/arch.h b/include/lib/aarch64/arch.h index 4e9c03b49..718964e58 100644 --- a/include/lib/aarch64/arch.h +++ b/include/lib/aarch64/arch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -194,6 +194,17 @@ #define PARANGE_0101 U(48) #define PARANGE_0110 U(52) +#define ID_AA64MMFR0_EL1_ECV_SHIFT U(60) +#define ID_AA64MMFR0_EL1_ECV_MASK ULL(0xf) +#define ID_AA64MMFR0_EL1_ECV_NOT_SUPPORTED ULL(0x0) +#define ID_AA64MMFR0_EL1_ECV_SUPPORTED ULL(0x1) +#define ID_AA64MMFR0_EL1_ECV_SELF_SYNCH ULL(0x2) + +#define ID_AA64MMFR0_EL1_FGT_SHIFT U(56) +#define ID_AA64MMFR0_EL1_FGT_MASK ULL(0xf) +#define ID_AA64MMFR0_EL1_FGT_NOT_SUPPORTED ULL(0x0) +#define ID_AA64MMFR0_EL1_FGT_SUPPORTED ULL(0x1) + #define ID_AA64MMFR0_EL1_TGRAN4_SHIFT U(28) #define ID_AA64MMFR0_EL1_TGRAN4_MASK ULL(0xf) #define ID_AA64MMFR0_EL1_TGRAN4_SUPPORTED ULL(0x0) @@ -921,4 +932,19 @@ #define RGSR_EL1 S3_0_C1_C0_5 #define GCR_EL1 S3_0_C1_C0_6 +/******************************************************************************* + * Armv8.6 - Fine Grained Virtualization Traps Registers + ******************************************************************************/ +#define HFGRTR_EL2 S3_4_C1_C1_4 +#define HFGWTR_EL2 S3_4_C1_C1_5 +#define HFGITR_EL2 S3_4_C1_C1_6 +#define HDFGRTR_EL2 S3_4_C3_C1_4 +#define HDFGWTR_EL2 S3_4_C3_C1_5 + +/******************************************************************************* + * Armv8.6 - Enhanced Counter Virtualization Registers + ******************************************************************************/ +#define CNTPOFF_EL2 S3_4_C14_C0_6 + + #endif /* ARCH_H */ diff --git a/include/lib/aarch64/arch_features.h b/include/lib/aarch64/arch_features.h index 20433fd6d..fc9e8d439 100644 --- a/include/lib/aarch64/arch_features.h +++ b/include/lib/aarch64/arch_features.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -68,6 +68,18 @@ static inline unsigned int get_armv8_5_mte_support(void) ID_AA64PFR1_EL1_MTE_MASK); } +static inline bool is_armv8_6_fgt_present(void) +{ + return ((read_id_aa64mmfr0_el1() >> ID_AA64MMFR0_EL1_FGT_SHIFT) & + ID_AA64MMFR0_EL1_FGT_MASK) == ID_AA64MMFR0_EL1_FGT_SUPPORTED; +} + +static inline unsigned long int get_armv8_6_ecv_support(void) +{ + return ((read_id_aa64mmfr0_el1() >> ID_AA64MMFR0_EL1_ECV_SHIFT) & + ID_AA64MMFR0_EL1_ECV_MASK); +} + static inline uint32_t arch_get_debug_version(void) { return ((read_id_aa64dfr0_el1() & ID_AA64DFR0_DEBUG_BITS) >> diff --git a/include/lib/aarch64/arch_helpers.h b/include/lib/aarch64/arch_helpers.h index d16960af8..9bcd0bbdf 100644 --- a/include/lib/aarch64/arch_helpers.h +++ b/include/lib/aarch64/arch_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -475,6 +475,16 @@ DEFINE_RENAME_SYSREG_RW_FUNCS(tfsr_el1, TFSR_EL1) DEFINE_RENAME_SYSREG_RW_FUNCS(rgsr_el1, RGSR_EL1) DEFINE_RENAME_SYSREG_RW_FUNCS(gcr_el1, GCR_EL1) +/* Armv8.6 Fine Grained Virtualization Traps Registers */ +DEFINE_RENAME_SYSREG_RW_FUNCS(hfgrtr_el2, HFGRTR_EL2) +DEFINE_RENAME_SYSREG_RW_FUNCS(hfgwtr_el2, HFGWTR_EL2) +DEFINE_RENAME_SYSREG_RW_FUNCS(hfgitr_el2, HFGITR_EL2) +DEFINE_RENAME_SYSREG_RW_FUNCS(hdfgrtr_el2, HDFGRTR_EL2) +DEFINE_RENAME_SYSREG_RW_FUNCS(hdfgwtr_el2, HDFGWTR_EL2) + +/* Armv8.6 Enhanced Counter Virtualization Register */ +DEFINE_RENAME_SYSREG_RW_FUNCS(cntpoff_el2, CNTPOFF_EL2) + #define IS_IN_EL(x) \ (GET_EL(read_CurrentEl()) == MODE_EL##x) diff --git a/include/runtime_services/arm_arch_svc.h b/include/runtime_services/arm_arch_svc.h index 12358f8a6..36b44482a 100644 --- a/include/runtime_services/arm_arch_svc.h +++ b/include/runtime_services/arm_arch_svc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited. All rights reserved. + * Copyright (c) 2018-2020, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -9,6 +9,7 @@ #define SMCCC_VERSION 0x80000000 #define SMCCC_ARCH_FEATURES 0x80000001 +#define SMCCC_ARCH_SOC_ID 0x80000002 #define SMCCC_ARCH_WORKAROUND_1 0x80008000 #define SMCCC_ARCH_WORKAROUND_2 0x80007FFF diff --git a/include/runtime_services/ffa_helpers.h b/include/runtime_services/ffa_helpers.h new file mode 100644 index 000000000..f280c7733 --- /dev/null +++ b/include/runtime_services/ffa_helpers.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018-2020, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef FFA_HELPERS_H +#define FFA_HELPERS_H + +#include <tftf_lib.h> +#include <utils_def.h> + +/* This error code must be different to the ones used by FFA */ +#define FFA_TFTF_ERROR -42 + +#ifndef __ASSEMBLY__ + +#include <stdint.h> + +smc_ret_values ffa_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, uint32_t message); +smc_ret_values ffa_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id, uint64_t message); +smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id); + +#endif /* __ASSEMBLY__ */ + +#endif /* FFA_HELPERS_H */ diff --git a/include/runtime_services/ffa_svc.h b/include/runtime_services/ffa_svc.h new file mode 100644 index 000000000..541a75acf --- /dev/null +++ b/include/runtime_services/ffa_svc.h @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2018-2020, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef FFA_SVC_H +#define FFA_SVC_H + +#include <lib/utils_def.h> +#include <smccc.h> +#include <uuid.h> + +/* FFA error codes. */ +#define FFA_ERROR_NOT_SUPPORTED -1 +#define FFA_ERROR_INVALID_PARAMETER -2 +#define FFA_ERROR_NO_MEMORY -3 +#define FFA_ERROR_BUSY -4 +#define FFA_ERROR_INTERRUPTED -5 +#define FFA_ERROR_DENIED -6 +#define FFA_ERROR_RETRY -7 + +/* The macros below are used to identify FFA calls from the SMC function ID */ +#define FFA_FNUM_MIN_VALUE U(0x60) +#define FFA_FNUM_MAX_VALUE U(0x7f) +#define is_ffa_fid(fid) __extension__ ({ \ + __typeof__(fid) _fid = (fid); \ + ((GET_SMC_NUM(_fid) >= FFA_FNUM_MIN_VALUE) && \ + (GET_SMC_NUM(_fid) <= FFA_FNUM_MAX_VALUE)); }) + +/* FFA_VERSION helpers */ +#define FFA_VERSION_MAJOR U(1) +#define FFA_VERSION_MAJOR_SHIFT 16 +#define FFA_VERSION_MAJOR_MASK U(0x7FFF) +#define FFA_VERSION_MINOR U(0) +#define FFA_VERSION_MINOR_SHIFT 0 +#define FFA_VERSION_MINOR_MASK U(0xFFFF) +#define FFA_VERSION_BIT31_MASK (1 << 31) + +#define MAKE_FFA_VERSION(major, minor) \ + ((((major) & FFA_VERSION_MAJOR_MASK) << FFA_VERSION_MAJOR_SHIFT) | \ + (((minor) & FFA_VERSION_MINOR_MASK) << FFA_VERSION_MINOR_SHIFT)) +#define FFA_VERSION_COMPILED MAKE_FFA_VERSION(FFA_VERSION_MAJOR, \ + FFA_VERSION_MINOR) + +/* FFA_MSG_SEND helpers */ +#define FFA_MSG_SEND_ATTRS_BLK_SHIFT U(0) +#define FFA_MSG_SEND_ATTRS_BLK_MASK U(0x1) +#define FFA_MSG_SEND_ATTRS_BLK U(0) +#define FFA_MSG_SEND_ATTRS_BLK_NOT U(1) +#define FFA_MSG_SEND_ATTRS(blk) \ + (((blk) & FFA_MSG_SEND_ATTRS_BLK_MASK) \ + << FFA_MSG_SEND_ATTRS_BLK_SHIFT) + +/* Get FFA fastcall std FID from function number */ +#define FFA_FID(smc_cc, func_num) \ + ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \ + ((smc_cc) << FUNCID_CC_SHIFT) | \ + (OEN_STD_START << FUNCID_OEN_SHIFT) | \ + ((func_num) << FUNCID_NUM_SHIFT)) + +/* FFA function numbers */ +#define FFA_FNUM_ERROR U(0x60) +#define FFA_FNUM_SUCCESS U(0x61) +#define FFA_FNUM_INTERRUPT U(0x62) +#define FFA_FNUM_VERSION U(0x63) +#define FFA_FNUM_FEATURES U(0x64) +#define FFA_FNUM_RX_RELEASE U(0x65) +#define FFA_FNUM_RXTX_MAP U(0x66) +#define FFA_FNUM_RXTX_UNMAP U(0x67) +#define FFA_FNUM_PARTITION_INFO_GET U(0x68) +#define FFA_FNUM_ID_GET U(0x69) +#define FFA_FNUM_MSG_POLL U(0x6A) +#define FFA_FNUM_MSG_WAIT U(0x6B) +#define FFA_FNUM_MSG_YIELD U(0x6C) +#define FFA_FNUM_MSG_RUN U(0x6D) +#define FFA_FNUM_MSG_SEND U(0x6E) +#define FFA_FNUM_MSG_SEND_DIRECT_REQ U(0x6F) +#define FFA_FNUM_MSG_SEND_DIRECT_RESP U(0x70) +#define FFA_FNUM_MEM_DONATE U(0x71) +#define FFA_FNUM_MEM_LEND U(0x72) +#define FFA_FNUM_MEM_SHARE U(0x73) +#define FFA_FNUM_MEM_RETRIEVE_REQ U(0x74) +#define FFA_FNUM_MEM_RETRIEVE_RESP U(0x75) +#define FFA_FNUM_MEM_RELINQUISH U(0x76) +#define FFA_FNUM_MEM_RECLAIM U(0x77) + +/* FFA SMC32 FIDs */ +#define FFA_ERROR FFA_FID(SMC_32, FFA_FNUM_ERROR) +#define FFA_SUCCESS_SMC32 FFA_FID(SMC_32, FFA_FNUM_SUCCESS) +#define FFA_INTERRUPT FFA_FID(SMC_32, FFA_FNUM_INTERRUPT) +#define FFA_VERSION FFA_FID(SMC_32, FFA_FNUM_VERSION) +#define FFA_FEATURES FFA_FID(SMC_32, FFA_FNUM_FEATURES) +#define FFA_RX_RELEASE FFA_FID(SMC_32, FFA_FNUM_RX_RELEASE) +#define FFA_RXTX_MAP_SMC32 FFA_FID(SMC_32, FFA_FNUM_RXTX_MAP) +#define FFA_RXTX_UNMAP FFA_FID(SMC_32, FFA_FNUM_RXTX_UNMAP) +#define FFA_PARTITION_INFO_GET FFA_FID(SMC_32, FFA_FNUM_PARTITION_INFO_GET) +#define FFA_ID_GET FFA_FID(SMC_32, FFA_FNUM_ID_GET) +#define FFA_MSG_POLL FFA_FID(SMC_32, FFA_FNUM_MSG_POLL) +#define FFA_MSG_WAIT FFA_FID(SMC_32, FFA_FNUM_MSG_WAIT) +#define FFA_MSG_YIELD FFA_FID(SMC_32, FFA_FNUM_MSG_YIELD) +#define FFA_MSG_RUN FFA_FID(SMC_32, FFA_FNUM_MSG_RUN) +#define FFA_MSG_SEND FFA_FID(SMC_32, FFA_FNUM_MSG_SEND) +#define FFA_MSG_SEND_DIRECT_REQ_SMC32 \ + FFA_FID(SMC_32, FFA_FNUM_MSG_SEND_DIRECT_REQ) +#define FFA_MSG_SEND_DIRECT_RESP_SMC32 \ + FFA_FID(SMC_32, FFA_FNUM_MSG_SEND_DIRECT_RESP) +#define FFA_MEM_DONATE_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_DONATE) +#define FFA_MEM_LEND_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_LEND) +#define FFA_MEM_SHARE_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_SHARE) +#define FFA_MEM_RETRIEVE_REQ_SMC32 \ + FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_REQ) +#define FFA_MEM_RETRIEVE_RESP FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_RESP) +#define FFA_MEM_RELINQUISH FFA_FID(SMC_32, FFA_FNUM_MEM_RELINQUISH) +#define FFA_MEM_RECLAIM FFA_FID(SMC_32, FFA_FNUM_MEM_RECLAIM) + +/* FFA SMC64 FIDs */ +#define FFA_SUCCESS_SMC64 FFA_FID(SMC_64, FFA_FNUM_SUCCESS) +#define FFA_RXTX_MAP_SMC64 FFA_FID(SMC_64, FFA_FNUM_RXTX_MAP) +#define FFA_MSG_SEND_DIRECT_REQ_SMC64 \ + FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_REQ) +#define FFA_MSG_SEND_DIRECT_RESP_SMC64 \ + FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_RESP) +#define FFA_MEM_DONATE_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_DONATE) +#define FFA_MEM_LEND_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_LEND) +#define FFA_MEM_SHARE_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_SHARE) +#define FFA_MEM_RETRIEVE_REQ_SMC64 \ + FFA_FID(SMC_64, FFA_FNUM_MEM_RETRIEVE_REQ) + +/* + * Reserve a special value for traffic targeted to the Hypervisor or SPM. + */ +#define FFA_TARGET_INFO_MBZ U(0x0) + +/* + * Reserve a special value for MBZ parameters. + */ +#define FFA_PARAM_MBZ U(0x0) + +#endif /* FFA_SVC_H */ diff --git a/include/runtime_services/smccc.h b/include/runtime_services/smccc.h index 34930b6c6..283b4637f 100644 --- a/include/runtime_services/smccc.h +++ b/include/runtime_services/smccc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * Copyright (c) 2018-2020, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -20,6 +20,13 @@ SMCCC_VERSION_MINOR_SHIFT)) #define SMC_UNKNOWN -1 +#define SMC_OK 0 + +/* Return codes for Arm Architecture Service SMC calls */ +#define SMC_ARCH_CALL_SUCCESS 0 +#define SMC_ARCH_CALL_NOT_SUPPORTED -1 +#define SMC_ARCH_CALL_NOT_REQUIRED -2 +#define SMC_ARCH_CALL_INVAL_PARAM -3 /******************************************************************************* * Bit definitions inside the function id as per the SMC calling convention @@ -64,4 +71,10 @@ #define OEN_TOS_END 63 #define OEN_LIMIT 64 +/******************************************************************************* + * Argument definitions passed to SMC call + ******************************************************************************/ +#define SMC_GET_SOC_VERSION 0 +#define SMC_GET_SOC_REVISION 1 + #endif /* __SMCCC_H__ */ diff --git a/include/runtime_services/spci_helpers.h b/include/runtime_services/spci_helpers.h deleted file mode 100644 index cfc3a5ff4..000000000 --- a/include/runtime_services/spci_helpers.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2018-2020, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef SPCI_HELPERS_H -#define SPCI_HELPERS_H - -#include <tftf_lib.h> -#include <utils_def.h> - -/* This error code must be different to the ones used by SPCI */ -#define SPCI_TFTF_ERROR -42 - -#ifndef __ASSEMBLY__ - -#include <stdint.h> - -smc_ret_values spci_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, uint32_t message); -smc_ret_values spci_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id, uint64_t message); -smc_ret_values spci_run(uint32_t dest_id, uint32_t vcpu_id); - -#endif /* __ASSEMBLY__ */ - -#endif /* SPCI_HELPERS_H */ diff --git a/include/runtime_services/spci_svc.h b/include/runtime_services/spci_svc.h deleted file mode 100644 index 926f52a3a..000000000 --- a/include/runtime_services/spci_svc.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2018-2020, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef SPCI_SVC_H -#define SPCI_SVC_H - -#include <lib/utils_def.h> -#include <smccc.h> -#include <uuid.h> - -/* SPCI error codes. */ -#define SPCI_ERROR_NOT_SUPPORTED -1 -#define SPCI_ERROR_INVALID_PARAMETER -2 -#define SPCI_ERROR_NO_MEMORY -3 -#define SPCI_ERROR_BUSY -4 -#define SPCI_ERROR_INTERRUPTED -5 -#define SPCI_ERROR_DENIED -6 -#define SPCI_ERROR_RETRY -7 - -/* The macros below are used to identify SPCI calls from the SMC function ID */ -#define SPCI_FNUM_MIN_VALUE U(0x60) -#define SPCI_FNUM_MAX_VALUE U(0x7f) -#define is_spci_fid(fid) __extension__ ({ \ - __typeof__(fid) _fid = (fid); \ - ((GET_SMC_NUM(_fid) >= SPCI_FNUM_MIN_VALUE) && \ - (GET_SMC_NUM(_fid) <= SPCI_FNUM_MAX_VALUE)); }) - -/* SPCI_VERSION helpers */ -#define SPCI_VERSION_MAJOR U(0) -#define SPCI_VERSION_MAJOR_SHIFT 16 -#define SPCI_VERSION_MAJOR_MASK U(0x7FFF) -#define SPCI_VERSION_MINOR U(9) -#define SPCI_VERSION_MINOR_SHIFT 0 -#define SPCI_VERSION_MINOR_MASK U(0xFFFF) -#define SPCI_VERSION_BIT31_MASK (1 << 31) - -#define MAKE_SPCI_VERSION(major, minor) \ - ((((major) & SPCI_VERSION_MAJOR_MASK) << SPCI_VERSION_MAJOR_SHIFT) | \ - (((minor) & SPCI_VERSION_MINOR_MASK) << SPCI_VERSION_MINOR_SHIFT)) -#define SPCI_VERSION_COMPILED MAKE_SPCI_VERSION(SPCI_VERSION_MAJOR, \ - SPCI_VERSION_MINOR) - -/* SPCI_MSG_SEND helpers */ -#define SPCI_MSG_SEND_ATTRS_BLK_SHIFT U(0) -#define SPCI_MSG_SEND_ATTRS_BLK_MASK U(0x1) -#define SPCI_MSG_SEND_ATTRS_BLK U(0) -#define SPCI_MSG_SEND_ATTRS_BLK_NOT U(1) -#define SPCI_MSG_SEND_ATTRS(blk) \ - (((blk) & SPCI_MSG_SEND_ATTRS_BLK_MASK) \ - << SPCI_MSG_SEND_ATTRS_BLK_SHIFT) - -/* Get SPCI fastcall std FID from function number */ -#define SPCI_FID(smc_cc, func_num) \ - ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \ - ((smc_cc) << FUNCID_CC_SHIFT) | \ - (OEN_STD_START << FUNCID_OEN_SHIFT) | \ - ((func_num) << FUNCID_NUM_SHIFT)) - -/* SPCI function numbers */ -#define SPCI_FNUM_ERROR U(0x60) -#define SPCI_FNUM_SUCCESS U(0x61) -#define SPCI_FNUM_INTERRUPT U(0x62) -#define SPCI_FNUM_VERSION U(0x63) -#define SPCI_FNUM_FEATURES U(0x64) -#define SPCI_FNUM_RX_RELEASE U(0x65) -#define SPCI_FNUM_RXTX_MAP U(0x66) -#define SPCI_FNUM_RXTX_UNMAP U(0x67) -#define SPCI_FNUM_PARTITION_INFO_GET U(0x68) -#define SPCI_FNUM_ID_GET U(0x69) -#define SPCI_FNUM_MSG_POLL U(0x6A) -#define SPCI_FNUM_MSG_WAIT U(0x6B) -#define SPCI_FNUM_MSG_YIELD U(0x6C) -#define SPCI_FNUM_MSG_RUN U(0x6D) -#define SPCI_FNUM_MSG_SEND U(0x6E) -#define SPCI_FNUM_MSG_SEND_DIRECT_REQ U(0x6F) -#define SPCI_FNUM_MSG_SEND_DIRECT_RESP U(0x70) -#define SPCI_FNUM_MEM_DONATE U(0x71) -#define SPCI_FNUM_MEM_LEND U(0x72) -#define SPCI_FNUM_MEM_SHARE U(0x73) -#define SPCI_FNUM_MEM_RETRIEVE_REQ U(0x74) -#define SPCI_FNUM_MEM_RETRIEVE_RESP U(0x75) -#define SPCI_FNUM_MEM_RELINQUISH U(0x76) -#define SPCI_FNUM_MEM_RECLAIM U(0x77) - -/* SPCI SMC32 FIDs */ -#define SPCI_ERROR SPCI_FID(SMC_32, SPCI_FNUM_ERROR) -#define SPCI_SUCCESS_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_SUCCESS) -#define SPCI_INTERRUPT SPCI_FID(SMC_32, SPCI_FNUM_INTERRUPT) -#define SPCI_VERSION SPCI_FID(SMC_32, SPCI_FNUM_VERSION) -#define SPCI_FEATURES SPCI_FID(SMC_32, SPCI_FNUM_FEATURES) -#define SPCI_RX_RELEASE SPCI_FID(SMC_32, SPCI_FNUM_RX_RELEASE) -#define SPCI_RXTX_MAP_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_RXTX_MAP) -#define SPCI_RXTX_UNMAP SPCI_FID(SMC_32, SPCI_FNUM_RXTX_UNMAP) -#define SPCI_PARTITION_INFO_GET SPCI_FID(SMC_32, SPCI_FNUM_PARTITION_INFO_GET) -#define SPCI_ID_GET SPCI_FID(SMC_32, SPCI_FNUM_ID_GET) -#define SPCI_MSG_POLL SPCI_FID(SMC_32, SPCI_FNUM_MSG_POLL) -#define SPCI_MSG_WAIT SPCI_FID(SMC_32, SPCI_FNUM_MSG_WAIT) -#define SPCI_MSG_YIELD SPCI_FID(SMC_32, SPCI_FNUM_MSG_YIELD) -#define SPCI_MSG_RUN SPCI_FID(SMC_32, SPCI_FNUM_MSG_RUN) -#define SPCI_MSG_SEND SPCI_FID(SMC_32, SPCI_FNUM_MSG_SEND) -#define SPCI_MSG_SEND_DIRECT_REQ_SMC32 \ - SPCI_FID(SMC_32, SPCI_FNUM_MSG_SEND_DIRECT_REQ) -#define SPCI_MSG_SEND_DIRECT_RESP_SMC32 \ - SPCI_FID(SMC_32, SPCI_FNUM_MSG_SEND_DIRECT_RESP) -#define SPCI_MEM_DONATE_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_MEM_DONATE) -#define SPCI_MEM_LEND_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_MEM_LEND) -#define SPCI_MEM_SHARE_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_MEM_SHARE) -#define SPCI_MEM_RETRIEVE_REQ_SMC32 \ - SPCI_FID(SMC_32, SPCI_FNUM_MEM_RETRIEVE_REQ) -#define SPCI_MEM_RETRIEVE_RESP SPCI_FID(SMC_32, SPCI_FNUM_MEM_RETRIEVE_RESP) -#define SPCI_MEM_RELINQUISH SPCI_FID(SMC_32, SPCI_FNUM_MEM_RELINQUISH) -#define SPCI_MEM_RECLAIM SPCI_FID(SMC_32, SPCI_FNUM_MEM_RECLAIM) - -/* SPCI SMC64 FIDs */ -#define SPCI_SUCCESS_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_SUCCESS) -#define SPCI_RXTX_MAP_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_RXTX_MAP) -#define SPCI_MSG_SEND_DIRECT_REQ_SMC64 \ - SPCI_FID(SMC_64, SPCI_FNUM_MSG_SEND_DIRECT_REQ) -#define SPCI_MSG_SEND_DIRECT_RESP_SMC64 \ - SPCI_FID(SMC_64, SPCI_FNUM_MSG_SEND_DIRECT_RESP) -#define SPCI_MEM_DONATE_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_MEM_DONATE) -#define SPCI_MEM_LEND_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_MEM_LEND) -#define SPCI_MEM_SHARE_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_MEM_SHARE) -#define SPCI_MEM_RETRIEVE_REQ_SMC64 \ - SPCI_FID(SMC_64, SPCI_FNUM_MEM_RETRIEVE_REQ) - -/* - * Reserve a special value for traffic targeted to the Hypervisor or SPM. - */ -#define SPCI_TARGET_INFO_MBZ U(0x0) - -/* - * Reserve a special value for MBZ parameters. - */ -#define SPCI_PARAM_MBZ U(0x0) - -#endif /* SPCI_SVC_H */ diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk index 73b4690b3..b14665415 100644 --- a/plat/arm/common/arm_common.mk +++ b/plat/arm/common/arm_common.mk @@ -8,6 +8,7 @@ PLAT_INCLUDES += -Iinclude/plat/arm/common/ PLAT_SOURCES += drivers/arm/gic/gic_common.c \ drivers/arm/pl011/${ARCH}/pl011_console.S \ + drivers/console/console.c \ plat/arm/common/arm_setup.c \ plat/arm/common/arm_timers.c diff --git a/plat/hisilicon/hikey960/platform.mk b/plat/hisilicon/hikey960/platform.mk index 4bc1626a2..20b42dff3 100644 --- a/plat/hisilicon/hikey960/platform.mk +++ b/plat/hisilicon/hikey960/platform.mk @@ -17,6 +17,7 @@ PLAT_SOURCES := ${HIKEY960_PATH}/hikey960_setup.c \ drivers/arm/gic/arm_gic_v2.c \ drivers/arm/timer/system_timer.c \ drivers/arm/timer/private_timer.c \ + drivers/console/console.c \ plat/arm/common/arm_timers.c TFTF_CFLAGS += -Wno-maybe-uninitialized diff --git a/readme.rst b/readme.rst index cb2d56405..4fcd4921c 100644 --- a/readme.rst +++ b/readme.rst @@ -1,5 +1,5 @@ -Trusted Firmware-A Tests - version 2.3 -====================================== +Trusted Firmware-A Tests +======================== The Trusted Firmware-A Tests (TF-A-Tests) is a suite of baremetal tests to exercise the `Trusted Firmware-A (TF-A)`_ features from the Normal World. It @@ -31,136 +31,36 @@ They are not reference code. They should not be considered as the official way to test hardware/firmware features. Instead, they are provided as example code to experiment with and improve on. -License -------- +More Info and Documentation +--------------------------- -The software is provided under a BSD-3-Clause `license`_. Contributions to this -project are accepted under the same license with developer sign-off as -described in the `Contributing Guidelines`_. - -This project contains code from other projects as listed below. The original -license text is included in those source files. - -- The libc source code is derived from `FreeBSD`_ and `SCC`_. FreeBSD uses - various BSD licenses, including BSD-3-Clause and BSD-2-Clause. The SCC code - is used under the BSD-3-Clause license with the author's permission. - -- The `LLVM compiler-rt`_ source code is disjunctively dual licensed - (NCSA OR MIT). It is used by this project under the terms of the NCSA - license (also known as the University of Illinois/NCSA Open Source License), - which is a permissive license compatible with BSD-3-Clause. Any - contributions to this code must be made under the terms of both licenses. - -This release ------------- - -This release makes a wide range of tests available for validating the functionality -of TF-A as well as several improvements to test framework and test suite. - -Please refer to the `change log`_ for more details of the features, known issues and -limitations in the current release. - - -Platforms -````````` - -Juno Arm Development Platform -''''''''''''''''''''''''''''' - -The AArch64 build of this release has been tested on variants r0, r1 and r2 of -the `Juno Arm Development Platform`_. The AArch32 build has only been tested on -variant r0. - -Armv8 Architecture Fixed Virtual Platforms -'''''''''''''''''''''''''''''''''''''''''' - -The AArch64 build has been tested on the following Armv8 Architecture Fixed -Virtual Platforms (`FVP`_): - -- ``FVP_Base_AEMv8A-AEMv8A`` -- ``FVP_Base_Cortex-A35x4`` -- ``FVP_Base_Cortex-A57x4-A53x4`` -- ``FVP_Base_RevC-2xAEMv8A`` -- ``Foundation_Platform`` - -The AArch32 build has been tested on the following `FVP`_\ s: - -- ``FVP_Base_Cortex-A32x4`` -- ``FVP_Base_RevC-2xAEMv8A`` - -NOTE: Unless otherwise stated, the model version is version 11.9, build 41. - -System Guidance for Infrastructure Fixed Virtual Platforms -'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -The AArch64 build has been tested on the following Fixed Virtual Platforms -(`FVP`_): - -- ``FVP_CSS_SGI-575`` -- ``FVP_RD_N1Edge`` - -NOTE: - -- For ``FVP_CSS_SGI-575`` and ``FVP_RD_N1Edge``, internal version of the - models were used. - -Still to come -````````````` - -- More tests. -- Support for new platforms. -- Design improvements. -- Stability improvements. -- Enhance test framework to make it easier to implement tests. -- Fixing known issues (see the `change log`_ for more details). - - -Getting started ---------------- - -Get the TF-A Tests source code from `trustedfirmware.org`_. - -See the `User Guide`_ for instructions on how to install, build and use the TF-A -Tests. - -See the `Design Guide`_ for information on how the TF-A Tests internally work. - -See the `Porting Guide`_ for information about how to use this software on -another Armv8-A platform. - -See the `Contributing Guidelines`_ for information on how to contribute to this -project. +To find out more about Trusted Firmware-A Tests, please +`view the full documentation`_ that is available through `trustedfirmware.org`_. -------------- *Copyright (c) 2018-2020, Arm Limited. All rights reserved.* -.. _Contributing Guidelines: contributing.rst -.. _license: license.rst -.. _change log: docs/change-log.rst -.. _Design Guide: docs/design.rst -.. _Porting Guide: docs/porting-guide.rst -.. _User Guide: docs/user-guide.rst -.. _FVP: https://developer.arm.com/products/system-design/fixed-virtual-platforms -.. _Juno Arm Development Platform: https://developer.arm.com/products/system-design/development-boards/juno-development-board - .. _Power State Coordination Interface (PSCI): PSCI_ .. _PSCI: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf + .. _Software Delegated Exception Interface (SDEI): SDEI_ .. _SDEI: http://infocenter.arm.com/help/topic/com.arm.doc.den0054a/ARM_DEN0054A_Software_Delegated_Exception_Interface.pdf -.. _SMC Calling Convention: http://infocenter.arm.com/help/topic/com.arm.doc.den0028b/ARM_DEN0028B_SMC_Calling_Convention.pdf -.. _trustedfirmware.org: https://git.trustedfirmware.org/TF-A/tf-a-tests.git +.. _SMC Calling Convention: https://developer.arm.com/docs/den0028/latest .. _Trusted Firmware-A (TF-A): TF-A_ -.. _TF-A: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about +.. _TF-A: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git + .. _Test Secure Payload (TSP): TSP_ -.. _TSP: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/bl32/tsp +.. _TSP: https://trustedfirmware-a.readthedocs.io/en/latest/perf/tsp.html + .. _Performance Measurement Framework (PMF): PMF_ -.. _PMF: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/firmware-design.rst#performance-measurement-framework -.. _Firmware update: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/firmware-update.rst -.. _EL3 payload: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/user-guide.rst#el3-payloads-alternative-boot-flow -.. _Secure partition: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/secure-partition-manager-design.rst +.. _PMF: https://trustedfirmware-a.readthedocs.io/en/latest/design/firmware-design.html#performance-measurement-framework + +.. _Firmware update: https://trustedfirmware-a.readthedocs.io/en/latest/components/firmware-update.html +.. _EL3 payload: https://trustedfirmware-a.readthedocs.io/en/latest/design/alt-boot-flows.html#el3-payloads-alternative-boot-flow +.. _Secure partition: https://trustedfirmware-a.readthedocs.io/en/latest/components/secure-partition-manager-design.html -.. _issue tracker: https://developer.trustedfirmware.org/project/board/9/ -.. _mailing list: https://lists.trustedfirmware.org/mailman/listinfo/tf-a-tests +.. _view the full documentation: https://trustedfirmware-a-tests.readthedocs.io/ +.. _trustedfirmware.org: http://www.trustedfirmware.org diff --git a/spm/README.txt b/spm/README.txt index 0a25d6b7a..cb2263653 100644 --- a/spm/README.txt +++ b/spm/README.txt @@ -1,4 +1,4 @@ -This is a prototype loosely based on the SPCI Beta1 specification. +This is a prototype loosely based on the PSA FF-A v1.0 specification. Any interface / platform API introduced for this is subject to change as it evolves. diff --git a/spm/cactus/cactus-secondary.dts b/spm/cactus/cactus-secondary.dts index 041cd317a..8a140a971 100644 --- a/spm/cactus/cactus-secondary.dts +++ b/spm/cactus/cactus-secondary.dts @@ -11,11 +11,11 @@ /dts-v1/; / { - compatible = "arm,spci-manifest-1.0"; + compatible = "arm,ffa-manifest-1.0"; /* Properties */ description = "Base-1"; - spci-version = <0x00000009>; /* 31:16 - Major, 15:0 - Minor */ + ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */ uuid = <0xd1582309 0xf02347b9 0x827c4464 0xf5578fc8>; id = <2>; auxiliary-id = <0xae>; @@ -34,29 +34,45 @@ gp-register-num = <0x0>; rx_tx-info { - compatible = "arm,spci-manifest-rx_tx-buffer"; - - description = "NS RX/TX Buffer"; - pages-count = <1>; - attributes = <0x0>; - base-address = <0x7200000>; + compatible = "arm,ffa-manifest-rx_tx-buffer"; + rx-buffer = <&rxbuffer>; + tx-buffer = <&txbuffer>; }; memory-regions { - compatible = "arm,spci-manifest-memory-regions"; + compatible = "arm,ffa-manifest-memory-regions"; + + rxbuffer: rx-buffer { + description = "rx-buffer"; + pages-count = <1>; + base-address = <0x00000000 0x7202000>; + attributes = <0x1>; /* read-only */ + }; + + txbuffer: tx-buffer { + description = "tx-buffer"; + pages-count = <1>; + base-address = <0x00000000 0x7203000>; + attributes = <0x3>; /* read-write */ + }; + + /* Without optional base-address */ test-memory { - description = "Test Memory"; - pages-count = <32>; /* 128KiB with 4KiB pages */ - base-address = <0x00000000 0x21000000>; - attributes = <0x0>; + description = "test-memory"; + pages-count = <4>; + attributes = <0x7>; /* read-write-execute */ }; }; device-regions { - compatible = "arm,spci-manifest-device-regions"; - attributes = <0x0>; + compatible = "arm,ffa-manifest-device-regions"; + test-reg { - reg = <0x10000008 0x00000001 1>; /* Arbitrary test address */ + /* Dummy values */ + base-address = <0x00000000 0x24000000>; + pages-count = <16>; + attributes = <0x3>; /* read-write */ + reg = <0x10000008 0x00000001 1>; smmu-id = <1>; stream-ids = <0x0 0x1>; interrupts = <0x2 0x3>, diff --git a/spm/cactus/cactus.dts b/spm/cactus/cactus.dts index 78cbb56ce..2e30db4ad 100644 --- a/spm/cactus/cactus.dts +++ b/spm/cactus/cactus.dts @@ -11,11 +11,11 @@ /dts-v1/; / { - compatible = "arm,spci-manifest-1.0"; + compatible = "arm,ffa-manifest-1.0"; /* Properties */ description = "Base-1"; - spci-version = <0x00000009>; /* 31:16 - Major, 15:0 - Minor */ + ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */ uuid = <0xb4b5671e 0x4a904fe1 0xb81ffb13 0xdae1dacb>; id = <1>; auxiliary-id = <0xae>; @@ -34,33 +34,50 @@ gp-register-num = <0x0>; rx_tx-info { - compatible = "arm,spci-manifest-rx_tx-buffer"; - - description = "NS RX/TX Buffer"; - pages-count = <1>; - attributes = <0x0>; - base-address = <0x7200000>; + compatible = "arm,ffa-manifest-rx_tx-buffer"; + rx-buffer = <&rxbuffer>; + tx-buffer = <&txbuffer>; }; memory-regions { - compatible = "arm,spci-manifest-memory-regions"; + compatible = "arm,ffa-manifest-memory-regions"; + + rxbuffer: rx-buffer { + description = "rx-buffer"; + pages-count = <1>; + base-address = <0x00000000 0x7200000>; + attributes = <0x1>; /* read-only */ + }; + + txbuffer: tx-buffer { + description = "tx-buffer"; + pages-count = <1>; + base-address = <0x00000000 0x7201000>; + attributes = <0x3>; /* read-write */ + }; + + /* Without optional base-address */ test-memory { - description = "Test Memory"; - pages-count = <32>; /* 128KiB with 4KiB pages */ - base-address = <0x00000000 0x21000000>; - attributes = <0x0>; + description = "test-memory"; + pages-count = <4>; + attributes = <0x7>; /* read-write-execute */ }; }; device-regions { - compatible = "arm,spci-manifest-device-regions"; - attributes = <0x0>; + compatible = "arm,ffa-manifest-device-regions"; + test-reg { - reg = <0x10000008 0x00000001 1>; /* Arbitrary test address */ + /* Dummy Values */ + base-address = <0x00000000 0x22000000>; + pages-count = <64>; + attributes = <0x3>; /* read-write */ + reg = <0x10000008 0x00000001 1>; smmu-id = <1>; stream-ids = <0x0 0x1>; interrupts = <0x2 0x3>, <0x4 0x5>; + exclusive-access; }; }; diff --git a/spm/cactus/cactus.h b/spm/cactus/cactus.h index 0b06eb2e7..cbf2dcb24 100644 --- a/spm/cactus/cactus.h +++ b/spm/cactus/cactus.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited. All rights reserved. + * Copyright (c) 2017-2020, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -26,4 +26,11 @@ extern uintptr_t __BSS_START__, __BSS_END__; #define CACTUS_BSS_START ((uintptr_t)&__BSS_START__) #define CACTUS_BSS_END ((uintptr_t)&__BSS_END__) +enum stdout_route { + PL011_AS_STDOUT = 0, + HVC_CALL_AS_STDOUT, +}; + +void set_putc_impl(enum stdout_route); + #endif /* __CACTUS_H__ */ diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk index c0b98f400..a32d3d38a 100644 --- a/spm/cactus/cactus.mk +++ b/spm/cactus/cactus.mk @@ -4,7 +4,6 @@ # SPDX-License-Identifier: BSD-3-Clause # -include lib/sprt/sprt_client.mk include lib/xlat_tables_v2/xlat_tables.mk CACTUS_DTB := $(BUILD_PLAT)/cactus.dtb @@ -16,22 +15,17 @@ CACTUS_INCLUDES := \ -Iinclude/common/${ARCH} \ -Iinclude/lib \ -Iinclude/lib/${ARCH} \ - -Iinclude/lib/sprt \ -Iinclude/lib/utils \ -Iinclude/lib/xlat_tables \ -Iinclude/runtime_services \ - -Iinclude/runtime_services/secure_el0_payloads \ -Ispm/cactus \ -Ispm/common \ - ${SPRT_LIB_INCLUDES} CACTUS_SOURCES := \ $(addprefix spm/cactus/, \ aarch64/cactus_entrypoint.S \ + cactus_debug.c \ cactus_main.c \ - cactus_tests_memory_attributes.c \ - cactus_tests_misc.c \ - cactus_tests_system_setup.c \ ) \ $(addprefix spm/common/, \ aarch64/sp_arch_helpers.S \ @@ -51,7 +45,6 @@ CACTUS_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \ lib/smc/${ARCH}/hvc.c \ lib/locks/${ARCH}/spinlock.S \ lib/utils/mp_printf.c \ - ${SPRT_LIB_SOURCES} \ ${XLAT_TABLES_LIB_SRCS} CACTUS_LINKERFILE := spm/cactus/cactus.ld.S diff --git a/spm/cactus/cactus_debug.c b/spm/cactus/cactus_debug.c new file mode 100644 index 000000000..91fbfda97 --- /dev/null +++ b/spm/cactus/cactus_debug.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <drivers/arm/pl011.h> +#include <drivers/console.h> + +#include "cactus.h" +#include "ffa_helpers.h" + +static int (*putc_impl)(int); + +static int putc_hypcall(int c) +{ + spm_debug_log((char)c); + + return c; +} + +static int putc_uart(int c) +{ + console_pl011_putc(c); + + return c; +} + +void set_putc_impl(enum stdout_route route) +{ + switch (route) { + + case HVC_CALL_AS_STDOUT: + putc_impl = putc_hypcall; + return; + + case PL011_AS_STDOUT: + default: + break; + } + + putc_impl = putc_uart; +} + +int console_putc(int c) +{ + if (!putc_impl) { + return -1; + } + + return putc_impl(c); +} diff --git a/spm/cactus/cactus_def.h b/spm/cactus/cactus_def.h index e865036d8..a0adb2343 100644 --- a/spm/cactus/cactus_def.h +++ b/spm/cactus/cactus_def.h @@ -20,41 +20,12 @@ /* Memory reserved for stacks */ #define CACTUS_STACKS_SIZE ULL(0x1000) -/* Memory shared between EL3 and S-EL0 (64 KiB). */ -#define CACTUS_SPM_BUF_BASE (CACTUS_IMAGE_BASE + CACTUS_IMAGE_SIZE) -#define CACTUS_SPM_BUF_SIZE ULL(0x10000) - -/* Memory shared between Normal world and S-EL0 (64 KiB). */ -#define CACTUS_NS_BUF_BASE (CACTUS_SPM_BUF_BASE + CACTUS_SPM_BUF_SIZE) -#define CACTUS_NS_BUF_SIZE ULL(0x10000) - -/* Memory area used by tests (128 KiB). */ -#define CACTUS_TEST_MEM_BASE (CACTUS_NS_BUF_BASE + CACTUS_NS_BUF_SIZE) -#define CACTUS_TEST_MEM_SIZE ULL(0x20000) - -/* - * UUIDs of Secure Services provided by Cactus - */ - -#define CACTUS_SERVICE1_UUID U(0x01234567), U(0x89ABCDEF), U(0x76543210), U(0xFEDCBA98) -#define CACTUS_SERVICE2_UUID U(0x0A1B2C3D), U(0x4E5F6789), U(0x55AA00FF), U(0x0F1E2D3C) -#define CACTUS_INVALID_UUID U(0x1), U(0x2), U(0x3), U(0x4) - -#define CACTUS_SERVICE1_UUID_RD U(0x01234567) U(0x89ABCDEF) U(0x76543210) U(0xFEDCBA98) -#define CACTUS_SERVICE2_UUID_RD U(0x0A1B2C3D) U(0x4E5F6789) U(0x55AA00FF) U(0x0F1E2D3C) -#define CACTUS_INVALID_UUID_RD U(0x1) U(0x2) U(0x3) U(0x4) - /* - * Service IDs + * RX/TX buffer used by VM's in SPM for memory sharing + * Each VM allocated 2 pages, one for RX and one for TX buffer. */ - -/* Print a magic number unique to Cactus and return */ -#define CACTUS_PRINT_MAGIC U(1) -/* Return a magic number unique to Cactus */ -#define CACTUS_GET_MAGIC U(2) -/* Sleep for a number of milliseconds */ -#define CACTUS_SLEEP_MS U(3) - -#define CACTUS_MAGIC_NUMBER U(0x12481369) +#define CACTUS_RX_BASE ULL(0x7200000) +#define CACTUS_TX_BASE CACTUS_RX_BASE + PAGE_SIZE +#define CACTUS_RX_TX_SIZE PAGE_SIZE * 2 #endif /* CACTUS_DEF_H */ diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c index c2c8ec295..d5d923d16 100644 --- a/spm/cactus/cactus_main.c +++ b/spm/cactus/cactus_main.c @@ -5,7 +5,6 @@ */ #include <assert.h> -#include <cactus_def.h> #include <debug.h> #include <drivers/arm/pl011.h> #include <drivers/console.h> @@ -16,112 +15,16 @@ #include <plat_arm.h> #include <plat/common/platform.h> #include <platform_def.h> -#include <sp_helpers.h> -#include <spci_svc.h> #include <std_svc.h> #include "cactus.h" #include "cactus_def.h" -#include "cactus_tests.h" - -#include "tftf_lib.h" - -#define SPM_VM_ID_FIRST (1) - -#define SPM_VM_GET_COUNT (0xFF01) -#define SPM_VCPU_GET_COUNT (0xFF02) -#define SPM_DEBUG_LOG (0xBD000000) - -/* Hypervisor ID at physical SPCI instance */ -#define HYP_ID (0) - -/* By convention, SP IDs (as opposed to VM IDs) have bit 15 set */ -#define SP_ID(x) (x | (1 << 15)) - -typedef unsigned short spci_vm_id_t; -typedef unsigned short spci_vm_count_t; -typedef unsigned short spci_vcpu_count_t; +#include "ffa_helpers.h" /* Host machine information injected by the build system in the ELF file. */ extern const char build_message[]; extern const char version_string[]; -static spci_vcpu_count_t spm_vcpu_get_count(spci_vm_id_t vm_id) -{ - hvc_args args = { - .fid = SPM_VCPU_GET_COUNT, - .arg1 = vm_id - }; - - hvc_ret_values ret = tftf_hvc(&args); - - return ret.ret0; -} - -static spci_vm_count_t spm_vm_get_count(void) -{ - hvc_args args = { - .fid = SPM_VM_GET_COUNT - }; - - hvc_ret_values ret = tftf_hvc(&args); - - return ret.ret0; -} - -static void spm_debug_log(char c) -{ - hvc_args args = { - .fid = SPM_DEBUG_LOG, - .arg1 = c - }; - - (void)tftf_hvc(&args); -} - -static smc_ret_values spci_id_get(void) -{ - smc_args args = { - .fid = SPCI_ID_GET - }; - - return tftf_smc(&args); -} - -static smc_ret_values spci_msg_wait(void) -{ - smc_args args = { - .fid = SPCI_MSG_WAIT - }; - - return tftf_smc(&args); -} - -/* Send response through registers using direct messaging */ -static smc_ret_values spci_msg_send_direct_resp(spci_vm_id_t sender_vm_id, - spci_vm_id_t target_vm_id, - uint32_t message) -{ - smc_args args = { - .fid = SPCI_MSG_SEND_DIRECT_RESP_SMC32, - .arg1 = ((uint32_t)sender_vm_id << 16) | target_vm_id, - .arg3 = message - }; - - return tftf_smc(&args); -} - -static smc_ret_values spci_error(int32_t error_code) -{ - smc_args args = { - .fid = SPCI_ERROR, - .arg1 = 0, - .arg2 = error_code - }; - - return tftf_smc(&args); -} - /* * * Message loop function @@ -130,9 +33,9 @@ static smc_ret_values spci_error(int32_t error_code) * but rather through Hafnium print hypercall. * */ -static void __dead2 message_loop(spci_vm_id_t vm_id) +static void __dead2 message_loop(ffa_vm_id_t vm_id) { - smc_ret_values spci_ret; + smc_ret_values ffa_ret; uint32_t sp_response; /* @@ -140,22 +43,22 @@ static void __dead2 message_loop(spci_vm_id_t vm_id) * SP initialization has completed. It blocks until receiving * a direct message request. */ - spci_ret = spci_msg_wait(); + ffa_ret = ffa_msg_wait(); for (;;) { - if (spci_ret.ret0 != SPCI_MSG_SEND_DIRECT_REQ_SMC32) { - spci_ret = spci_error(-1); + if (ffa_ret.ret0 != FFA_MSG_SEND_DIRECT_REQ_SMC32) { + ffa_ret = ffa_error(-1); continue; } - if (spci_ret.ret1 != SP_ID(vm_id)) { - spci_ret = spci_error(-2); + if (ffa_ret.ret1 != SP_ID(vm_id)) { + ffa_ret = ffa_error(-2); continue; } - if (spci_ret.ret2 != HYP_ID) { - spci_ret = spci_error(-3); + if (ffa_ret.ret2 != HYP_ID) { + ffa_ret = ffa_error(-3); continue; } @@ -163,13 +66,13 @@ static void __dead2 message_loop(spci_vm_id_t vm_id) * For the sake of testing, add the vm id to the * received message. */ - sp_response = spci_ret.ret3 | vm_id; + sp_response = ffa_ret.ret3 | vm_id; /* * Send a response through direct messaging then block * until receiving a new message request. */ - spci_ret = spci_msg_send_direct_resp(SP_ID(vm_id), + ffa_ret = ffa_msg_send_direct_resp(SP_ID(vm_id), HYP_ID, sp_response); } } @@ -180,36 +83,32 @@ static const mmap_region_t cactus_mmap[] __attribute__((used)) = { {0} }; -static void cactus_print_memory_layout(void) +static void cactus_print_memory_layout(unsigned int vm_id) { NOTICE("Secure Partition memory layout:\n"); - NOTICE(" Image regions\n"); - NOTICE(" Text region : %p - %p\n", + NOTICE(" Text region : %p - %p\n", (void *)CACTUS_TEXT_START, (void *)CACTUS_TEXT_END); - NOTICE(" Read-only data region : %p - %p\n", + + NOTICE(" Read-only data region : %p - %p\n", (void *)CACTUS_RODATA_START, (void *)CACTUS_RODATA_END); - NOTICE(" Data region : %p - %p\n", + + NOTICE(" Data region : %p - %p\n", (void *)CACTUS_DATA_START, (void *)CACTUS_DATA_END); - NOTICE(" BSS region : %p - %p\n", + + NOTICE(" BSS region : %p - %p\n", (void *)CACTUS_BSS_START, (void *)CACTUS_BSS_END); - NOTICE(" Total image memory : %p - %p\n", - (void *)CACTUS_IMAGE_BASE, - (void *)(CACTUS_IMAGE_BASE + CACTUS_IMAGE_SIZE)); - NOTICE(" SPM regions\n"); - NOTICE(" SPM <-> SP buffer : %p - %p\n", - (void *)CACTUS_SPM_BUF_BASE, - (void *)(CACTUS_SPM_BUF_BASE + CACTUS_SPM_BUF_SIZE)); - NOTICE(" NS <-> SP buffer : %p - %p\n", - (void *)CACTUS_NS_BUF_BASE, - (void *)(CACTUS_NS_BUF_BASE + CACTUS_NS_BUF_SIZE)); - NOTICE(" Test regions\n"); - NOTICE(" Test region : %p - %p\n", - (void *)CACTUS_TEST_MEM_BASE, - (void *)(CACTUS_TEST_MEM_BASE + CACTUS_TEST_MEM_SIZE)); + + NOTICE(" RX : %p - %p\n", + (void *)(CACTUS_RX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)), + (void *)(CACTUS_TX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE))); + + NOTICE(" TX : %p - %p\n", + (void *)(CACTUS_TX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)), + (void *)(CACTUS_RX_BASE + (vm_id * CACTUS_RX_TX_SIZE))); } -static void cactus_plat_configure_mmu(void) +static void cactus_plat_configure_mmu(unsigned int vm_id) { mmap_add_region(CACTUS_TEXT_START, CACTUS_TEXT_START, @@ -228,6 +127,16 @@ static void cactus_plat_configure_mmu(void) CACTUS_BSS_END - CACTUS_BSS_START, MT_RW_DATA); + mmap_add_region((CACTUS_RX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)), + (CACTUS_RX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)), + (CACTUS_RX_TX_SIZE / 2), + MT_RO_DATA); + + mmap_add_region((CACTUS_TX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)), + (CACTUS_TX_BASE + ((vm_id - 1) * CACTUS_RX_TX_SIZE)), + (CACTUS_RX_TX_SIZE / 2), + MT_RW_DATA); + mmap_add(cactus_mmap); init_xlat_tables(); } @@ -240,50 +149,46 @@ void __dead2 cactus_main(void) memset((void *)CACTUS_BSS_START, 0, CACTUS_BSS_END - CACTUS_BSS_START); - /* Configure and enable Stage-1 MMU, enable D-Cache */ - cactus_plat_configure_mmu(); - enable_mmu_el1(0); - - /* Get current SPCI id */ - smc_ret_values spci_id_ret = spci_id_get(); - if (spci_id_ret.ret0 != SPCI_SUCCESS_SMC32) { - ERROR("SPCI_ID_GET failed.\n"); + /* Get current FFA id */ + smc_ret_values ffa_id_ret = ffa_id_get(); + if (ffa_id_ret.ret0 != FFA_SUCCESS_SMC32) { + ERROR("FFA_ID_GET failed.\n"); panic(); } - spci_vm_id_t spci_id = spci_id_ret.ret2 & 0xffff; - if (spci_id > SPM_VM_ID_FIRST) { - /* Indicate secondary VM start through debug log hypercall */ - spm_debug_log('2'); - spm_debug_log('N'); - spm_debug_log('D'); - spm_debug_log('\n'); + ffa_vm_id_t ffa_id = ffa_id_ret.ret2 & 0xffff; - /* Run straight to the message loop */ - message_loop(spci_id); - } + /* Configure and enable Stage-1 MMU, enable D-Cache */ + cactus_plat_configure_mmu(ffa_id); + enable_mmu_el1(0); - /* Next initialization steps only performed by primary VM */ + if (ffa_id == SPM_VM_ID_FIRST) { + console_init(PL011_UART2_BASE, + PL011_UART2_CLK_IN_HZ, + PL011_BAUDRATE); - console_init(PL011_UART2_BASE, - PL011_UART2_CLK_IN_HZ, - PL011_BAUDRATE); + set_putc_impl(PL011_AS_STDOUT); - NOTICE("Booting Cactus Secure Partition\n%s\n%s\n", - build_message, version_string); + NOTICE("Booting Primary Cactus Secure Partition\n%s\n%s\n", + build_message, version_string); - cactus_print_memory_layout(); + /* Get number of VMs */ + NOTICE("VM count: %u\n", spm_vm_get_count()); - NOTICE("SPCI id: %u\n", spci_id); /* Expect VM id 1 */ + /* Get virtual CPU count for current VM */ + NOTICE("vCPU count: %u\n", spm_vcpu_get_count(ffa_id)); + } else { + set_putc_impl(HVC_CALL_AS_STDOUT); - /* Get number of VMs */ - NOTICE("VM count: %u\n", spm_vm_get_count()); + NOTICE("Booting Secondary Cactus Secure Partition\n%s\n%s\n", + build_message, version_string); + } - /* Get virtual CPU count for current VM */ - NOTICE("vCPU count: %u\n", spm_vcpu_get_count(spci_id)); + NOTICE("FFA id: %u\n", ffa_id); + cactus_print_memory_layout(ffa_id); /* End up to message loop */ - message_loop(spci_id); + message_loop(ffa_id); /* Not reached */ } diff --git a/spm/cactus/ffa_helpers.h b/spm/cactus/ffa_helpers.h new file mode 100644 index 000000000..8f6beb446 --- /dev/null +++ b/spm/cactus/ffa_helpers.h @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2020, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __FFA_HELPERS_H__ +#define __FFA_HELPERS_H__ + + +#include <ffa_svc.h> +#include "tftf_lib.h" + +#define SPM_VM_ID_FIRST (1) + +#define SPM_VM_GET_COUNT (0xFF01) +#define SPM_VCPU_GET_COUNT (0xFF02) +#define SPM_DEBUG_LOG (0xBD000000) + +/* Hypervisor ID at physical FFA instance */ +#define HYP_ID (0) + +/* By convention, SP IDs (as opposed to VM IDs) have bit 15 set */ +#define SP_ID(x) ((x) | (1 << 15)) + +typedef unsigned short ffa_vm_id_t; +typedef unsigned short ffa_vm_count_t; +typedef unsigned short ffa_vcpu_count_t; + +/* Functions */ + +static inline ffa_vcpu_count_t spm_vcpu_get_count(ffa_vm_id_t vm_id) +{ + hvc_args args = { + .fid = SPM_VCPU_GET_COUNT, + .arg1 = vm_id + }; + + hvc_ret_values ret = tftf_hvc(&args); + + return ret.ret0; +} + +static inline ffa_vm_count_t spm_vm_get_count(void) +{ + hvc_args args = { + .fid = SPM_VM_GET_COUNT + }; + + hvc_ret_values ret = tftf_hvc(&args); + + return ret.ret0; +} + +static inline void spm_debug_log(char c) +{ + hvc_args args = { + .fid = SPM_DEBUG_LOG, + .arg1 = c + }; + + (void)tftf_hvc(&args); +} + +static inline smc_ret_values ffa_id_get(void) +{ + smc_args args = { + .fid = FFA_ID_GET + }; + + return tftf_smc(&args); +} + +static inline smc_ret_values ffa_msg_wait(void) +{ + smc_args args = { + .fid = FFA_MSG_WAIT + }; + + return tftf_smc(&args); +} + +/* Send response through registers using direct messaging */ +static inline smc_ret_values ffa_msg_send_direct_resp(ffa_vm_id_t sender_vm_id, + ffa_vm_id_t target_vm_id, + uint32_t message) +{ + smc_args args = { + .fid = FFA_MSG_SEND_DIRECT_RESP_SMC32, + .arg1 = ((uint32_t)sender_vm_id << 16) | target_vm_id, + .arg3 = message + }; + + return tftf_smc(&args); +} + +static inline smc_ret_values ffa_error(int32_t error_code) +{ + smc_args args = { + .fid = FFA_ERROR, + .arg1 = 0, + .arg2 = error_code + }; + + return tftf_smc(&args); +} + +#endif /* __FFA_HELPERS_H__ */ diff --git a/spm/cactus_mm/cactus_mm.mk b/spm/cactus_mm/cactus_mm.mk index c76890d65..b96580c03 100644 --- a/spm/cactus_mm/cactus_mm.mk +++ b/spm/cactus_mm/cactus_mm.mk @@ -39,6 +39,7 @@ CACTUS_MM_SOURCES += \ CACTUS_MM_SOURCES += \ drivers/arm/pl011/${ARCH}/pl011_console.S \ + drivers/console/console.c \ lib/${ARCH}/cache_helpers.S \ lib/${ARCH}/misc_helpers.S \ diff --git a/spm/ivy/ivy.mk b/spm/ivy/ivy.mk index 16f62add5..8d5475ab7 100644 --- a/spm/ivy/ivy.mk +++ b/spm/ivy/ivy.mk @@ -39,6 +39,7 @@ IVY_SOURCES += \ tftf/framework/${ARCH}/asm_debug.S IVY_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \ + drivers/console/console.c \ lib/${ARCH}/cache_helpers.S \ lib/${ARCH}/misc_helpers.S \ lib/locks/${ARCH}/spinlock.S \ diff --git a/tftf/tests/extensions/ecv/test_ecv.c b/tftf/tests/extensions/ecv/test_ecv.c new file mode 100644 index 000000000..463353b6e --- /dev/null +++ b/tftf/tests/extensions/ecv/test_ecv.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2020, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <test_helpers.h> +#include <tftf.h> +#include <tftf_lib.h> +#include <string.h> + +/* + * TF-A is expected to allow access to CNTPOFF_EL2 register from EL2. + * Reading this register will trap to EL3 and crash when TF-A has not + * allowed access. + */ +test_result_t test_ecv_enabled(void) +{ + SKIP_TEST_IF_AARCH32(); + +#ifdef __aarch64__ + SKIP_TEST_IF_ECV_NOT_SELF_SYNC(); + read_cntpoff_el2(); + + return TEST_RESULT_SUCCESS; +#endif /* __aarch64__ */ +} diff --git a/tftf/tests/extensions/fgt/test_fgt.c b/tftf/tests/extensions/fgt/test_fgt.c new file mode 100644 index 000000000..6213d4bf5 --- /dev/null +++ b/tftf/tests/extensions/fgt/test_fgt.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <test_helpers.h> +#include <tftf_lib.h> +#include <tftf.h> +#include <string.h> +#include <arch_helpers.h> + +/* + * TF-A is expected to allow access to ARMv8.6-FGT system registers from EL2. + * Reading these registers causes a trap to EL3 and crash when TF-A has not + * allowed access. + */ +test_result_t test_fgt_enabled(void) +{ + SKIP_TEST_IF_AARCH32(); + +#ifdef __aarch64__ + SKIP_TEST_IF_FGT_NOT_SUPPORTED(); + read_hfgrtr_el2(); + read_hfgwtr_el2(); + read_hfgitr_el2(); + read_hdfgrtr_el2(); + read_hdfgwtr_el2(); + + return TEST_RESULT_SUCCESS; +#endif /* __aarch64__ */ +} diff --git a/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_soc_id.c b/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_soc_id.c new file mode 100644 index 000000000..b866450de --- /dev/null +++ b/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_soc_id.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2020, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <arch_helpers.h> +#include <arm_arch_svc.h> +#include <debug.h> +#include <smccc.h> +#include <string.h> +#include <tftf_lib.h> + +/* + * Return SOC ID parameters(SOC revision/SOC version) according + * to argument passed + */ +static smc_ret_values get_soc_id_param(u_register_t arg) +{ + smc_args args; + smc_ret_values ret; + + memset(&args, 0, sizeof(args)); + args.fid = SMCCC_ARCH_SOC_ID; + args.arg1 = arg; + ret = tftf_smc(&args); + + return ret; +} + +/* Entry function to execute SMCCC_ARCH_SOC_ID test */ +test_result_t test_smccc_arch_soc_id(void) +{ + smc_args args; + smc_ret_values ret; + int32_t expected_ver; + int32_t skip_cnt = 0; + bool fail_soc_id_test = false; + + /* Check if SMCCC version is at least v1.2 */ + expected_ver = MAKE_SMCCC_VERSION(1, 2); + memset(&args, 0, sizeof(args)); + args.fid = SMCCC_VERSION; + ret = tftf_smc(&args); + if ((int32_t)ret.ret0 < expected_ver) { + tftf_testcase_printf("Unexpected SMCCC version: 0x%x\n", + (int)ret.ret0); + return TEST_RESULT_SKIPPED; + } + + /* Check if SMCCC_ARCH_SOC_ID is implemented or not */ + memset(&args, 0, sizeof(args)); + args.fid = SMCCC_ARCH_FEATURES; + args.arg1 = SMCCC_ARCH_SOC_ID; + ret = tftf_smc(&args); + if ((int)ret.ret0 == SMC_ARCH_CALL_NOT_SUPPORTED) { + tftf_testcase_printf("SMCCC_ARCH_SOC_ID is not implemented\n"); + return TEST_RESULT_FAIL; + } + + /* If the call returns SMC_OK then SMCCC_ARCH_SOC_ID is feature available */ + if ((int)ret.ret0 == SMC_OK) { + ret = get_soc_id_param(SMC_GET_SOC_REVISION); + + if ((int)ret.ret0 == SMC_ARCH_CALL_INVAL_PARAM) { + ERROR("Invalid param passed to SMCCC_ARCH_SOC_ID\n"); + fail_soc_id_test = true; + } else if ((int)ret.ret0 == SMC_ARCH_CALL_NOT_SUPPORTED) { + tftf_testcase_printf("SOC Rev is not implemented\n"); + skip_cnt++; + } else { + tftf_testcase_printf("SOC Rev = 0x%x\n", (int)ret.ret0); + } + + ret = get_soc_id_param(SMC_GET_SOC_VERSION); + + if ((int)ret.ret0 == SMC_ARCH_CALL_INVAL_PARAM) { + ERROR("Invalid param passed to SMCCC_ARCH_SOC_ID\n"); + fail_soc_id_test = true; + } else if ((int)ret.ret0 == SMC_ARCH_CALL_NOT_SUPPORTED) { + tftf_testcase_printf("SOC Ver is not implemented\n"); + skip_cnt++; + } else { + tftf_testcase_printf("SOC Ver = 0x%x\n", (int)ret.ret0); + } + + if (skip_cnt == 2) + return TEST_RESULT_SKIPPED; + else if (fail_soc_id_test) + return TEST_RESULT_FAIL; + } else { + ERROR("Invalid error during SMCCC_ARCH_FEATURES call = 0x%x\n", + (int)ret.ret0); + return TEST_RESULT_FAIL; + } + + return TEST_RESULT_SUCCESS; +} diff --git a/tftf/tests/runtime_services/secure_service/spci_helpers.c b/tftf/tests/runtime_services/secure_service/ffa_helpers.c index 1370a3877..9d19fec2e 100644 --- a/tftf/tests/runtime_services/secure_service/spci_helpers.c +++ b/tftf/tests/runtime_services/secure_service/ffa_helpers.c @@ -6,11 +6,11 @@ #include <debug.h> #include <smccc.h> -#include <spci_helpers.h> -#include <spci_svc.h> +#include <ffa_helpers.h> +#include <ffa_svc.h> /*----------------------------------------------------------------------------- - * SPCI_RUN + * FFA_RUN * * Parameters * uint32 Function ID (w0): 0x8400006D @@ -19,17 +19,17 @@ * -Bits[15:0]: ID of vCPU of SP/VM to run. * Other Parameter registers w2-w7/x2-x7: Reserved (MBZ) * - * On failure, returns SPCI_ERROR in w0 and error code in w2: + * On failure, returns FFA_ERROR in w0 and error code in w2: * -INVALID_PARAMETERS: Unrecognized endpoint or vCPU ID - * -NOT_SUPPORTED: This function is not implemented at this SPCI instance + * -NOT_SUPPORTED: This function is not implemented at this FFA instance * -DENIED: Callee is not in a state to handle this request * -BUSY: vCPU is busy and caller must retry later * -ABORTED: vCPU or VM ran into an unexpected error and has aborted */ -smc_ret_values spci_run(uint32_t dest_id, uint32_t vcpu_id) +smc_ret_values ffa_run(uint32_t dest_id, uint32_t vcpu_id) { smc_args args = { - SPCI_MSG_RUN, + FFA_MSG_RUN, (dest_id << 16) | vcpu_id, 0, 0, 0, 0, 0, 0 }; @@ -38,7 +38,7 @@ smc_ret_values spci_run(uint32_t dest_id, uint32_t vcpu_id) } /*----------------------------------------------------------------------------- - * SPCI_MSG_SEND_DIRECT_REQ + * FFA_MSG_SEND_DIRECT_REQ * * Parameters * uint32 Function ID (w0): 0x8400006F / 0xC400006F @@ -48,14 +48,14 @@ smc_ret_values spci_run(uint32_t dest_id, uint32_t vcpu_id) * uint32/uint64 (w2/x2) - RFU MBZ * w3-w7 - Implementation defined * - * On failure, returns SPCI_ERROR in w0 and error code in w2: + * On failure, returns FFA_ERROR in w0 and error code in w2: * -INVALID_PARAMETERS: Invalid endpoint ID or non-zero reserved register * -DENIED: Callee is not in a state to handle this request - * -NOT_SUPPORTED: This function is not implemented at this SPCI instance + * -NOT_SUPPORTED: This function is not implemented at this FFA instance * -BUSY: Message target is busy * -ABORTED: Message target ran into an unexpected error and has aborted */ -static smc_ret_values __spci_msg_send_direct_req32_5(uint32_t source_id, +static smc_ret_values __ffa_msg_send_direct_req32_5(uint32_t source_id, uint32_t dest_id, uint32_t arg0, uint32_t arg1, @@ -64,7 +64,7 @@ static smc_ret_values __spci_msg_send_direct_req32_5(uint32_t source_id, uint32_t arg4) { smc_args args = { - SPCI_MSG_SEND_DIRECT_REQ_SMC32, + FFA_MSG_SEND_DIRECT_REQ_SMC32, (source_id << 16) | dest_id, 0, arg0, arg1, arg2, arg3, arg4 @@ -74,14 +74,14 @@ static smc_ret_values __spci_msg_send_direct_req32_5(uint32_t source_id, } /* Direct message send helper accepting a single 32b message argument */ -smc_ret_values spci_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, +smc_ret_values ffa_msg_send_direct_req(uint32_t source_id, uint32_t dest_id, uint32_t message) { - return __spci_msg_send_direct_req32_5(source_id, dest_id, + return __ffa_msg_send_direct_req32_5(source_id, dest_id, message, 0, 0, 0, 0); } -static smc_ret_values __spci_msg_send_direct_req64_5(uint32_t source_id, +static smc_ret_values __ffa_msg_send_direct_req64_5(uint32_t source_id, uint32_t dest_id, uint64_t arg0, uint64_t arg1, @@ -90,7 +90,7 @@ static smc_ret_values __spci_msg_send_direct_req64_5(uint32_t source_id, uint64_t arg4) { smc_args args = { - SPCI_MSG_SEND_DIRECT_REQ_SMC64, + FFA_MSG_SEND_DIRECT_REQ_SMC64, (source_id << 16) | dest_id, 0, arg0, arg1, arg2, arg3, arg4 @@ -100,9 +100,9 @@ static smc_ret_values __spci_msg_send_direct_req64_5(uint32_t source_id, } /* Direct message send helper accepting a single 64b message argument */ -smc_ret_values spci_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id, +smc_ret_values ffa_msg_send_direct_req64(uint32_t source_id, uint32_t dest_id, uint64_t message) { - return __spci_msg_send_direct_req64_5(source_id, dest_id, + return __ffa_msg_send_direct_req64_5(source_id, dest_id, message, 0, 0, 0, 0); } diff --git a/tftf/tests/runtime_services/secure_service/test_spci_direct_messaging.c b/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c index e085226b8..f18905430 100644 --- a/tftf/tests/runtime_services/secure_service/test_spci_direct_messaging.c +++ b/tftf/tests/runtime_services/secure_service/test_ffa_direct_messaging.c @@ -8,11 +8,11 @@ #include <cactus_def.h> #include <platform.h> #include <smccc.h> -#include <spci_helpers.h> -#include <spci_svc.h> +#include <ffa_helpers.h> +#include <ffa_svc.h> #include <test_helpers.h> -/* Hypervisor ID at physical SPCI instance */ +/* Hypervisor ID at physical FFA instance */ #define HYP_ID (0) /* By convention, SP IDs (as opposed to VM IDs) have bit 15 set */ @@ -22,10 +22,10 @@ #define DIRECT_MSG_TEST_PATTERN2 (0xbbbb0000) #define DIRECT_MSG_TEST_PATTERN3 (0xcccc0000) -#define OPTEE_SPCI_GET_API_VERSION (0) -#define OPTEE_SPCI_GET_OS_VERSION (1) -#define OPTEE_SPCI_GET_OS_VERSION_MAJOR (3) -#define OPTEE_SPCI_GET_OS_VERSION_MINOR (8) +#define OPTEE_FFA_GET_API_VERSION (0) +#define OPTEE_FFA_GET_OS_VERSION (1) +#define OPTEE_FFA_GET_OS_VERSION_MAJOR (3) +#define OPTEE_FFA_GET_OS_VERSION_MINOR (8) static test_result_t send_receive_direct_msg(unsigned int sp_id, unsigned int test_pattern) @@ -33,15 +33,15 @@ static test_result_t send_receive_direct_msg(unsigned int sp_id, smc_ret_values ret_values; /* Send a message to SP through direct messaging */ - ret_values = spci_msg_send_direct_req(HYP_ID, SP_ID(sp_id), + ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(sp_id), test_pattern); /* - * Return responses may be SPCI_MSG_SEND_DIRECT_RESP or SPCI_INTERRUPT, + * Return responses may be FFA_MSG_SEND_DIRECT_RESP or FFA_INTERRUPT, * but only expect the former. Expect SMC32 convention from SP. */ - if (ret_values.ret0 != SPCI_MSG_SEND_DIRECT_RESP_SMC32) { - tftf_testcase_printf("spci_msg_send_direct_req returned %lx\n", + if (ret_values.ret0 != FFA_MSG_SEND_DIRECT_RESP_SMC32) { + tftf_testcase_printf("ffa_msg_send_direct_req returned %lx\n", (u_register_t)ret_values.ret0); return TEST_RESULT_FAIL; } @@ -75,40 +75,40 @@ static bool check_spmc_execution_level(void) /* * Send a first OP-TEE-defined protocol message through - * SPCI direct message. + * FFA direct message. * */ - ret_values = spci_msg_send_direct_req(HYP_ID, SP_ID(1), - OPTEE_SPCI_GET_API_VERSION); - if ((ret_values.ret3 == SPCI_VERSION_MAJOR) && - (ret_values.ret4 == SPCI_VERSION_MINOR)) { + ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(1), + OPTEE_FFA_GET_API_VERSION); + if ((ret_values.ret3 == FFA_VERSION_MAJOR) && + (ret_values.ret4 == FFA_VERSION_MINOR)) { is_optee_spmc_criteria++; } /* * Send a second OP-TEE-defined protocol message through - * SPCI direct message. + * FFA direct message. * */ - ret_values = spci_msg_send_direct_req(HYP_ID, SP_ID(1), - OPTEE_SPCI_GET_OS_VERSION); - if ((ret_values.ret3 == OPTEE_SPCI_GET_OS_VERSION_MAJOR) && - (ret_values.ret4 == OPTEE_SPCI_GET_OS_VERSION_MINOR)) { + ret_values = ffa_msg_send_direct_req(HYP_ID, SP_ID(1), + OPTEE_FFA_GET_OS_VERSION); + if ((ret_values.ret3 == OPTEE_FFA_GET_OS_VERSION_MAJOR) && + (ret_values.ret4 == OPTEE_FFA_GET_OS_VERSION_MINOR)) { is_optee_spmc_criteria++; } return (is_optee_spmc_criteria == 2); } -test_result_t test_spci_direct_messaging(void) +test_result_t test_ffa_direct_messaging(void) { smc_ret_values ret_values; test_result_t result; /********************************************************************** - * Verify that SPCI is there and that it has the correct version. + * Verify that FFA is there and that it has the correct version. **********************************************************************/ - SKIP_TEST_IF_SPCI_VERSION_LESS_THAN(0, 9); + SKIP_TEST_IF_FFA_VERSION_LESS_THAN(1, 0); /* Check if SPMC is OP-TEE at S-EL1 */ if (check_spmc_execution_level()) { @@ -135,14 +135,14 @@ test_result_t test_spci_direct_messaging(void) **********************************************************************/ /* * NOTICE: for now, the SPM does not initially run each SP sequentially - * on boot up so we explicitely run the SP once by invoking SPCI_RUN so - * it reaches spci_msg_wait in the message loop function. + * on boot up so we explicitely run the SP once by invoking FFA_RUN so + * it reaches ffa_msg_wait in the message loop function. */ /* Request running SP2 on VCPU0 */ - ret_values = spci_run(2, 0); - if (ret_values.ret0 != SPCI_MSG_WAIT) { - tftf_testcase_printf("spci_run returned %lx\n", + ret_values = ffa_run(2, 0); + if (ret_values.ret0 != FFA_MSG_WAIT) { + tftf_testcase_printf("ffa_run returned %lx\n", (u_register_t)ret_values.ret0); return TEST_RESULT_FAIL; } diff --git a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c index a52f67a36..16ed371d3 100644 --- a/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c +++ b/tftf/tests/runtime_services/trusted_os/tsp/test_irq_spurious_gicv2.c @@ -81,7 +81,7 @@ static test_result_t test_multicore_spurious_interrupt_non_lead_fn(void) if ((smc_ret.ret1 != TEST_VALUE_1 * 2) || (smc_ret.ret2 != TEST_VALUE_2 * 2)) { tftf_testcase_printf( - "SMC @ CPU %d returned 0x0 0x%llX 0x%llX instead of 0x0 0x%X 0x%X\n", + "SMC @ CPU %d returned 0x0 0x%llx 0x%llx instead of 0x0 0x%x 0x%x\n", core_pos, (unsigned long long)smc_ret.ret1, (unsigned long long)smc_ret.ret2, @@ -99,7 +99,7 @@ static test_result_t test_multicore_spurious_interrupt_non_lead_fn(void) } else { /* Error */ tftf_testcase_printf( - "SMC @ lead CPU returned 0x%llX 0x%llX 0x%llX\n", + "SMC @ lead CPU returned 0x%llx 0x%llx 0x%llx\n", (unsigned long long)smc_ret.ret0, (unsigned long long)smc_ret.ret1, (unsigned long long)smc_ret.ret2); @@ -112,6 +112,8 @@ static test_result_t test_multicore_spurious_interrupt_non_lead_fn(void) break; } + dsbsy(); + /* Signal to the lead CPU that the calling CPU has finished the test */ tftf_send_event(&cpu_ready[core_pos]); @@ -203,7 +205,7 @@ test_result_t test_multicore_spurious_interrupt(void) core_pos = platform_get_core_pos(cpu_mpid); tftf_wait_for_event(&cpu_ready[core_pos]); - tftf_init_event(&cpu_ready[i]); + tftf_init_event(&cpu_ready[core_pos]); } /* Wait until tftf_init_event is seen by all cores */ @@ -249,6 +251,9 @@ test_result_t test_multicore_spurious_interrupt(void) test_finished_flag = 1; + /* Make sure the flag update is seen by all cores */ + dsbsy(); + /* Wait for non-lead CPUs to finish the test */ for_each_cpu(cpu_node) { cpu_mpid = tftf_get_mpidr_from_node(cpu_node); @@ -275,6 +280,9 @@ test_result_t test_multicore_spurious_interrupt(void) total_preempted_count += preempted_count[i]; } + mp_printf("Count Spurious= %d; Preempted= %d\n", total_spurious_count, + total_preempted_count); + /* Check that the test has tested the behaviour. */ if (total_spurious_count == 0) { tftf_testcase_printf("No spurious interrupts were handled.\n" diff --git a/tftf/tests/tests-cpu-extensions.mk b/tftf/tests/tests-cpu-extensions.mk index 9102b351d..fedf7837d 100644 --- a/tftf/tests/tests-cpu-extensions.mk +++ b/tftf/tests/tests-cpu-extensions.mk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018-2019, Arm Limited. All rights reserved. +# Copyright (c) 2018-2020, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -9,7 +9,10 @@ TESTS_SOURCES += $(addprefix tftf/tests/, \ extensions/mte/test_mte.c \ extensions/sve/sve_operations.S \ extensions/sve/test_sve.c \ + extensions/fgt/test_fgt.c \ + extensions/ecv/test_ecv.c \ runtime_services/arm_arch_svc/smccc_arch_workaround_1.c \ runtime_services/arm_arch_svc/smccc_arch_workaround_2.c \ + runtime_services/arm_arch_svc/smccc_arch_soc_id.c \ extensions/pauth/test_pauth.c \ ) diff --git a/tftf/tests/tests-cpu-extensions.xml b/tftf/tests/tests-cpu-extensions.xml index 158cb04f6..08a65c7fc 100644 --- a/tftf/tests/tests-cpu-extensions.xml +++ b/tftf/tests/tests-cpu-extensions.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright (c) 2018-2019, Arm Limited. All rights reserved. + Copyright (c) 2018-2020, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-3-Clause --> @@ -18,11 +18,14 @@ <testcase name="Check for Pointer Authentication key leakage from TSP" function="test_pauth_leakage_tsp" /> <testcase name="Use MTE Instructions" function="test_mte_instructions" /> <testcase name="Check for MTE register leakage" function="test_mte_leakage" /> + <testcase name="Use FGT Registers" function="test_fgt_enabled" /> + <testcase name="Use ECV Registers" function="test_ecv_enabled" /> </testsuite> <testsuite name="ARM_ARCH_SVC" description="Arm Architecture Service tests"> <testcase name="SMCCC_ARCH_WORKAROUND_1 test" function="test_smccc_arch_workaround_1" /> <testcase name="SMCCC_ARCH_WORKAROUND_2 test" function="test_smccc_arch_workaround_2" /> + <testcase name="SMCCC_ARCH_SOC_ID test" function="test_smccc_arch_soc_id" /> </testsuite> </testsuites> diff --git a/tftf/tests/tests-spm.mk b/tftf/tests/tests-spm.mk index 40c9b87d7..dab4c6ac5 100644 --- a/tftf/tests/tests-spm.mk +++ b/tftf/tests/tests-spm.mk @@ -6,6 +6,6 @@ TESTS_SOURCES += \ $(addprefix tftf/tests/runtime_services/secure_service/, \ - spci_helpers.c \ - test_spci_direct_messaging.c \ + ffa_helpers.c \ + test_ffa_direct_messaging.c \ ) diff --git a/tftf/tests/tests-spm.xml b/tftf/tests/tests-spm.xml index beac7dd69..09af63973 100644 --- a/tftf/tests/tests-spm.xml +++ b/tftf/tests/tests-spm.xml @@ -11,8 +11,8 @@ <testsuite name="Secure Partition Manager" description="Test SPM APIs"> - <testcase name="SPCI direct messaging API" - function="test_spci_direct_messaging" /> + <testcase name="PSA FF-A direct messaging API" + function="test_ffa_direct_messaging" /> </testsuite> |