1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-08 17:19:39 +00:00

arm-bsp/u-boot: corstone1000: Enable SMM gateway

This patch updates shared buffer address, disables get/set of NV
variables, and invalidates the cache after write to shared buffer as the
SPs have cache disabled.

Change-Id: Iead01edf3011e192df205236df098415e5bde9a5
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Gowtham Suresh Kumar
2021-12-03 12:28:51 +00:00
committed by Jon Mason
parent 31cffcd59c
commit 583f810f34
4 changed files with 144 additions and 0 deletions
@@ -0,0 +1,38 @@
Upstream-Status: Pending [Not submitted to upstream yet]
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
From 313b89315d93ace166e2312a8e09aa85f1beb747 Mon Sep 17 00:00:00 2001
From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
Date: Wed, 17 Nov 2021 15:28:06 +0000
Subject: [PATCH 06/10] corstone1000: Update FFA shared buffer address
FFA shared buffer address changed to 0x02000000.
The existing address 0x023F8000 is currently being used by
Optee so the virtual address returned to the SMM gateway is 0x0000.
So the buffer is moved to 0x02000000.
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
%% original patch: 0025-Update-FFA-shared-buffer-address.patch
%% original patch: 0025-Update-FFA-shared-buffer-address.patch
---
include/configs/corstone1000.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h
index 7f8c61ba93..0451121b79 100644
--- a/include/configs/corstone1000.h
+++ b/include/configs/corstone1000.h
@@ -42,7 +42,7 @@
#define FFA_SHARED_MM_BUFFER_SIZE SZ_4K /* 4 KB */
/* shared buffer physical address used for communication between u-boot and the MM SP */
-#define FFA_SHARED_MM_BUFFER_ADDR (0x023F8000)
+#define FFA_SHARED_MM_BUFFER_ADDR (0x02000000)
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x03f00000)
#define CONFIG_SKIP_LOWLEVEL_INIT
--
2.17.1
@@ -0,0 +1,58 @@
Upstream-Status: Pending [Not submitted to upstream yet]
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
From 524c865ae37f9cb9278988120e508c5314c2cd73 Mon Sep 17 00:00:00 2001
From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
Date: Wed, 17 Nov 2021 15:28:53 +0000
Subject: [PATCH 07/10] corstone1000: Disable set/get of NV variables
This is a temporary change which uses only the volatile memory
for get and set variable calls.
The non volatile storage access is via openAmp in se proxy which is still not
integrated to the system. So when an efi_set_variable_int() call is made for
NV variables, mm_commmunicate results in failure. This change will direct
PlatformLang and OsIndications to volatile memory which would be a
temporary solution.
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
%% original patch: 0026-Disable-set-get-of-NV-variables.patch
%% original patch: 0026-Disable-set-get-of-NV-variables.patch
---
lib/efi_loader/efi_setup.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index 9e3399a28c..fcf2eae9cd 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -83,7 +83,11 @@ static efi_status_t efi_init_platform_lang(void)
ret = efi_set_variable_int(L"PlatformLang",
&efi_global_variable_guid,
- EFI_VARIABLE_NON_VOLATILE |
+ /*
+ * This is a temporary change until NV memory is accessible
+ * through OpenAmp.
+ */
+ //EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
1 + strlen(lang), lang, false);
@@ -210,7 +214,11 @@ static efi_status_t efi_clear_os_indications(void)
os_indications &=
~EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED;
ret = efi_set_variable_int(L"OsIndications", &efi_global_variable_guid,
- EFI_VARIABLE_NON_VOLATILE |
+ /*
+ * This is a temporary change until NV memory is accessible
+ * through OpenAmp.
+ */
+ //EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(os_indications), &os_indications,
--
2.17.1
@@ -0,0 +1,45 @@
Upstream-Status: Pending [Not submitted to upstream yet]
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
From 5d53e40021d7fca594bb86307b0851a958047b6b Mon Sep 17 00:00:00 2001
From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
Date: Thu, 18 Nov 2021 16:42:59 +0000
Subject: [PATCH 08/10] corstone1000: Make sure shared buffer contents are not
cached
After updating the shared buffer, it is required to flush the cache
to ensure that the secure world sees expected the shared buffer
contents.
The MM communication shared buffer is configured in device region of optee
which has cache disabled. So we need to invalidate the cache every time we
update the buffer on uboot otherwise the secure world does not see the
accurate values.
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
%% original patch: 0027-Make-sure-shared-buffer-contents-are-not-cached.patch
%% original patch: 0027-Make-sure-shared-buffer-contents-are-not-cached.patch
---
lib/efi_loader/efi_variable_tee.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c
index b363ec92bf..9375aa6a63 100644
--- a/lib/efi_loader/efi_variable_tee.c
+++ b/lib/efi_loader/efi_variable_tee.c
@@ -331,6 +331,11 @@ static efi_status_t __efi_runtime ffa_mm_communicate(void *comm_buf, ulong comm_
virt_shared_buf = (void *)map_sysmem((phys_addr_t)FFA_SHARED_MM_BUFFER_ADDR, 0);
efi_memcpy_runtime(virt_shared_buf, comm_buf, tx_data_size);
+ /* The secure world has cache disabled for device region which we use for shared buffer
+ So, the secure world reads the data from DDR. Let's flush the cache so the DDR is
+ updated with the latest data */
+ invalidate_dcache_all();
+
/* Announce there is data in the shared buffer */
ffa_ret = ffa_notify_mm_sp();
--
2.17.1
@@ -34,6 +34,9 @@ SRC_URI:append:corstone1000 = " \
file://0022-arm_ffa-corstone1000-enable-FF-A-and-MM-support.patch \
file://0023-efi-corstone1000-introduce-EFI-capsule-update.patch \
file://0024-corstone1000-adjust-the-environment-and-heap-sizes.patch \
file://0025-corstone1000-Update-FFA-shared-buffer-address.patch \
file://0026-corstone1000-Disable-set-get-of-NV-variables.patch \
file://0027-corstone1000-Make-sure-shared-buffer-contents-are-no.patch \
"
#