[PATCH v6 04/10] arm_ffa: efi: unmap RX/TX buffers

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Oct 24 14:08:53 CEST 2022


On Thu, Oct 13, 2022 at 11:38:51AM +0100, Abdellatif El Khlifi wrote:
> unmap RX/TX buffers at ExitBootServices()
> 
> Unmapping the RX/TX buffers created by u-boot is needed before EFI
> runtime.
> 
> At EFI runtime the linux kernel takes care of allocating its own RX/TX
> buffers and registering them with the secure world.
> 
> Secure world should be using the RX/TX buffers created by the kernel.
> So, RX/TX buffers created by u-boot must be unmapped.
> 
> Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Cc: Jens Wiklander <jens.wiklander at linaro.org>
> ---
>  lib/efi_loader/efi_boottime.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index a56021559b..2054b33568 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -3,6 +3,9 @@
>   * EFI application boot time services
>   *
>   * Copyright (c) 2016 Alexander Graf
> + *
> + * (C) Copyright 2022 ARM Limited
> + * Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
>   */
>  
>  #include <common.h>
> @@ -23,6 +26,10 @@
>  #include <asm/setjmp.h>
>  #include <linux/libfdt_env.h>
>  
> +#if CONFIG_IS_ENABLED(ARM_FFA_TRANSPORT)
> +#include <arm_ffa.h>
> +#endif
> +
>  DECLARE_GLOBAL_DATA_PTR;
>  
>  /* Task priority level */
> @@ -2178,6 +2185,14 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
>  		dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
>  	}
>  
> +#if CONFIG_IS_ENABLED(ARM_FFA_TRANSPORT)
> +		/* unmap FF-A RX/TX buffers */
> +		if (ffa_bus_ops_get()->rxtx_unmap())
> +			debug("[efi_boottime][ERROR]: can not unmap FF-A RX/TX buffers\n");

Just do log_err() here and get rid of the else

> +		else
> +			debug("[efi_boottime][INFO]: FF-A RX/TX buffers unmapped\n");
> +#endif
> +
>  	/* Patch out unsupported runtime function */
>  	efi_runtime_detach();
>  
> -- 
> 2.17.1
> 

Thanks
/Ilias


More information about the U-Boot mailing list