diff options
author | Olivier Deprez <olivier.deprez@arm.com> | 2022-12-20 17:30:16 +0100 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2022-12-20 17:30:16 +0100 |
commit | f4d8ed50d27687d437e6885d2b6445a720ae9f69 (patch) | |
tree | 77948480ffb3316d3c4aeed470a3d4a06428564a /services/std_svc/spm | |
parent | 15a6c959deb33e9502b412f399b65bacd97ed019 (diff) | |
parent | 62cd8f3147ed7fb146168c59cab3ba0e006210ad (diff) | |
download | arm-trusted-firmware-f4d8ed50d27687d437e6885d2b6445a720ae9f69.tar.gz |
Merge "fix(el3-spmc): report execution state in partition info get" into integration
Diffstat (limited to 'services/std_svc/spm')
-rw-r--r-- | services/std_svc/spm/el3_spmc/spmc.h | 6 | ||||
-rw-r--r-- | services/std_svc/spm/el3_spmc/spmc_main.c | 40 |
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; } |