
On Fri, 16 Jun 2023 at 16:28, Abdellatif El Khlifi abdellatif.elkhlifi@arm.com wrote:
Add MM communication support using FF-A transport
This feature allows accessing MM partitions services through EFI MM communication protocol. MM partitions such as StandAlonneMM or smm-gateway secure partitions which reside in secure world.
An MM shared buffer and a door bell event are used to exchange the data.
The data is used by EFI services such as GetVariable()/SetVariable() and copied from the communication buffer to the MM shared buffer.
The secure partition is notified about availability of data in the MM shared buffer by an FF-A message (door bell).
On such event, MM SP can read the data and updates the MM shared buffer with the response data.
The response data is copied back to the communication buffer and consumed by the EFI subsystem.
MM communication protocol supports FF-A 64-bit direct messaging.
Signed-off-by: Abdellatif El Khlifi abdellatif.elkhlifi@arm.com Signed-off-by: Gowtham Suresh Kumar gowtham.sureshkumar@arm.com Cc: Tom Rini trini@konsulko.com Cc: Simon Glass sjg@chromium.org Cc: Ilias Apalodimas ilias.apalodimas@linaro.org Cc: Jens Wiklander jens.wiklander@linaro.org
Changelog:
v13:
- remove FF-A and Optee ifdefs
v12:
- drop use of calloc when querying SPs
- address nits
v11:
- rename select_ffa_mm_comms() to select_mm_comms()
- improve the logic of MM transport selection in mm_communicate()
- addressing nits
v10:
- use the FF-A driver Uclass operations
- use uclass_first_device()
- addressing nits
v9: align how FF-A is used with FF-A discovery through DM
v8:
- isolate the compilation choices between FF-A and OP-TEE
- update partition_info_get() second argument to be an SP count
- pass NULL device pointer to the FF-A bus discovery and operations
v7:
- set the MM door bell event to use 64-bit direct messaging
- issue a compile time error when one of these macros are not found : FFA_SHARED_MM_BUFFER_SIZE, FFA_SHARED_MM_BUFFER_OFFSET, FFA_SHARED_MM_BUFFER_ADDR
- make mm_sp_svc_uuid static
- replace EINVAL with ENOMEM in ffa_discover_mm_sp_id() when calloc() fails
- improve use of unmap_sysmem() in ffa_mm_communicate()
v6:
- add FF-A runtime discovery at MM communication level
- drop EFI runtime support for FF-A MM communication
- revert the changes in include/mm_communication.h for efi_mm_communicate_header and smm_variable_access structures
v4:
- use the new FF-A driver interfaces
- discover MM partitions at runtime
- copy FF-A driver private data to EFI runtime section at ExitBootServices()
- drop use of FFA_ERR_STAT_SUCCESS error code
- replace EFI_BUFFER_TOO_SMALL with EFI_OUT_OF_RESOURCES in ffa_mm_communicate(). No need for efi_memcpy_runtime() anymore
- revert the error log in mm_communicate() in case of failure
- remove packed attribute from efi_mm_communicate_header and smm_variable_communicate_header
v2:
- set default values to 0 for FFA_SHARED_MM_BUFFER_SIZE, FFA_SHARED_MM_BUFFER_ADDR and MM_SP_UUID_DATA and add warnings
v1:
- introduce FF-A MM communication
include/mm_communication.h | 13 ++ lib/efi_loader/Kconfig | 16 +- lib/efi_loader/efi_variable_tee.c | 260 +++++++++++++++++++++++++++++- 3 files changed, 282 insertions(+), 7 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org