aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Filchenko <dmitriyf@google.com>2023-09-06 05:00:34 +0000
committerDmitriy Filchenko <dmitriyf@google.com>2023-11-28 21:08:51 +0000
commit06db8b350c26a281b53b639a631df1760b853913 (patch)
tree46d703d7a7b7718462c68f9b15437a0b841358aa
parent39139bf082e7ed9f41a3528ef4d7fe4c3c2bb581 (diff)
downloadtrusted-firmware-a-06db8b350c26a281b53b639a631df1760b853913.tar.gz
spd: trusty: Add FFA_PARTITION_INFO_GETsimpleperf-releasemain-16k
Trusty driver in Linux kernel implements FFA memory sharing ABIs. This change enables Trusty SPD to be compatible when Trusty driver uses FFA as transport using ARM FFA driver. Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com> Change-Id: Ic5da08d3f388ac6d0c6e50248c61b04d6bd3f8c3
-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;