feat(fvp): add plat hook for memory transactions

Add call to platform hooks upon successful transmission of a
memory transaction request and as part of a memory reclaim request.
This allows for platform specific functionality to be performed
accordingly.

Note the hooks must be placed in the initial share request and final
reclaim to prevent order dependencies with operations that may take
place in the normal world without visibility of the SPMC.

Add a dummy implementation to the FVP platform.

Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Change-Id: I0c7441a9fdf953c4db0651512e5e2cdbc6656c79
This commit is contained in:
Marc Bonnici 2022-02-21 15:02:36 +00:00
parent 0560b53e71
commit a8be4cd057
3 changed files with 34 additions and 0 deletions

View File

@ -3,6 +3,7 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <services/el3_spmc_ffa_memory.h>
#include <platform_def.h>
@ -26,3 +27,21 @@ int plat_spmc_shmem_datastore_get(uint8_t **datastore, size_t *size)
*size = PLAT_SPMC_SHMEM_DATASTORE_SIZE;
return 0;
}
/*
* Add dummy implementations of memory management related platform hooks.
* These can be used to implement platform specific functionality to support
* a memory sharing/lending operation.
*
* Note: The hooks must be located as part of the initial share request and
* final reclaim to prevent order dependencies with operations that may take
* place in the normal world without visibility of the SPMC.
*/
int plat_spmc_shmem_begin(struct ffa_mtd *desc)
{
return 0;
}
int plat_spmc_shmem_reclaim(struct ffa_mtd *desc)
{
return 0;
}

View File

@ -1031,6 +1031,12 @@ static long spmc_ffa_fill_desc(struct mailbox *mbox,
}
}
/* Allow for platform specific operations to be performed. */
ret = plat_spmc_shmem_begin(&obj->desc);
if (ret != 0) {
goto err_arg;
}
SMC_RET8(smc_handle, FFA_SUCCESS_SMC32, 0, handle_low, handle_high, 0,
0, 0, 0);
@ -1788,6 +1794,13 @@ int spmc_ffa_mem_reclaim(uint32_t smc_fid,
ret = FFA_ERROR_DENIED;
goto err_unlock;
}
/* Allow for platform specific operations to be performed. */
ret = plat_spmc_shmem_reclaim(&obj->desc);
if (ret != 0) {
goto err_unlock;
}
spmc_shmem_obj_free(&spmc_shmem_obj_state, obj);
spin_unlock(&spmc_shmem_obj_state.lock);

View File

@ -48,6 +48,8 @@ struct spmc_shmem_obj_state {
};
extern struct spmc_shmem_obj_state spmc_shmem_obj_state;
extern int plat_spmc_shmem_begin(struct ffa_mtd *desc);
extern int plat_spmc_shmem_reclaim(struct ffa_mtd *desc);
long spmc_ffa_mem_send(uint32_t smc_fid,
bool secure_origin,