summaryrefslogtreecommitdiff
path: root/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0004-arm_ffa-efi-unmap-RX-TX-buffers.patch
blob: 3a3dae834d657d3251c7c217444433d395bf93a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From b09b391e33e024a18842dfdc99282d0050cc5fcb Mon Sep 17 00:00:00 2001
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Date: Thu, 6 Oct 2022 15:04:25 +0100
Subject: [PATCH 04/42] arm_ffa: efi: unmap RX/TX buffers

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@arm.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/]

Changelog:
===============

v8: pass NULL device pointer to the FF-A bus operation
v7: replace debug() by log_err()
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
---
 lib/efi_loader/efi_boottime.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index e65ca6a4cb..3481f2afe7 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@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,12 @@ 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(NULL))
+			log_err("Can't unmap FF-A RX/TX buffers\n");
+#endif
+
 	/* Patch out unsupported runtime function */
 	efi_runtime_detach();
 
-- 
2.25.1