Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | From 370422921b2a3f4f7b73ce5b08820c24e82bba19 Mon Sep 17 00:00:00 2001 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 2 | From: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com> |
| 3 | Date: Thu, 18 Nov 2021 16:42:59 +0000 |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 4 | Subject: [PATCH 13/24] corstone1000: Make sure shared buffer contents are not |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 5 | cached |
| 6 | |
| 7 | After updating the shared buffer, it is required to flush the cache |
| 8 | to ensure that the secure world sees expected the shared buffer |
| 9 | contents. |
| 10 | |
| 11 | The MM communication shared buffer is configured in device region of optee |
| 12 | which has cache disabled. So we need to invalidate the cache every time we |
| 13 | update the buffer on uboot otherwise the secure world does not see the |
| 14 | accurate values. |
| 15 | |
| 16 | Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com> |
| 17 | %% original patch: 0027-Make-sure-shared-buffer-contents-are-not-cached.patch |
| 18 | |
| 19 | %% original patch: 0027-Make-sure-shared-buffer-contents-are-not-cached.patch |
| 20 | |
| 21 | Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> |
| 22 | --- |
| 23 | lib/efi_loader/efi_variable_tee.c | 6 ++++++ |
| 24 | 1 file changed, 6 insertions(+) |
| 25 | |
| 26 | diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c |
| 27 | index 9cb8cfb9c779..b6be2b54a030 100644 |
| 28 | --- a/lib/efi_loader/efi_variable_tee.c |
| 29 | +++ b/lib/efi_loader/efi_variable_tee.c |
| 30 | @@ -22,6 +22,7 @@ |
| 31 | #if (IS_ENABLED(CONFIG_ARM_FFA_TRANSPORT)) |
| 32 | |
| 33 | #include <arm_ffa_helper.h> |
| 34 | +#include <cpu_func.h> |
| 35 | #include <mapmem.h> |
| 36 | |
| 37 | /* MM return codes */ |
| 38 | @@ -335,6 +336,11 @@ static efi_status_t __efi_runtime ffa_mm_communicate(void *comm_buf, ulong comm_ |
| 39 | virt_shared_buf = (void *)map_sysmem((phys_addr_t)FFA_SHARED_MM_BUFFER_ADDR, 0); |
| 40 | efi_memcpy_runtime(virt_shared_buf, comm_buf, tx_data_size); |
| 41 | |
| 42 | + /* The secure world has cache disabled for device region which we use for shared buffer |
| 43 | + So, the secure world reads the data from DDR. Let's flush the cache so the DDR is |
| 44 | + updated with the latest data */ |
| 45 | + invalidate_dcache_all(); |
| 46 | + |
| 47 | /* Announce there is data in the shared buffer */ |
| 48 | |
| 49 | ffa_ret = ffa_notify_mm_sp(); |
| 50 | -- |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 51 | 2.37.1 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 52 | |