Commit 1dd022ca authored by Jeenu Viswambharan's avatar Jeenu Viswambharan
Browse files

TSPD: Explicitly allow NS preemption for Yielding SMCs



When EL3 exception handling is in effect (i.e.,
EL3_EXCEPTION_HANDLING=1), Non-secure interrupts can't preempt Secure
execution. However, for yielding SMCs, preemption by Non-secure
interupts is intended.

This patch therefore adds a call to ehf_allow_ns_preemption() before
dispatching a Yielding SMC to TSP.

Change-Id: Ia3a1ae252f3adc0f14e6d7e0502f251bdb349bdf
Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
parent 26ea3908
/* /*
* 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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <bl_common.h> #include <bl_common.h>
#include <context_mgmt.h> #include <context_mgmt.h>
#include <debug.h> #include <debug.h>
#include <ehf.h>
#include <errno.h> #include <errno.h>
#include <platform.h> #include <platform.h>
#include <runtime_svc.h> #include <runtime_svc.h>
...@@ -540,6 +541,18 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, ...@@ -540,6 +541,18 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
*/ */
enable_intr_rm_local(INTR_TYPE_NS, SECURE); enable_intr_rm_local(INTR_TYPE_NS, SECURE);
#endif #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); cm_el1_sysregs_context_restore(SECURE);
...@@ -646,7 +659,13 @@ uint64_t tspd_smc_handler(uint32_t smc_fid, ...@@ -646,7 +659,13 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
enable_intr_rm_local(INTR_TYPE_NS, SECURE); enable_intr_rm_local(INTR_TYPE_NS, SECURE);
#endif #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 /* We just need to return to the preempted point in
* TSP and the execution will resume as normal. * TSP and the execution will resume as normal.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment