From: Ye Li <[email protected]>

After SPL dcache is enabled on iMX95/94/952, verify image in
authentication meets failure. There are two root causes:
1. Driver read APIs won't flush the image data from dcache to memory,
   such like: USB SDP, ROM API, SPL NOR, etc.
2. iMX95/94/952 uses trampoline buffer to destination address in
   secure memory. This buffer is not flushed.

Flush the image address before verify image to fix the issue

Signed-off-by: Ye Li <[email protected]>
---
 common/spl/spl_imx_container.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/spl/spl_imx_container.c b/common/spl/spl_imx_container.c
index 57cd75b9b5e..dee0c9006d6 100644
--- a/common/spl/spl_imx_container.c
+++ b/common/spl/spl_imx_container.c
@@ -10,6 +10,7 @@
 #include <log.h>
 #include <mapmem.h>
 #include <spl.h>
+#include <cpu_func.h>
 #ifdef CONFIG_AHAB_BOOT
 #include <asm/mach-imx/ahab.h>
 #endif
@@ -77,6 +78,7 @@ static struct boot_img_t *read_auth_image(struct 
spl_image_info *spl_image,
        }
 
 #ifdef CONFIG_AHAB_BOOT
+       flush_dcache_range((ulong)buf, (ulong)(buf + images[image_index].size - 
1));
        if (ahab_verify_cntr_image(&images[image_index], image_index))
                return NULL;
 #endif
-- 
2.50.1

Reply via email to