Andrew Geissler | ea144b03 | 2023-01-27 16:03:57 -0600 | [diff] [blame^] | 1 | From 3035651bfc0dcdfd48d28acff6efe2f29bbe9439 Mon Sep 17 00:00:00 2001 |
| 2 | From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 3 | Date: Thu, 6 Oct 2022 15:04:25 +0100 |
| 4 | Subject: [PATCH 04/25] arm_ffa: efi: unmap RX/TX buffers |
| 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() |
| 29 | --- |
| 30 | lib/efi_loader/efi_boottime.c | 13 +++++++++++++ |
| 31 | 1 file changed, 13 insertions(+) |
| 32 | |
| 33 | diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c |
| 34 | index 6f7333638a..caa64028be 100644 |
| 35 | --- a/lib/efi_loader/efi_boottime.c |
| 36 | +++ b/lib/efi_loader/efi_boottime.c |
| 37 | @@ -3,6 +3,9 @@ |
| 38 | * EFI application boot time services |
| 39 | * |
| 40 | * Copyright (c) 2016 Alexander Graf |
| 41 | + * |
| 42 | + * (C) Copyright 2022 ARM Limited |
| 43 | + * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 44 | */ |
| 45 | |
| 46 | #include <common.h> |
| 47 | @@ -23,6 +26,10 @@ |
| 48 | #include <asm/setjmp.h> |
| 49 | #include <linux/libfdt_env.h> |
| 50 | |
| 51 | +#if CONFIG_IS_ENABLED(ARM_FFA_TRANSPORT) |
| 52 | +#include <arm_ffa.h> |
| 53 | +#endif |
| 54 | + |
| 55 | DECLARE_GLOBAL_DATA_PTR; |
| 56 | |
| 57 | /* Task priority level */ |
| 58 | @@ -2178,6 +2185,12 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, |
| 59 | dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL); |
| 60 | } |
| 61 | |
| 62 | +#if CONFIG_IS_ENABLED(ARM_FFA_TRANSPORT) |
| 63 | + /* unmap FF-A RX/TX buffers */ |
| 64 | + if (ffa_bus_ops_get()->rxtx_unmap(NULL)) |
| 65 | + log_err("Can't unmap FF-A RX/TX buffers\n"); |
| 66 | +#endif |
| 67 | + |
| 68 | /* Patch out unsupported runtime function */ |
| 69 | efi_runtime_detach(); |
| 70 | |
| 71 | -- |
| 72 | 2.17.1 |
| 73 | |