summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorSughosh Ganu <sughosh.ganu@arm.com>2018-11-14 11:06:24 +0530
committerSughosh Ganu <sughosh.ganu@arm.com>2018-11-14 11:18:22 +0530
commit6e3bad36c8634d6f6a252b28c562077e141bebd3 (patch)
treee9081f7a1cfeb20d5ed368d6e80632655b6c793d /services
parent5681b292c01ba8612256e4dfefb43e736de2a1c3 (diff)
SPM: Raise running priority of the core while in Secure Partition
The current secure partition design mandates that a) at a point, only a single core can be executing in the secure partition, and b) a core cannot be preempted by an interrupt while executing in secure partition. Ensure this by activating the SPM priority prior to entering the parition. Deactivate the priority on return from the partition. Change-Id: Icb3473496d16b733564592eef06304a1028e4f5c Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
Diffstat (limited to 'services')
-rw-r--r--services/std_svc/spm/spm_main.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/services/std_svc/spm/spm_main.c b/services/std_svc/spm/spm_main.c
index 585707dc..880e86e4 100644
--- a/services/std_svc/spm/spm_main.c
+++ b/services/std_svc/spm/spm_main.c
@@ -9,6 +9,7 @@
#include <bl31.h>
#include <context_mgmt.h>
#include <debug.h>
+#include <ehf.h>
#include <errno.h>
#include <mm_svc.h>
#include <platform.h>
@@ -233,6 +234,19 @@ static uint64_t mm_communicate(uint32_t smc_fid, uint64_t mm_cookie,
VERBOSE("MM_COMMUNICATE: comm_size_address is not 0 as recommended.\n");
}
+ /*
+ * The current secure partition design mandates
+ * - at any point, only a single core can be
+ * executing in the secure partiton.
+ * - a core cannot be preempted by an interrupt
+ * while executing in secure partition.
+ * Raise the running priority of the core to the
+ * interrupt level configured for secure partition
+ * so as to block any interrupt from preempting this
+ * core.
+ */
+ ehf_activate_priority(PLAT_SP_PRI);
+
/* Save the Normal world context */
cm_el1_sysregs_context_save(NON_SECURE);
@@ -243,6 +257,12 @@ static uint64_t mm_communicate(uint32_t smc_fid, uint64_t mm_cookie,
cm_el1_sysregs_context_restore(NON_SECURE);
cm_set_next_eret_context(NON_SECURE);
+ /*
+ * Exited from secure partition. This core can take
+ * interrupts now.
+ */
+ ehf_deactivate_priority(PLAT_SP_PRI);
+
SMC_RET1(handle, rc);
}