pkarashchenko commented on code in PR #10484:
URL: https://github.com/apache/nuttx/pull/10484#discussion_r1316002504


##########
arch/risc-v/src/mpfs/mpfs_ihc.c:
##########
@@ -717,18 +769,18 @@ static int mpfs_ihc_tx_message(ihc_channel_t channel, 
uint32_t *message)
           putreg32(message[i], MPFS_IHC_MSG_OUT(mhartid, rhartid) + i * 4);
         }
 
-      /* Set the MP bit. This will notify other of incoming hart message */
-
-      modifyreg32(MPFS_IHC_CTRL(mhartid, rhartid), 0, RMP_MESSAGE_PRESENT);
+      ctrl_reg = getreg32(MPFS_IHC_CTRL(mhartid, rhartid));
 
-      /* Wait for the ACK to arrive to maintain the logic */
+      /* If we're unlucky, we cannot send MP yet.. come back later */
 
-      if (mhartid == CONTEXTB_HARTID)
+      if (ctrl_reg & (MP_MESSAGE_PRESENT))

Review Comment:
   ```suggestion
         if ((ctrl_reg & MP_MESSAGE_PRESENT) != 0)
   ```
   or
   ```suggestion
         if (ctrl_reg & MP_MESSAGE_PRESENT)
   ```



##########
arch/risc-v/src/mpfs/mpfs_ihc.c:
##########
@@ -696,18 +752,14 @@ static int mpfs_ihc_tx_message(ihc_channel_t channel, 
uint32_t *message)
     {
       ctrl_reg = getreg32(MPFS_IHC_CTRL(mhartid, rhartid));
     }
-  while ((ctrl_reg & (RMP_MESSAGE_PRESENT | ACK_INT)) && --retries);
+  while ((ctrl_reg & (RMP_MESSAGE_PRESENT)) && --retries);

Review Comment:
   ```suggestion
     while ((ctrl_reg & RMP_MESSAGE_PRESENT) && --retries);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to