From 2e7bd41e4e8ab3d1efdabd9e263a2f7fe79bff8c Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 20 Nov 2023 10:14:59 +0000
Subject: [PATCH] otg change to host
---
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