| From 370422921b2a3f4f7b73ce5b08820c24e82bba19 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 13/24] 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 |
| |
| Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> |
| --- |
| lib/efi_loader/efi_variable_tee.c | 6 ++++++ |
| 1 file changed, 6 insertions(+) |
| |
| diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c |
| index 9cb8cfb9c779..b6be2b54a030 100644 |
| --- a/lib/efi_loader/efi_variable_tee.c |
| +++ b/lib/efi_loader/efi_variable_tee.c |
| @@ -22,6 +22,7 @@ |
| #if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT)) |
| |
| #include <arm_ffa_helper.h> |
| +#include <cpu_func.h> |
| #include <mapmem.h> |
| |
| /* MM return codes */ |
| @@ -335,6 +336,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.37.1 |
| |