On Wed, 29 Jul 2026 at 11:52, Harsimran Singh Tungal
<[email protected]> wrote:
>
> Make the FF-A MM SP notification helper usable after ExitBootServices().
> The boot path continues to use the FF-A driver-model operation, while
> the runtime path uses the resident FF-A runtime transport.
>
> This keeps the notification path shared while avoiding driver-model
> access from EFI runtime code.
>
> Reviewed-by: Simon Glass <[email protected]>
> Reviewed-by: Abdellatif El Khlifi <[email protected]>
> Signed-off-by: Harsimran Singh Tungal <[email protected]>
> ---

Reviewed-by: Ilias Apalodimas <[email protected]>

>  lib/efi_loader/efi_variable_tee.c | 53 +++++++++++--------------------
>  1 file changed, 18 insertions(+), 35 deletions(-)
>
> diff --git a/lib/efi_loader/efi_variable_tee.c 
> b/lib/efi_loader/efi_variable_tee.c
> index 72055b36bba..4ebba83036c 100644
> --- a/lib/efi_loader/efi_variable_tee.c
> +++ b/lib/efi_loader/efi_variable_tee.c
> @@ -14,6 +14,7 @@
>
>  #if CONFIG_IS_ENABLED(ARM_FFA_TRANSPORT)
>  #include <arm_ffa.h>
> +#include <arm_ffa_runtime.h>
>  #endif
>  #include <cpu_func.h>
>  #include <dm.h>
> @@ -49,7 +50,7 @@ static const int __efi_runtime_rodata mm_sp_errmap[] = {
>  };
>
>  static const char *mm_sp_svc_uuid = MM_SP_UUID;
> -static u16 mm_sp_id;
> +static u16 __efi_runtime_data mm_sp_id;
>  #endif
>
>  extern struct efi_var_file __efi_runtime_data *efi_var_buf;
> @@ -229,52 +230,34 @@ static int __efi_runtime ffa_map_sp_event(int 
> sp_event_ret)
>   * This is a blocking call during which trusted world has exclusive access
>   * to the MM shared buffer.
>   *
> - * Return:
> - *
> - * 0 on success
> + * Return: 0 on success
>   */
> -static int ffa_notify_mm_sp(void)
> +static int __efi_runtime ffa_notify_mm_sp(void)
>  {
>         struct ffa_send_direct_data msg = {0};
>         int ret;
>         int sp_event_ret;
> -       struct udevice *dev;
> +       bool at_runtime = efi_at_runtime();
>
> -       ret = uclass_first_device_err(UCLASS_FFA, &dev);
> -       if (ret) {
> -               log_err("EFI: Cannot find FF-A bus device, notify MM SP 
> failure\n");
> -               return ret;
> -       }
> +       msg.data0 = CONFIG_FFA_SHARED_MM_BUF_OFFSET;
>
> -       msg.data0 = CONFIG_FFA_SHARED_MM_BUF_OFFSET; /* x3 */
> +       if (at_runtime) {
> +               ret = ffa_sync_send_receive_runtime(mm_sp_id, &msg, 1);
> +       } else {
> +               struct udevice *dev;
>
> -       ret = ffa_sync_send_receive(dev, mm_sp_id, &msg, 1);
> +               ret = uclass_first_device_err(UCLASS_FFA, &dev);
> +               if (ret)
> +                       return ret;
> +
> +               ret = ffa_sync_send_receive(dev, mm_sp_id, &msg, 1);
> +       }
>         if (ret)
>                 return ret;
>
> -       sp_event_ret = msg.data0; /* x3 */
> +       sp_event_ret = msg.data0;
>
> -       switch (sp_event_ret) {
> -       case MM_SUCCESS:
> -               ret = 0;
> -               break;
> -       case MM_NOT_SUPPORTED:
> -               ret = -EINVAL;
> -               break;
> -       case MM_INVALID_PARAMETER:
> -               ret = -EPERM;
> -               break;
> -       case MM_DENIED:
> -               ret = -EACCES;
> -               break;
> -       case MM_NO_MEMORY:
> -               ret = -EBUSY;
> -               break;
> -       default:
> -               ret = -EACCES;
> -       }
> -
> -       return ret;
> +       return ffa_map_sp_event(sp_event_ret);
>  }
>
>  /**
> --
> 2.34.1
>

Reply via email to