blob: 09f826be9bdcbe2d3a4ef8668037fe9d27e2c8f1 [file] [log] [blame]
Feder Liang4f7c75b2021-09-14 16:15:15 +08001######################
2Floating-Point Support
3######################
4
5TF-M adds several configuration flags to control Floating point (FP) [1]_
Feder Liang8ac672f2021-12-09 15:03:04 +08006support in TF-M Secure Processing Environment (SPE) and Non Secure Processing
7Environment (NSPE).
Feder Liang4f7c75b2021-09-14 16:15:15 +08008
Feder Liang8ac672f2021-12-09 15:03:04 +08009* Support FP in SPE or NSPE.
10* Support FP Application Binary Interface (ABI) [2]_ types: software, hardware.
11 SPE and NSPE shall use the same FP ABI type.
12* Support lazy stacking enable/disable in SPE only, NSPE is not allowed to
13 enable/disable this feature.
14* Support GNU Arm Embedded Toolchain [3]_. ``GNU Arm Embedded Toolchain 10.3-
15 2021.10`` and later version shall be used to mitigate VLLDM instruction
16 security vulnerability [4]_.
Feder Liang4f7c75b2021-09-14 16:15:15 +080017* Support Inter-Process Communication (IPC) [5]_ model in TF-M, and doesn't
Feder Liang98e77a82021-11-25 14:34:23 +080018 support LIBRARY or SFN model.
Feder Liang8ac672f2021-12-09 15:03:04 +080019* Support Armv8.0-M mainline.
Feder Liang4f7c75b2021-09-14 16:15:15 +080020* Support isolation level 1,2,3.
Feder Liang8ac672f2021-12-09 15:03:04 +080021* Does not support use FPU in First-Level Interrupt Handling (FLIH) [6]_ at
Feder Liang98e77a82021-11-25 14:34:23 +080022 current stage.
Feder Liang4f7c75b2021-09-14 16:15:15 +080023
Feder Liang8ac672f2021-12-09 15:03:04 +080024Please refer to Arm musca S1 [7]_ platform as a reference implementation when
Feder Liang98e77a82021-11-25 14:34:23 +080025you enable FP support on your platforms.
Feder Liang4f7c75b2021-09-14 16:15:15 +080026
Feder Liang8ac672f2021-12-09 15:03:04 +080027============================
28FP ABI type for SPE and NSPE
29============================
30FP design in Armv8.0-M [8]_ architecture requires consistent FP ABI types
31between SPE and NSPE. Furthermore, both sides shall set up CPACR individually
32when FPU is used. Otherwise, No Coprocessor (NOCP) usage fault will be asserted
33during FP context switch between security states.
34
35Secure and non-secure libraries are compiled with ``COMPILER_CP_FLAG`` and
36linked with ``LINKER_CP_OPTION`` for different FP ABI types. All those
37libraries shall be built with ``COMPLIER_CP_FLAG``.
Feder Liang4f7c75b2021-09-14 16:15:15 +080038
39If FP ABI types mismatch error is generated during build, pleae check whether
40the library is compiled with ``COMPILER_CP_FLAG``.
41Example:
42
43.. code-block:: cmake
44
45 target_compile_options(lib
46 PRIVATE
47 ${COMPILER_CP_FLAG}
48 )
49
50===================================
51CMake configurations for FP support
52===================================
53The following CMake configurations configure ``COMPILER_CP_FLAG`` in TF-M SPE.
54
Feder Liang8ac672f2021-12-09 15:03:04 +080055* ``CONFIG_TFM_FP`` are used to configure FP ABI type for secure and non-secure
56 side both.
Feder Liang4f7c75b2021-09-14 16:15:15 +080057
58 +-------------------+---------------------------+
Feder Liang8ac672f2021-12-09 15:03:04 +080059 | CONFIG_TFM_FP | FP ABI type [2]_ [3]_ |
Feder Liang4f7c75b2021-09-14 16:15:15 +080060 +===================+===========================+
Feder Liang8ac672f2021-12-09 15:03:04 +080061 | soft (default) | Software |
Feder Liang4f7c75b2021-09-14 16:15:15 +080062 +-------------------+---------------------------+
Feder Liang8ac672f2021-12-09 15:03:04 +080063 | hard | Hardware |
Feder Liang4f7c75b2021-09-14 16:15:15 +080064 +-------------------+---------------------------+
65
Feder Liang8ac672f2021-12-09 15:03:04 +080066 FP software ABI type is default in TF-M.
Feder Liang4f7c75b2021-09-14 16:15:15 +080067
Feder Liang8ac672f2021-12-09 15:03:04 +080068* ``CONFIG_TFM_LAZY_STACKING`` is used to enable/disable lazy stacking
69 feature. This feature is only valid for FP hardware ABI type.
70 NSPE is not allowed to enable/disable this feature. Let SPE decide the
71 secure/non-secure shared setting of lazy stacking to avoid the possible
72 side-path brought by flexibility.
Feder Liang4f7c75b2021-09-14 16:15:15 +080073
74 +------------------------------+---------------------------+
Feder Liang8ac672f2021-12-09 15:03:04 +080075 | CONFIG_TFM_LAZY_STACKING | Description |
Feder Liang4f7c75b2021-09-14 16:15:15 +080076 +==============================+===========================+
77 | 0FF | Disable lazy stacking |
78 +------------------------------+---------------------------+
79 | ON (default) | Enable lazy stacking |
80 +------------------------------+---------------------------+
81
82* ``CONFIG_TFM_FP_ARCH`` specifies which FP architecture is available on the
Feder Liang8ac672f2021-12-09 15:03:04 +080083 target, valid for FP hardware ABI type.
Feder Liang4f7c75b2021-09-14 16:15:15 +080084
85 FP architecture is processor dependent. For GNUARM compiler, example value
86 are: auto, fpv5-d16, fpv5-sp-d16, etc.
87
88 Default value of ``CONFIG_TFM_FP_ARCH`` for GNUARM compiler is fpv5-sp-d16.
89
90 This parameter shall be specified by platform. Please check compiler
91 reference manual and processor hardware manual for more details to set
92 correct FPU configuration for platform.
93
94
95*********
96Reference
97*********
98.. [1] `High-Performance Hardware Support for Floating-Point Operations <https://www.arm.com/why-arm/technologies/floating-point>`_
99
Feder Liang8ac672f2021-12-09 15:03:04 +0800100.. [2] `Float Point ABI <https://www.keil.com/support/man/docs/armclang_ref/armclang_ref_chr1417451577871.htm>`_
Feder Liang4f7c75b2021-09-14 16:15:15 +0800101
102.. [3] `GNU Arm Embedded Toolchain <https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm>`_
103
Feder Liang8ac672f2021-12-09 15:03:04 +0800104.. [4] `VLLDM instruction Security Vulnerability <https://developer.arm.com/support/arm-security-updates/vlldm-instruction-security-vulnerability>`_
Feder Liang4f7c75b2021-09-14 16:15:15 +0800105
Feder Liang8ac672f2021-12-09 15:03:04 +0800106.. [5] `ArmĀ® Platform Security Architecture Firmware Framework 1.0 <https://armkeil.blob.core.windows.net/developer/Files/pdf/PlatformSecurityArchitecture/Architect/DEN0063-PSA_Firmware_Framework-1.0.0-2.pdf>`_
Feder Liang4f7c75b2021-09-14 16:15:15 +0800107
Anton Komlev3356ba32022-03-31 22:02:11 +0100108.. [6] :doc:`Secure Interrupt Integration Guide </integration_guide/tfm_secure_irq_integration_guide>`
Feder Liang4f7c75b2021-09-14 16:15:15 +0800109
Feder Liang8ac672f2021-12-09 15:03:04 +0800110.. [7] `Musca-S1 Test Chip Board <https://developer.arm.com/tools-and-software/development-boards/iot-test-chips-and-boards/musca-s1-test-chip-board>`_
Feder Liang98e77a82021-11-25 14:34:23 +0800111
Feder Liang8ac672f2021-12-09 15:03:04 +0800112.. [8] `Armv8-M Architecture Reference Manual <https://developer.arm.com/documentation/ddi0553/latest>`_
Feder Liang4f7c75b2021-09-14 16:15:15 +0800113
114--------------
115
116*Copyright (c) 2021, Arm Limited. All rights reserved.*