VAYU QNX: Prevent race condition when host is slow to clear interrupts from IPU
authorvwan@ti.com <vwan@ti.com>
Sat, 15 Feb 2014 01:33:27 +0000 (17:33 -0800)
committerChris Ring <cring@ti.com>
Wed, 19 Feb 2014 01:48:36 +0000 (17:48 -0800)
This commit prevents the same race condition that was fixed in commit id
feb7a8486ed537033c5aed5b170f52f758bddabe, this time for the IPUs as
the other commit only dealt with the DSP.

Signed-off-by: VW <vwan@ti.com>
packages/ti/sdo/ipc/family/vayu/InterruptIpu.c

index 899be76b2a9a9e1963cb378e7dd54ad0d292e3f4..615fd73e25068df66f732930399e5cef86a1fb83 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2014, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -467,9 +467,11 @@ Void InterruptIpu_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
         else {
             index = MBX_TABLE_IDX(MultiProc_self(), remoteProcId);
             key = Hwi_disable();
-            if (REG32(MAILBOX_STATUS(index)) == 0) {
-                REG32(MAILBOX_MESSAGE(index)) = arg;
+            while (REG32(MAILBOX_STATUS(index)) != 0) {
+                Hwi_restore(key);
+                key = Hwi_disable();
             }
+            REG32(MAILBOX_MESSAGE(index)) = arg;
             Hwi_restore(key);
         }
     }
@@ -488,9 +490,11 @@ Void InterruptIpu_intSend(UInt16 remoteProcId, IInterrupt_IntInfo *intInfo,
         else {
             index = MBX_TABLE_IDX(MultiProc_self(), remoteProcId);
             key = Hwi_disable();
-            if (REG32(MAILBOX_STATUS(index)) == 0) {
-                REG32(MAILBOX_MESSAGE(index)) = arg;
+            while (REG32(MAILBOX_STATUS(index)) != 0) {
+                Hwi_restore(key);
+                key = Hwi_disable();
             }
+            REG32(MAILBOX_MESSAGE(index)) = arg;
             Hwi_restore(key);
         }
     }