]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fix(optee): return UUID for image loading service
authorJeffrey Kardatzke <jkardatzke@google.com>
Thu, 2 Mar 2023 20:02:51 +0000 (12:02 -0800)
committerJeffrey Kardatzke <jkardatzke@google.com>
Thu, 9 Mar 2023 19:18:13 +0000 (20:18 +0100)
This adds return of a UUID when TF-A is in the state where it needs to
receive the SMC call to load the OP-TEE image. It also changes the OEN
used for the image loading call to match the OEN used for the UUID call.

Signed-off-by: Jeffrey Kardatzke <jkardatzke@google.com>
Change-Id: I713cb602d8e53b3f20d179b5fb5162da6a2ed057

services/spd/opteed/opteed_main.c
services/spd/opteed/teesmc_opteed.h
services/spd/opteed/teesmc_opteed_macros.h

index ff09e7e0f2e5f5ee8fc236c3e988f2a266260079..f069775d2402ee4c203970ebd49049c7ba3e3c17 100644 (file)
@@ -47,6 +47,10 @@ uint32_t opteed_rw;
 
 #if OPTEE_ALLOW_SMC_LOAD
 static bool opteed_allow_load;
+/* OP-TEE image loading service UUID */
+DEFINE_SVC_UUID2(optee_image_load_uuid,
+       0xb1eafba3, 0x5d31, 0x4612, 0xb9, 0x06,
+       0xc4, 0xc7, 0xa4, 0xbe, 0x3c, 0xc0);
 #else
 static int32_t opteed_init(void);
 #endif
@@ -335,6 +339,10 @@ static uintptr_t opteed_smc_handler(uint32_t smc_fid,
 
        if (is_caller_non_secure(flags)) {
 #if OPTEE_ALLOW_SMC_LOAD
+               if (opteed_allow_load && smc_fid == NSSMC_OPTEED_CALL_UID) {
+                       /* Provide the UUID of the image loading service. */
+                       SMC_UUID_RET(handle, optee_image_load_uuid);
+               }
                if (smc_fid == NSSMC_OPTEED_CALL_LOAD_IMAGE) {
                        /*
                         * TODO: Consider wiping the code for SMC loading from
index eae3ed2aecdbe592873217b5b4a7fc57256188db..4026fa4da9053b8fce5c955313e218164316f442 100644 (file)
 #define NSSMC_OPTEED_CALL_LOAD_IMAGE \
        NSSMC_OPTEED_CALL(NSSMC_OPTEED_FUNCID_LOAD_IMAGE)
 
+/*
+ * Returns the UID of the OP-TEE image loading service if image loading is
+ * enabled and the image had not been loaded yet. Otherwise this call will be
+ * passed through to OP-TEE where it will return the OP-TEE UID.
+ */
+#define NSSMC_OPTEED_FUNCID_CALLS_UID 0xFF01
+#define NSSMC_OPTEED_CALL_UID \
+       NSSMC_OPTEED_CALL(NSSMC_OPTEED_FUNCID_CALLS_UID)
+
 #endif /*TEESMC_OPTEED_H*/
index ad3ed754f263a70178cd679c6616d41990d5cd18..721914063e86adc7af27d6015a8d1b34fb31615d 100644 (file)
@@ -17,7 +17,7 @@
 #define NSSMC_OPTEED_CALL(func_num) \
                ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \
                ((SMC_32) << FUNCID_CC_SHIFT) | \
-               (50 << FUNCID_OEN_SHIFT) | \
+               (63 << FUNCID_OEN_SHIFT) | \
                ((func_num) & FUNCID_NUM_MASK))
 
 #endif /* TEESMC_OPTEED_MACROS_H */