Shared memory cache management
authorJohn Godbey <j-godbey@ti.com>
Wed, 27 Apr 2016 15:52:03 +0000 (11:52 -0400)
committerAngela Stegmaier <angelabaker@ti.com>
Wed, 27 Apr 2016 15:56:03 +0000 (10:56 -0500)
Additional cache invalidates are needed to ensure all data remains fresh.

Signed-off-by: John Godbey <j-godbey@ti.com>
packages/ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.c
packages/ti/sdo/ipc/transports/TransportShmNotify.c

index 980ce50db33b725177a3a736394b5ae3e9a6a8fc..26d1c42c79752950e4fa96fb40bdb2e25ff677ac 100644 (file)
@@ -530,6 +530,11 @@ Void NotifyDriverCirc_isr(UArg arg)
                   obj->opCacheSize,
                   Cache_Type_ALL,
                   FALSE);
+        /* Reading new data instead of pulling old data from cache */
+        Cache_inv(obj->getWriteIndex,
+                  sizeof(obj->getWriteIndex),
+                  Cache_Type_ALL,
+                  FALSE);
     }
 
     /* Clear the remote interrupt */
index 78b53eaee608c46c87ce8a79d37255c78bbed10a..95a16e6746c16f40426566c431d86a11e7b604e3 100644 (file)
@@ -70,9 +70,25 @@ Void TransportShmNotify_notifyFxn(UInt16 procId,
 {
     UInt32 queueId;
     MessageQ_Msg msg;
+    UInt16 regionId;
 
     msg = SharedRegion_getPtr((SharedRegion_SRPtr)payload);
 
+    /* Read new data into memory instead of old data from cache */
+    regionId = SharedRegion_getId(msg);
+    if (SharedRegion_isCacheEnabled(regionId)) {
+        /* invalidate header before reading header */
+        Cache_inv(msg,
+                  sizeof(MessageQ_MsgHeader),
+                  Cache_Type_ALL,
+                  TRUE);
+        /* invalidate the rest of the message */
+        Cache_inv(((char *)msg) + sizeof(MessageQ_MsgHeader),
+                  msg->msgSize - sizeof(MessageQ_MsgHeader),
+                  Cache_Type_ALL,
+                  TRUE);
+    }
+
     queueId = MessageQ_getDstQueue(msg);
 
     MessageQ_put(queueId, msg);