aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authordavidcunado-arm <david.cunado@arm.com>2018-02-12 17:52:08 +0800
committerGitHub <noreply@github.com>2018-02-12 17:52:08 +0800
commit15e5958560e9d31e7357e3a0ada2289e78758839 (patch)
tree6753e121f929d75b5a49c2cb4f36777b25dd7c1c /services
parente47a8323ecff51470562c66e5357319276955814 (diff)
parentfb750ee16112c7672ef605af35e174375c55fabc (diff)
downloadplatform_external_arm-trusted-firmware-15e5958560e9d31e7357e3a0ada2289e78758839.tar.gz
platform_external_arm-trusted-firmware-15e5958560e9d31e7357e3a0ada2289e78758839.tar.bz2
platform_external_arm-trusted-firmware-15e5958560e9d31e7357e3a0ada2289e78758839.zip
Merge pull request #1256 from jeenu-arm/tsp-ehf
TSP changes for EHF
Diffstat (limited to 'services')
-rw-r--r--services/spd/tspd/tspd.mk8
-rw-r--r--services/spd/tspd/tspd_main.c23
2 files changed, 28 insertions, 3 deletions
diff --git a/services/spd/tspd/tspd.mk b/services/spd/tspd/tspd.mk
index 223e418e2..0747e15f6 100644
--- a/services/spd/tspd/tspd.mk
+++ b/services/spd/tspd/tspd.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -43,5 +43,11 @@ $(warning "TSPD_ROUTE_IRQ_TO_EL3 is deprecated. Please use the new build flag TS
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))
diff --git a/services/spd/tspd/tspd_main.c b/services/spd/tspd/tspd_main.c
index 2ba9f84c0..c564f8b86 100644
--- a/services/spd/tspd/tspd_main.c
+++ b/services/spd/tspd/tspd_main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -20,6 +20,7 @@
#include <bl_common.h>
#include <context_mgmt.h>
#include <debug.h>
+#include <ehf.h>
#include <errno.h>
#include <platform.h>
#include <runtime_svc.h>
@@ -540,6 +541,18 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
*/
enable_intr_rm_local(INTR_TYPE_NS, SECURE);
#endif
+
+#if EL3_EXCEPTION_HANDLING
+ /*
+ * With EL3 exception handling, while an SMC is
+ * being processed, Non-secure interrupts can't
+ * preempt Secure execution. However, for
+ * yielding SMCs, we want preemption to happen;
+ * so explicitly allow NS preemption in this
+ * case.
+ */
+ ehf_allow_ns_preemption();
+#endif
}
cm_el1_sysregs_context_restore(SECURE);
@@ -646,7 +659,13 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
enable_intr_rm_local(INTR_TYPE_NS, SECURE);
#endif
-
+#if EL3_EXCEPTION_HANDLING
+ /*
+ * Allow the resumed yielding SMC processing to be preempted by
+ * Non-secure interrupts.
+ */
+ ehf_allow_ns_preemption();
+#endif
/* We just need to return to the preempted point in
* TSP and the execution will resume as normal.