MLK-21420 crypto: fsl: blob: Flush dcache range for destination address
authorBreno Lima <breno.lima@nxp.com>
Tue, 9 Apr 2019 02:48:11 +0000 (23:48 -0300)
committerYe Li <ye.li@nxp.com>
Wed, 28 Apr 2021 20:49:33 +0000 (13:49 -0700)
The blob command is not working on i.MX7D, i.MX8MQ and i.MX8MM
devices.

Due to different cache management it's necessary to flush dcache
range for destination address so data can be available in memory.

Add necessary operations in blob_encap() and blob_decap() functions.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 639e5c15816c3eea0d4904a72ad175627be043d8)
(cherry picked from commit ec828953801ee64c4def8133fd5b3d199a65bc92)
(cherry picked from commit 92c0340211b3723dbe3bf7450be7ccb996005358)

drivers/crypto/fsl/fsl_blob.c

index d6bd861..e8202cc 100644 (file)
@@ -65,6 +65,9 @@ int blob_decap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
        flush_dcache_range((unsigned long)desc,
                           (unsigned long)desc + size);
 
+       flush_dcache_range((unsigned long)dst,
+                          (unsigned long)dst + size);
+
        ret = run_descriptor_jr(desc);
 
        if (ret) {
@@ -130,6 +133,9 @@ int blob_encap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
        flush_dcache_range((unsigned long)desc,
                           (unsigned long)desc + size);
 
+       flush_dcache_range((unsigned long)dst,
+                          (unsigned long)dst + size);
+
        ret = run_descriptor_jr(desc);
 
        if (ret) {