diff --git a/services/std_svc/spm/spm_main.c b/services/std_svc/spm/spm_main.c index 585707d..880e86e 100644 --- a/services/std_svc/spm/spm_main.c +++ b/services/std_svc/spm/spm_main.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -233,6 +234,19 @@ 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 @@ 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); }