]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
SPMD: hook SPMD into standard services framework
authorAchin Gupta <achin.gupta@arm.com>
Fri, 11 Oct 2019 14:49:00 +0000 (15:49 +0100)
committerMax Shvetsov <maksims.svecovs@arm.com>
Mon, 10 Feb 2020 14:09:21 +0000 (14:09 +0000)
This patch adds support to initialise the SPM dispatcher as a standard
secure service. It also registers a handler for SPCI SMCs exported by
the SPM dispatcher.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Artsem Artsemenka <artsem.artsemenka@arm.com>
Change-Id: I2183adf826d08ff3fee9aee75f021021162b6477

services/std_svc/std_svc_setup.c

index 7787a2fa234abb2fb13078413cebcbac62c9782c..895fd292fa74977946d85524347af7fa41f06c3c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -15,6 +15,7 @@
 #include <lib/runtime_instr.h>
 #include <services/sdei.h>
 #include <services/spm_mm_svc.h>
+#include <services/spmd_svc.h>
 #include <services/std_svc.h>
 #include <smccc_helpers.h>
 #include <tools_share/uuid.h>
@@ -51,6 +52,12 @@ static int32_t std_svc_setup(void)
        }
 #endif
 
+#if defined(SPD_spmd)
+       if (spmd_setup() != 0) {
+               ret = 1;
+       }
+#endif
+
 #if SDEI_SUPPORT
        /* SDEI initialisation */
        sdei_init();
@@ -114,6 +121,17 @@ static uintptr_t std_svc_smc_handler(uint32_t smc_fid,
        }
 #endif
 
+#if defined(SPD_spmd)
+       /*
+        * Dispatch SPCI calls to the SPCI SMC handler implemented by the SPM
+        * dispatcher and return its return value
+        */
+       if (is_spci_fid(smc_fid)) {
+               return spmd_smc_handler(smc_fid, x1, x2, x3, x4, cookie,
+                                       handle, flags);
+       }
+#endif
+
 #if SDEI_SUPPORT
        if (is_sdei_fid(smc_fid)) {
                return sdei_smc_handler(smc_fid, x1, x2, x3, x4, cookie, handle,