Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 1 | From 7d2c73749107a5859c7158a859a62c3e8b2d33e2 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 2 | From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 3 | Date: Thu, 6 Oct 2022 15:04:25 +0100 |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 4 | Subject: [PATCH 04/27] arm_ffa: efi: unmap RX/TX buffers |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 5 | |
| 6 | unmap RX/TX buffers at ExitBootServices() |
| 7 | |
| 8 | Unmapping the RX/TX buffers created by u-boot is needed before EFI |
| 9 | runtime. |
| 10 | |
| 11 | At EFI runtime the linux kernel takes care of allocating its own RX/TX |
| 12 | buffers and registering them with the secure world. |
| 13 | |
| 14 | Secure world should be using the RX/TX buffers created by the kernel. |
| 15 | So, RX/TX buffers created by u-boot must be unmapped. |
| 16 | |
| 17 | Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 18 | Cc: Tom Rini <trini@konsulko.com> |
| 19 | Cc: Simon Glass <sjg@chromium.org> |
| 20 | Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> |
| 21 | Cc: Jens Wiklander <jens.wiklander@linaro.org> |
| 22 | Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/] |
| 23 | |
| 24 | Changelog: |
| 25 | =============== |
| 26 | |
| 27 | v8: pass NULL device pointer to the FF-A bus operation |
| 28 | v7: replace debug() by log_err() |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 29 | Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 30 | --- |
| 31 | lib/efi_loader/efi_boottime.c | 13 +++++++++++++ |
| 32 | 1 file changed, 13 insertions(+) |
| 33 | |
| 34 | diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 35 | index e65ca6a4cbee..3481f2afe7a9 100644 |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 36 | --- a/lib/efi_loader/efi_boottime.c |
| 37 | +++ b/lib/efi_loader/efi_boottime.c |
| 38 | @@ -3,6 +3,9 @@ |
| 39 | * EFI application boot time services |
| 40 | * |
| 41 | * Copyright (c) 2016 Alexander Graf |
| 42 | + * |
| 43 | + * (C) Copyright 2022 ARM Limited |
| 44 | + * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 45 | */ |
| 46 | |
| 47 | #include <common.h> |
| 48 | @@ -23,6 +26,10 @@ |
| 49 | #include <asm/setjmp.h> |
| 50 | #include <linux/libfdt_env.h> |
| 51 | |
| 52 | +#if CONFIG_IS_ENABLED(ARM_FFA_TRANSPORT) |
| 53 | +#include <arm_ffa.h> |
| 54 | +#endif |
| 55 | + |
| 56 | DECLARE_GLOBAL_DATA_PTR; |
| 57 | |
| 58 | /* Task priority level */ |
| 59 | @@ -2178,6 +2185,12 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, |
| 60 | dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL); |
| 61 | } |
| 62 | |
| 63 | +#if CONFIG_IS_ENABLED(ARM_FFA_TRANSPORT) |
| 64 | + /* unmap FF-A RX/TX buffers */ |
| 65 | + if (ffa_bus_ops_get()->rxtx_unmap(NULL)) |
| 66 | + log_err("Can't unmap FF-A RX/TX buffers\n"); |
| 67 | +#endif |
| 68 | + |
| 69 | /* Patch out unsupported runtime function */ |
| 70 | efi_runtime_detach(); |
| 71 | |
| 72 | -- |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 73 | 2.39.1 |
Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 74 | |