Hi,
We are planning to update the mechanism on partition interface ABI selection in IPC model.
In current Implementation, cross call ABI is chosen in Isolation Level 1, and SVC call ABI is chosen in Isolation Level 2&3. However, interfaces are actually the bridge between SPM and caller partitions. If one partition shares the same boundary with SPM, cross call ABI is the choice; while if one partition does not share the same boundary with SPM, a SVC ABI is the proper choice. But, a simple comparison between two boundary values cannot be used for checking if the two boundaries are the same one - these values might be encoded with bit fields and contains more info than memory regions. Hence the comparison should be done by who generated them - the isolation HAL implementation in platform sources.
So here comes to the following design:
1. In HAL function tfm_hal_bind_boundary, encode p_ldinf into boundary value, so that there is no need to pass both p_ldinf and boundary value to switch boundary.
1. Implement a HAL function to compare boundaries and switch boundary if needed.
tfm_hal_status_t tfm_hal_switch_boundary(
uintptr_t target_boundary,
uintptr _t current_boundary,
uint32_t compare_only, /* 0: Switch boundary if they are different, 1: Only compare whether the boundaries are different and do not switch */
uint32_t* compare_result); /* Tell the caller whether the boundaries are different */
1. Select correct type of ABI when processing metadata of partition based on boundary. void prv_process_metadata(struct partition_t *p_pt) { ...
tfm_hal_switch_boundary(SPM_BOUNDARY, p_pt->boundary, 1, *compare_result);
if (compare_result == 1) { p_rt_meta->psa_fns = &psa_api_svc; } else { p_rt_meta->psa_fns = &psa_api_cross; }
... }
Please let us know if you have any suggestion.
Thanks, Xinyu