summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorMarc Bonnici <marc.bonnici@arm.com>2022-10-26 14:58:29 +0100
committerMarc Bonnici <marc.bonnici@arm.com>2022-11-09 19:05:14 +0000
commit62cd8f3147ed7fb146168c59cab3ba0e006210ad (patch)
tree819a4369c84a296e5f290a789f65500ca73a39ca /services
parent6b2193bd4899626b3871c0bfcd1f864770b91084 (diff)
downloadarm-trusted-firmware-62cd8f3147ed7fb146168c59cab3ba0e006210ad.tar.gz
fix(el3-spmc): report execution state in partition info get
Ensure that the correct execution state of an SP is reported as part of an FF-A v1.1 PARTITION_INFO_GET response. Signed-off-by: Marc Bonnici <marc.bonnici@arm.com> Change-Id: I714e53ae71c376463797a42cd5ab7a5e9c687fb7
Diffstat (limited to 'services')
-rw-r--r--services/std_svc/spm/el3_spmc/spmc.h6
-rw-r--r--services/std_svc/spm/el3_spmc/spmc_main.c40
2 files changed, 42 insertions, 4 deletions
diff --git a/services/std_svc/spm/el3_spmc/spmc.h b/services/std_svc/spm/el3_spmc/spmc.h
index 523365002..61afee30a 100644
--- a/services/std_svc/spm/el3_spmc/spmc.h
+++ b/services/std_svc/spm/el3_spmc/spmc.h
@@ -228,6 +228,12 @@ struct ffa_partition_info_v1_1 {
uint32_t uuid[4];
};
+/* FF-A Partition Info Get related macros. */
+#define FFA_PARTITION_INFO_GET_PROPERTIES_V1_0_MASK U(0x7)
+#define FFA_PARTITION_INFO_GET_EXEC_STATE_SHIFT U(8)
+#define FFA_PARTITION_INFO_GET_AARCH32_STATE U(0)
+#define FFA_PARTITION_INFO_GET_AARCH64_STATE U(1)
+
/* Reference to power management hooks */
extern const spd_pm_ops_t spmc_pm;
diff --git a/services/std_svc/spm/el3_spmc/spmc_main.c b/services/std_svc/spm/el3_spmc/spmc_main.c
index 9b8621a73..08e7218d1 100644
--- a/services/std_svc/spm/el3_spmc/spmc_main.c
+++ b/services/std_svc/spm/el3_spmc/spmc_main.c
@@ -746,6 +746,27 @@ static uint64_t rxtx_unmap_handler(uint32_t smc_fid,
}
/*
+ * Helper function to populate the properties field of a Partition Info Get
+ * descriptor.
+ */
+static uint32_t
+partition_info_get_populate_properties(uint32_t sp_properties,
+ enum sp_execution_state sp_ec_state)
+{
+ uint32_t properties = sp_properties;
+ uint32_t ec_state;
+
+ /* Determine the execution state of the SP. */
+ ec_state = sp_ec_state == SP_STATE_AARCH64 ?
+ FFA_PARTITION_INFO_GET_AARCH64_STATE :
+ FFA_PARTITION_INFO_GET_AARCH32_STATE;
+
+ properties |= ec_state << FFA_PARTITION_INFO_GET_EXEC_STATE_SHIFT;
+
+ return properties;
+}
+
+/*
* Collate the partition information in a v1.1 partition information
* descriptor format, this will be converter later if required.
*/
@@ -771,7 +792,12 @@ static int partition_info_get_handler_v1_1(uint32_t *uuid,
desc = &partitions[*partition_count];
desc->ep_id = el3_lp_descs[index].sp_id;
desc->execution_ctx_count = PLATFORM_CORE_COUNT;
- desc->properties = el3_lp_descs[index].properties;
+ /* LSPs must be AArch64. */
+ desc->properties =
+ partition_info_get_populate_properties(
+ el3_lp_descs[index].properties,
+ SP_STATE_AARCH64);
+
if (null_uuid) {
copy_uuid(desc->uuid, el3_lp_descs[index].uuid);
}
@@ -794,7 +820,11 @@ static int partition_info_get_handler_v1_1(uint32_t *uuid,
* S-EL1 SPs.
*/
desc->execution_ctx_count = PLATFORM_CORE_COUNT;
- desc->properties = sp_desc[index].properties;
+ desc->properties =
+ partition_info_get_populate_properties(
+ sp_desc[index].properties,
+ sp_desc[index].execution_state);
+
if (null_uuid) {
copy_uuid(desc->uuid, sp_desc[index].uuid);
}
@@ -835,7 +865,7 @@ static uint32_t partition_info_get_handler_count_only(uint32_t *uuid)
/*
* If the caller of the PARTITION_INFO_GET ABI was a v1.0 caller, populate
- * the coresponding descriptor format from the v1.1 descriptor array.
+ * the corresponding descriptor format from the v1.1 descriptor array.
*/
static uint64_t partition_info_populate_v1_0(struct ffa_partition_info_v1_1
*partitions,
@@ -860,8 +890,10 @@ static uint64_t partition_info_populate_v1_0(struct ffa_partition_info_v1_1
v1_0_partitions[index].ep_id = partitions[index].ep_id;
v1_0_partitions[index].execution_ctx_count =
partitions[index].execution_ctx_count;
+ /* Only report v1.0 properties. */
v1_0_partitions[index].properties =
- partitions[index].properties;
+ (partitions[index].properties &
+ FFA_PARTITION_INFO_GET_PROPERTIES_V1_0_MASK);
}
return 0;
}