From ea08eeccae9297f7aabd2ef7f0c2517ac4549acc Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Tue, 20 Feb 2024 01:18:26 +0000
Subject: [PATCH] write in 30M
---
u-boot/lib/optee_clientApi/OpteeClientInterface.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/u-boot/lib/optee_clientApi/OpteeClientInterface.c b/u-boot/lib/optee_clientApi/OpteeClientInterface.c
index c16a460..9f2022b 100644
--- a/u-boot/lib/optee_clientApi/OpteeClientInterface.c
+++ b/u-boot/lib/optee_clientApi/OpteeClientInterface.c
@@ -73,6 +73,20 @@
flush_cache(aligned_input, aligned_len);
}
+static void crypto_invalidate_cacheline(uint32_t addr, uint32_t size)
+{
+ ulong alignment = CONFIG_SYS_CACHELINE_SIZE;
+ ulong aligned_input, aligned_len;
+
+ if (!addr || !size)
+ return;
+
+ /* Must invalidate dcache after crypto DMA write data region */
+ aligned_input = round_down(addr, alignment);
+ aligned_len = round_up(size + (addr - aligned_input), alignment);
+ invalidate_dcache_range(aligned_input, aligned_input + aligned_len);
+}
+
static uint32_t trusty_base_write_security_data(char *filename,
uint32_t filename_size,
uint8_t *data,
@@ -1014,6 +1028,8 @@
&TeecOperation,
&ErrorOrigin);
+ crypto_invalidate_cacheline(dst_phys_addr, len);
+
exit:
TEEC_ReleaseSharedMemory(&SharedMem_config);
TEEC_CloseSession(&TeecSession);
--
Gitblit v1.6.2