blob: d619a66fd4d3a35042d7c83dc7af27b0c9240ada [file] [log] [blame]
Patrick Williams864cc432023-02-09 14:54:44 -06001From 7d2c73749107a5859c7158a859a62c3e8b2d33e2 Mon Sep 17 00:00:00 2001
Andrew Geisslerea144b032023-01-27 16:03:57 -06002From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
3Date: Thu, 6 Oct 2022 15:04:25 +0100
Patrick Williams864cc432023-02-09 14:54:44 -06004Subject: [PATCH 04/27] arm_ffa: efi: unmap RX/TX buffers
Andrew Geisslerea144b032023-01-27 16:03:57 -06005
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()
Patrick Williams864cc432023-02-09 14:54:44 -060029Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Andrew Geisslerea144b032023-01-27 16:03:57 -060030---
31 lib/efi_loader/efi_boottime.c | 13 +++++++++++++
32 1 file changed, 13 insertions(+)
33
34diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
Patrick Williams864cc432023-02-09 14:54:44 -060035index e65ca6a4cbee..3481f2afe7a9 100644
Andrew Geisslerea144b032023-01-27 16:03:57 -060036--- 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 Williams864cc432023-02-09 14:54:44 -0600732.39.1
Andrew Geisslerea144b032023-01-27 16:03:57 -060074