• Jeenu Viswambharan's avatar
    TSPD: Require NS preemption along with EL3 exception handling · 6027796f
    Jeenu Viswambharan authored
    
    At present, the build option TSP_NS_INTR_ASYNC_PREEMPT controls how
    Non-secure interrupt affects TSPs execution. When TSP is executing:
    
      1. When TSP_NS_INTR_ASYNC_PREEMPT=0, Non-secure interrupts are received
         at the TSP's exception vector, and TSP voluntarily preempts itself.
    
      2. When TSP_NS_INTR_ASYNC_PREEMPT=1, Non-secure interrupts causes a
         trap to EL3, which preempts TSP execution.
    
    When EL3 exception handling is in place (i.e.,
    EL3_EXCEPTION_HANDLING=1), FIQs are always trapped to EL3. On a system
    with GICv3, pending NS interrupts while TSP is executing will be
    signalled as FIQ (which traps to EL3). This situation necessitates the
    same treatment applied to case (2) above.
    
    Therefore, when EL3 exception handling is in place, additionally
    require that TSP_NS_INTR_ASYNC_PREEMPT is set to one 1.
    
    Strictly speaking, this is not required on a system with GICv2, but the
    same model is uniformly followed regardless, for simplicity.
    
    Relevant documentation updated.
    
    Change-Id: I928a8ed081fb0ac96e8b1dfe9375c98384da1ccd
    Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
    6027796f
tspd.mk 1.88 KB
#
# Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#

TSPD_DIR		:=	services/spd/tspd
SPD_INCLUDES		:=	-Iinclude/bl32/tsp

SPD_SOURCES		:=	services/spd/tspd/tspd_common.c		\
				services/spd/tspd/tspd_helpers.S	\
				services/spd/tspd/tspd_main.c		\
				services/spd/tspd/tspd_pm.c

# This dispatcher is paired with a Test Secure Payload source and we intend to
# build the Test Secure Payload along with this dispatcher.
#
# In cases where an associated Secure Payload lies outside this build
# system/source tree, the the dispatcher Makefile can either invoke an external
# build command or assume it pre-built

BL32_ROOT		:=	bl32/tsp

# Include SP's Makefile. The assumption is that the TSP's build system is
# compatible with that of Trusted Firmware, and it'll add and populate necessary
# build targets and variables
include ${BL32_ROOT}/tsp.mk

# Let the top-level Makefile know that we intend to build the SP from source
NEED_BL32		:=	yes

# Flag used to enable routing of non-secure interrupts to EL3 when they are
# generated while the code is executing in S-EL1/0.
TSP_NS_INTR_ASYNC_PREEMPT	:=	0

# If TSPD_ROUTE_IRQ_TO_EL3 build flag is defined, use it to define value for
# TSP_NS_INTR_ASYNC_PREEMPT for backward compatibility.
ifdef TSPD_ROUTE_IRQ_TO_EL3
ifeq (${ERROR_DEPRECATED},1)
$(error "TSPD_ROUTE_IRQ_TO_EL3 is deprecated. Please use the new build flag TSP_NS_INTR_ASYNC_PREEMPT")
endif
$(warning "TSPD_ROUTE_IRQ_TO_EL3 is deprecated. Please use the new build flag TSP_NS_INTR_ASYNC_PREEMPT")
TSP_NS_INTR_ASYNC_PREEMPT	:= ${TSPD_ROUTE_IRQ_TO_EL3}
endif

ifeq ($(EL3_EXCEPTION_HANDLING),1)
ifeq ($(TSP_NS_INTR_ASYNC_PREEMPT),0)
$(error When EL3_EXCEPTION_HANDLING=1, TSP_NS_INTR_ASYNC_PREEMPT must also be 1)
endif
endif

$(eval $(call assert_boolean,TSP_NS_INTR_ASYNC_PREEMPT))
$(eval $(call add_define,TSP_NS_INTR_ASYNC_PREEMPT))