aboutsummaryrefslogtreecommitdiff
path: root/kernel/ethosu_mailbox.h
diff options
context:
space:
mode:
authorMikael Olsson <mikael.olsson@arm.com>2023-08-23 11:02:47 +0200
committerMikael Olsson <mikael.olsson@arm.com>2023-09-07 10:42:37 +0200
commit6fb238f4a2fe1592275449c419b5140c9eb9dd49 (patch)
tree4da0e3915fcd952e9f871238d43408049ae873e3 /kernel/ethosu_mailbox.h
parent18257600f30afb78f4f82cd921073cef98f5ce81 (diff)
downloadethos-u-linux-driver-stack-6fb238f4a2fe1592275449c419b5140c9eb9dd49.tar.gz
Fix wait for TX buffer blocking receive callback
Currently, the mailbox uses the rpmsg_send function to send messages, which will block for up to 15 seconds if there is no TX buffer available for the message. This is an issue because the device mutex is locked while waiting and the receive callback for messages uses the same mutex to prevent concurrent access so no received messages can be handled while waiting for a TX buffer. To resolve this, the mailbox has been changed to use the rpmsg_trysend function, which will return directly if there is no TX buffer available, together with a wait queue. While waiting in the queue to send the message, the device mutex is released to not block the receive callback and other users of the mutex. Change-Id: I34fbfd21167b49fb83744ab2473ab02632a809ee Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Diffstat (limited to 'kernel/ethosu_mailbox.h')
-rw-r--r--kernel/ethosu_mailbox.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/ethosu_mailbox.h b/kernel/ethosu_mailbox.h
index a3e2c14..c4c71a9 100644
--- a/kernel/ethosu_mailbox.h
+++ b/kernel/ethosu_mailbox.h
@@ -28,7 +28,7 @@
#include <linux/types.h>
#include <linux/mailbox_client.h>
-#include <linux/workqueue.h>
+#include <linux/wait.h>
#include <linux/idr.h>
/****************************************************************************
@@ -48,6 +48,8 @@ struct ethosu_mailbox {
struct device *dev;
struct rpmsg_endpoint *ept;
struct idr msg_idr;
+ atomic_t done;
+ wait_queue_head_t send_queue;
};
/**