GateMP: Add cache operation to make sure the SR0 contents are synced up
authorSam Nelson <sam.nelson@ti.com>
Fri, 15 Dec 2017 18:36:40 +0000 (13:36 -0500)
committerAngela Stegmaier <angelabaker@ti.com>
Thu, 21 Dec 2017 18:59:25 +0000 (12:59 -0600)
Before opening the shared region, make sure the cache is
invalidated. Even though the memory was not accessed before, because of
speculative execution the memory may be in the cache line already.

Signed-off-by: Sam Nelson <sam.nelson@ti.com>
packages/ti/sdo/ipc/GateMP.c

index fd7a91e0804531f3f9a0fa4ed9d43dc5522419dc..41739bba37507bad1c9392870edf018d7773535d 100644 (file)
@@ -872,6 +872,13 @@ Int ti_sdo_ipc_GateMP_attach(UInt16 remoteProcId, Ptr sharedAddr)
 
     if ((entry.ownerProcId != MultiProc_self()) &&
         (entry.ownerProcId != MultiProc_INVALIDID)) {
+
+        /* Make sure to invalidate cache before using shared memory content */
+        if (entry.cacheEnable) {
+            Cache_inv(sharedAddr, ti_sdo_ipc_GateMP_getRegion0ReservedSize(),
+                      Cache_Type_ALL, TRUE);
+        }
+
         /* if not the owner of the SharedRegion */
         ti_sdo_ipc_GateMP_openRegion0Reserved(sharedAddr);