build: restrict usage of CTX_INCLUDE_EL2_REGS

CTX_INCLUDE_EL2_REGS is used to save/restore EL2 registers and
it should be only used when there is SPMD or RME enabled.

Make CTX_INCLUDE_EL2_REGS an internal macro and remove
from documentation.

Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
Change-Id: I6a70edfd88163423ff0482de094601cf794246d6
This commit is contained in:
Govindraj Raja 2022-11-21 13:10:40 +00:00
parent 4ccbdd86bc
commit f1910cc178
6 changed files with 41 additions and 30 deletions

View file

@ -526,9 +526,7 @@ ifneq (${SPD},none)
SPD_DIR := std_svc SPD_DIR := std_svc
ifeq ($(SPMD_SPM_AT_SEL2),1) ifeq ($(SPMD_SPM_AT_SEL2),1)
ifeq ($(CTX_INCLUDE_EL2_REGS),0) CTX_INCLUDE_EL2_REGS := 1
$(error SPMD with SPM at S-EL2 requires CTX_INCLUDE_EL2_REGS option)
endif
ifeq ($(SPMC_AT_EL3),1) ifeq ($(SPMC_AT_EL3),1)
$(error SPM cannot be enabled in both S-EL2 and EL3.) $(error SPM cannot be enabled in both S-EL2 and EL3.)
endif endif
@ -574,6 +572,14 @@ ifneq (${SPD},none)
# over the sources. # over the sources.
endif endif
ifeq (${CTX_INCLUDE_EL2_REGS}, 1)
ifeq (${SPD},none)
ifeq (${ENABLE_RME},0)
$(error CTX_INCLUDE_EL2_REGS is available only when SPD or RME is enabled)
endif
endif
endif
################################################################################ ################################################################################
# Include rmmd Makefile if RME is enabled # Include rmmd Makefile if RME is enabled
################################################################################ ################################################################################

View file

@ -150,9 +150,6 @@ SPMC located at S-EL1, S-EL2 or EL3:
at EL3. at EL3.
- If neither ``SPMD_SPM_AT_SEL2`` or ``SPMC_AT_EL3`` are enabled the SPMC - If neither ``SPMD_SPM_AT_SEL2`` or ``SPMC_AT_EL3`` are enabled the SPMC
exception level is set to S-EL1. exception level is set to S-EL1.
- **CTX_INCLUDE_EL2_REGS**: this option permits saving (resp.
restoring) the EL2 system register context before entering (resp.
after leaving) the SPMC. It is mandatorily enabled when
``SPMD_SPM_AT_SEL2`` is enabled. The context save/restore routine ``SPMD_SPM_AT_SEL2`` is enabled. The context save/restore routine
and exhaustive list of registers is visible at `[4]`_. and exhaustive list of registers is visible at `[4]`_.
- **SP_LAYOUT_FILE**: this option specifies a text description file - **SP_LAYOUT_FILE**: this option specifies a text description file
@ -161,16 +158,16 @@ SPMC located at S-EL1, S-EL2 or EL3:
is required when ``SPMD_SPM_AT_SEL2`` is enabled hence when multiple is required when ``SPMD_SPM_AT_SEL2`` is enabled hence when multiple
secure partitions are to be loaded by BL2 on behalf of the SPMC. secure partitions are to be loaded by BL2 on behalf of the SPMC.
+---------------+----------------------+------------------+-------------+ +---------------+------------------+-------------+-------------------------+
| | CTX_INCLUDE_EL2_REGS | SPMD_SPM_AT_SEL2 | SPMC_AT_EL3 | | | SPMD_SPM_AT_SEL2 | SPMC_AT_EL3 | CTX_INCLUDE_EL2_REGS(*) |
+---------------+----------------------+------------------+-------------+ +---------------+------------------+-------------+-------------------------+
| SPMC at S-EL1 | 0 | 0 | 0 | | SPMC at S-EL1 | 0 | 0 | 0 |
+---------------+----------------------+------------------+-------------+ +---------------+------------------+-------------+-------------------------+
| SPMC at S-EL2 | 1 | 1 (default when | 0 | | SPMC at S-EL2 | 1 (default when | 0 | 1 |
| | | SPD=spmd) | | | | SPD=spmd) | | |
+---------------+----------------------+------------------+-------------+ +---------------+------------------+-------------+-------------------------+
| SPMC at EL3 | 0 | 0 | 1 | | SPMC at EL3 | 0 | 1 | 0 |
+---------------+----------------------+------------------+-------------+ +---------------+------------------+-------------+-------------------------+
Other combinations of such build options either break the build or are not Other combinations of such build options either break the build or are not
supported. supported.
@ -181,9 +178,9 @@ Notes:
stack. stack.
- When ``SPMD_SPM_AT_SEL2=1``, the reference software stack assumes enablement - When ``SPMD_SPM_AT_SEL2=1``, the reference software stack assumes enablement
of FEAT_PAuth, FEAT_BTI and FEAT_MTE architecture extensions. of FEAT_PAuth, FEAT_BTI and FEAT_MTE architecture extensions.
- The ``CTX_INCLUDE_EL2_REGS`` option provides the generic support for - ``(*) CTX_INCLUDE_EL2_REGS``, this flag is |TF-A| internal and informational
barely saving/restoring EL2 registers from an Arm arch perspective. As such in this table. When set, it provides the generic support for saving/restoring
it is decoupled from the ``SPD=spmd`` option. EL2 registers required when S-EL2 firmware is present.
- BL32 option is re-purposed to specify the SPMC image. It can specify either - BL32 option is re-purposed to specify the SPMC image. It can specify either
the Hafnium binary path (built for the secure world) or the path to a TEE the Hafnium binary path (built for the secure world) or the path to a TEE
binary implementing FF-A interfaces. binary implementing FF-A interfaces.
@ -212,7 +209,6 @@ implemented and the SPMC is located at S-EL2:
CROSS_COMPILE=aarch64-none-elf- \ CROSS_COMPILE=aarch64-none-elf- \
PLAT=fvp \ PLAT=fvp \
SPD=spmd \ SPD=spmd \
CTX_INCLUDE_EL2_REGS=1 \
ARM_ARCH_MINOR=5 \ ARM_ARCH_MINOR=5 \
BRANCH_PROTECTION=1 \ BRANCH_PROTECTION=1 \
CTX_INCLUDE_PAUTH_REGS=1 \ CTX_INCLUDE_PAUTH_REGS=1 \
@ -230,7 +226,6 @@ implemented, the SPMC is located at S-EL2, and enabling secure boot:
CROSS_COMPILE=aarch64-none-elf- \ CROSS_COMPILE=aarch64-none-elf- \
PLAT=fvp \ PLAT=fvp \
SPD=spmd \ SPD=spmd \
CTX_INCLUDE_EL2_REGS=1 \
ARM_ARCH_MINOR=5 \ ARM_ARCH_MINOR=5 \
BRANCH_PROTECTION=1 \ BRANCH_PROTECTION=1 \
CTX_INCLUDE_PAUTH_REGS=1 \ CTX_INCLUDE_PAUTH_REGS=1 \

View file

@ -0,0 +1,14 @@
Internal Build Options
======================
|TF-A| internally uses certain options that are not exposed directly through
:ref:`build-options <build options>` but enabled or disabled indirectly and
depends on certain options to be enabled or disabled.
.. _build_options_internal:
- ``CTX_INCLUDE_EL2_REGS``: This boolean option provides context save/restore
operations when entering/exiting an EL2 execution context. This is of primary
interest when Armv8.4-SecEL2 or RME extension is implemented.
Default is 0 (disabled). This option will be set to 1 (enabled) when ``SPD=spmd``
and ``SPMD_SPM_AT_SEL2`` is set or when ``ENABLE_RME`` is set to 1 (enabled).

View file

@ -164,12 +164,6 @@ Common build options
is on hardware that does not implement AArch32, or at least not at EL1 and is on hardware that does not implement AArch32, or at least not at EL1 and
higher ELs). Default value is 1. higher ELs). Default value is 1.
- ``CTX_INCLUDE_EL2_REGS`` : This boolean option provides context save/restore
operations when entering/exiting an EL2 execution context. This is of primary
interest when Armv8.4-SecEL2 extension is implemented. Default is 0 (disabled).
This option must be equal to 1 (enabled) when ``SPD=spmd`` and
``SPMD_SPM_AT_SEL2`` is set.
- ``CTX_INCLUDE_FPREGS``: Boolean option that, when set to 1, will cause the FP - ``CTX_INCLUDE_FPREGS``: Boolean option that, when set to 1, will cause the FP
registers to be included when saving and restoring the CPU context. Default registers to be included when saving and restoring the CPU context. Default
is 0. is 0.

View file

@ -10,6 +10,7 @@ Getting Started
initial-build initial-build
tools-build tools-build
build-options build-options
build-internals
image-terminology image-terminology
porting-guide porting-guide
psci-lib-integration-guide psci-lib-integration-guide

View file

@ -400,9 +400,10 @@ USE_SPINLOCK_CAS := 0
# Enable Link Time Optimization # Enable Link Time Optimization
ENABLE_LTO := 0 ENABLE_LTO := 0
# Build flag to include EL2 registers in cpu context save and restore during # This option will include EL2 registers in cpu context save and restore during
# S-EL2 firmware entry/exit. This flag is to be used with SPD=spmd option. # EL2 firmware entry/exit. Internal flag not meant for direct setting.
# Default is 0. # Use SPD=spmd and SPMD_SPM_AT_SEL2=1 or ENABLE_RME=1 to enable
# CTX_INCLUDE_EL2_REGS.
CTX_INCLUDE_EL2_REGS := 0 CTX_INCLUDE_EL2_REGS := 0
# Enable Memory tag extension which is supported for architecture greater # Enable Memory tag extension which is supported for architecture greater