blob: f20cc28ebba1cdee0f97b1803d87cf3c677fb53a [file] [log] [blame]
Andrew Geisslerea144b032023-01-27 16:03:57 -06001From 3035651bfc0dcdfd48d28acff6efe2f29bbe9439 Mon Sep 17 00:00:00 2001
2From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
3Date: Thu, 6 Oct 2022 15:04:25 +0100
4Subject: [PATCH 04/25] arm_ffa: efi: unmap RX/TX buffers
5
6unmap RX/TX buffers at ExitBootServices()
7
8Unmapping the RX/TX buffers created by u-boot is needed before EFI
9runtime.
10
11At EFI runtime the linux kernel takes care of allocating its own RX/TX
12buffers and registering them with the secure world.
13
14Secure world should be using the RX/TX buffers created by the kernel.
15So, RX/TX buffers created by u-boot must be unmapped.
16
17Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
18Cc: Tom Rini <trini@konsulko.com>
19Cc: Simon Glass <sjg@chromium.org>
20Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
21Cc: Jens Wiklander <jens.wiklander@linaro.org>
22Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]
23
24Changelog:
25===============
26
27v8: pass NULL device pointer to the FF-A bus operation
28v7: replace debug() by log_err()
29---
30 lib/efi_loader/efi_boottime.c | 13 +++++++++++++
31 1 file changed, 13 insertions(+)
32
33diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
34index 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--
722.17.1
73