If MBOX_TX_QUEUE_LEN number of kicks are pending, then no need to keep
doing more kicks because it will fail anyway. Preventing further kicks
is needed because it avoids printing false positive warning messages
from mailbox framework. Functionally nothing changes from RPMsg or
remoteproc point of view.

Signed-off-by: Tanmay Shah <[email protected]>
---

v2:
  - Use msg_slot_ro to know if single slot is available in msg queue or not.
 drivers/remoteproc/xlnx_r5_remoteproc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c 
b/drivers/remoteproc/xlnx_r5_remoteproc.c
index 0b7b173d0d26..d589f31f45b9 100644
--- a/drivers/remoteproc/xlnx_r5_remoteproc.c
+++ b/drivers/remoteproc/xlnx_r5_remoteproc.c
@@ -9,6 +9,7 @@
 #include <linux/firmware/xlnx-zynqmp.h>
 #include <linux/kernel.h>
 #include <linux/mailbox_client.h>
+#include <linux/mailbox_controller.h>
 #include <linux/mailbox/zynqmp-ipi-message.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
@@ -335,6 +336,10 @@ static void zynqmp_r5_rproc_kick(struct rproc *rproc, int 
vqid)
        if (!ipi)
                return;
 
+       /* Do not need new kick as already many kicks are pending. */
+       if (ipi->tx_chan->msg_slot_ro == 0)
+               return;
+
        mb_msg = (struct zynqmp_ipi_message *)ipi->tx_mc_buf;
        memcpy(mb_msg->data, &vqid, sizeof(vqid));
        mb_msg->len = sizeof(vqid);
-- 
2.34.1


Reply via email to