[PATCH v11 09/10] arm_ffa: efi: introduce FF-A MM communication

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Apr 21 10:10:04 CEST 2023


Hi Abdellatif,

[...]

>
> @@ -162,7 +450,16 @@ static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize)
>  	mm_hdr = (struct efi_mm_communicate_header *)comm_buf;
>  	var_hdr = (struct smm_variable_communicate_header *)mm_hdr->data;
>
> -	ret = optee_mm_communicate(comm_buf, dsize);
> +	mm_comms = select_mm_comms();

switch()/case probably looks more readable here

> +	if (mm_comms == MM_COMMS_UNDEFINED) {
> +		ret = EFI_UNSUPPORTED;
> +	} else {
> +		if (mm_comms == MM_COMMS_OPTEE)
> +			ret = optee_mm_communicate(comm_buf, dsize);
> +		else
> +			ret = ffa_mm_communicate(comm_buf, dsize);
> +	}
> +
>  	if (ret != EFI_SUCCESS) {
>  		log_err("%s failed!\n", __func__);
>  		return ret;
> @@ -258,6 +555,13 @@ efi_status_t EFIAPI get_max_payload(efi_uintn_t *size)
>  		goto out;
>  	}
>  	*size = var_payload->size;
> +
> +	#if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT))
> +		if (*size > FFA_SHARED_MM_BUFFER_SIZE)
> +			*size = FFA_SHARED_MM_BUFFER_SIZE - MM_COMMUNICATE_HEADER_SIZE	-
> +				MM_VARIABLE_COMMUNICATE_SIZE;
> +	#endif
> +
>  	/*
>  	 * There seems to be a bug in EDK2 miscalculating the boundaries and
>  	 * size checks, so deduct 2 more bytes to fulfill this requirement. Fix
> @@ -697,7 +1001,7 @@ void efi_variables_boot_exit_notify(void)
>  		ret = EFI_NOT_FOUND;
>
>  	if (ret != EFI_SUCCESS)
> -		log_err("Unable to notify StMM for ExitBootServices\n");
> +		log_err("Unable to notify the MM partition for ExitBootServices\n");
>  	free(comm_buf);
>
>  	/*
> --
> 2.25.1
>

Thanks
/Ilias


More information about the U-Boot mailing list