aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Filchenko <dmitriyf@google.com>2024-02-16 04:54:24 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-02-16 04:54:24 +0000
commitf5848e706038c04f90ab411cfb6222b9c5156e0c (patch)
tree46d703d7a7b7718462c68f9b15437a0b841358aa
parent88b81d9bece2e5c0a374491e7ec831664ea4ef15 (diff)
parent06db8b350c26a281b53b639a631df1760b853913 (diff)
downloadtrusted-firmware-a-master.tar.gz
spd: trusty: Add FFA_PARTITION_INFO_GET am: 06db8b350cHEADmastermain
Original change: https://android-review.googlesource.com/c/trusty/external/trusted-firmware-a/+/2185639 Change-Id: I76ce66bdd759c8ee359e7633e25e3916c91bf83f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--services/spd/trusty/include/trusty/arm_ffa.h19
-rw-r--r--services/spd/trusty/shared-mem-smcall.c48
2 files changed, 67 insertions, 0 deletions
diff --git a/services/spd/trusty/include/trusty/arm_ffa.h b/services/spd/trusty/include/trusty/arm_ffa.h
index f94d0a403..d8e7dfa66 100644
--- a/services/spd/trusty/include/trusty/arm_ffa.h
+++ b/services/spd/trusty/include/trusty/arm_ffa.h
@@ -268,6 +268,25 @@ struct ffa_mem_relinquish_descriptor {
STATIC_ASSERT(sizeof(struct ffa_mem_relinquish_descriptor) == 16);
/**
+ * struct ffa_partition_info - FFA partition info descriptor.
+ * @id:
+ * 16-bit ID of the partition
+ * @execution_ctx_count:
+ * Number of execution contexts implemented by this partition
+ * @properties:
+ * Flags to determine partition properties. Like direct/indirect
+ * messages send/receive capabilities.
+ */
+struct ffa_partition_info {
+ uint16_t id;
+ uint16_t execution_ctx_count;
+#define FFA_PART_PROP_RECV_DIRECT (1U)
+#define FFA_PART_PROP_SEND_DIRECT (1U << 1)
+#define FFA_PART_PROP_VM_MSGS (1U << 6)
+ uint32_t properties;
+};
+
+/**
* typedef ffa_features2_t - FFA_FEATURES values returned in w2
*
* * @FFA_FEATURES2_RXTX_MAP_BUF_SIZE_MASK
diff --git a/services/spd/trusty/shared-mem-smcall.c b/services/spd/trusty/shared-mem-smcall.c
index 89a1b17bc..8eae42e2c 100644
--- a/services/spd/trusty/shared-mem-smcall.c
+++ b/services/spd/trusty/shared-mem-smcall.c
@@ -913,6 +913,49 @@ static int trusty_ffa_id_get(u_register_t flags, u_register_t *idp)
}
/**
+ * trusty_ffa_partition_info_get - FFA_PARTITION_INFO_GET implementation.
+ * @client: Client state
+ * @uuid_0: uuid 0
+ * @uuid_1: uuid 1
+ * @uuid_2 uuid 2
+ * @uuid_3: uuid 3
+ * @ret2: Pointer to return value2 on success. Contains partition
+ * count in case of UUID match.
+ * @ret3: Pointer to return value3 on success. Contains the size
+ * of each partition descriptor
+ *
+ * Return: 0 on success, error code on failure.
+ */
+static long trusty_ffa_partition_info_get(
+ struct trusty_shmem_client_state *client,
+ uint32_t uuid_0,
+ uint32_t uuid_1,
+ uint32_t uuid_2,
+ uint32_t uuid_3,
+ u_register_t *ret2,
+ u_register_t *ret3)
+{
+ uint32_t uuid[4] = { uuid_0, uuid_1, uuid_2, uuid_3 };
+
+ if (!memcmp(trusty_sp.uuid, uuid, sizeof(uuid)) ||
+ (uuid[0] == 0 && uuid[1] == 0 && uuid[2] == 0 && uuid[3] == 0)) {
+ struct ffa_partition_info *info;
+
+ info = (struct ffa_partition_info *)client->rx_buf;
+
+ info->id = trusty_sp.sp_id;
+ info->execution_ctx_count = PLATFORM_CORE_COUNT;
+ info->properties = trusty_sp.properties;
+
+ *ret2 = 1;
+ *ret3 = sizeof(info);
+ return 0;
+ }
+
+ return -ENOENT;
+}
+
+/**
* trusty_ffa_rx_release - FFA_RX_RELEASE implementation.
* @client: Client state.
*
@@ -1106,6 +1149,11 @@ uintptr_t spmd_ffa_smc_handler(uint32_t smc_fid,
ret = trusty_ffa_rx_release(client);
break;
+ case FFA_PARTITION_INFO_GET:
+ ret = trusty_ffa_partition_info_get(client, w1, w2, w3, w4,
+ &ret_reg2, &ret_reg3);
+ break;
+
case FFA_ID_GET:
ret = trusty_ffa_id_get(flags, &ret_reg2);
break;