]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(spmc): support FFA_ID_GET ABI
authorMarc Bonnici <marc.bonnici@arm.com>
Wed, 24 Nov 2021 15:40:00 +0000 (15:40 +0000)
committerMarc Bonnici <marc.bonnici@arm.com>
Fri, 13 May 2022 14:51:23 +0000 (15:51 +0100)
Allow for a partition to retrieve its own partition ID.

Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Change-Id: I1a19ac30b86736d818673c239b2f8fd2d6128c06

services/std_svc/spm/el3_spmc/spmc_main.c

index dd08f8d7e81c8aa72be047a0f460173f3e73c526..11385064a3af04ef5c46256a99a7fc0ca997edf5 100644 (file)
@@ -1008,6 +1008,7 @@ static uint64_t ffa_features_handler(uint32_t smc_fid,
        /* Supported features from both worlds. */
        case FFA_ERROR:
        case FFA_SUCCESS_SMC32:
+       case FFA_ID_GET:
        case FFA_FEATURES:
        case FFA_VERSION:
        case FFA_MSG_SEND_DIRECT_REQ_SMC32:
@@ -1046,6 +1047,25 @@ static uint64_t ffa_features_handler(uint32_t smc_fid,
        }
 }
 
+static uint64_t ffa_id_get_handler(uint32_t smc_fid,
+                                  bool secure_origin,
+                                  uint64_t x1,
+                                  uint64_t x2,
+                                  uint64_t x3,
+                                  uint64_t x4,
+                                  void *cookie,
+                                  void *handle,
+                                  uint64_t flags)
+{
+       if (secure_origin) {
+               SMC_RET3(handle, FFA_SUCCESS_SMC32, 0x0,
+                        spmc_get_current_sp_ctx()->sp_id);
+       } else {
+               SMC_RET3(handle, FFA_SUCCESS_SMC32, 0x0,
+                        spmc_get_hyp_ctx()->ns_ep_id);
+       }
+}
+
 /*******************************************************************************
  * This function will parse the Secure Partition Manifest. From manifest, it
  * will fetch details for preparing Secure partition image context and secure
@@ -1442,6 +1462,10 @@ uint64_t spmc_smc_handler(uint32_t smc_fid,
                return ffa_version_handler(smc_fid, secure_origin, x1, x2, x3,
                                           x4, cookie, handle, flags);
 
+       case FFA_ID_GET:
+               return ffa_id_get_handler(smc_fid, secure_origin, x1, x2, x3,
+                                         x4, cookie, handle, flags);
+
        case FFA_FEATURES:
                return ffa_features_handler(smc_fid, secure_origin, x1, x2, x3,
                                            x4, cookie, handle, flags);