summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Iacobucci <alexiacobucci@google.com>2023-01-25 17:26:33 +0000
committerAlex Iacobucci <alexiacobucci@google.com>2023-02-13 20:11:48 +0000
commitae76dd71db076f350c6c62596c0aeb7853f17eb2 (patch)
tree2029cda3b01bae7be10916001b2fc025105da9b7
parent26cd925f424feb0f7053e731f3139e7e73abb738 (diff)
downloadaoc-ae76dd71db076f350c6c62596c0aeb7853f17eb2.tar.gz
When we read from a channel that was previously full, the kernel signals AoC to let it know that there is now space available. Bug: 262291819 Test: manually tested on C10 Change-Id: I7b64f3ce078bed27b1f4154d1bf9a1ceaee5721f Signed-off-by: Alex Iacobucci <alexiacobucci@google.com>
-rw-r--r--aoc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/aoc.c b/aoc.c
index 4a4f5a5..a1b2560 100644
--- a/aoc.c
+++ b/aoc.c
@@ -123,7 +123,6 @@ static enum AOC_FW_STATE aoc_state;
static struct platform_device *aoc_platform_device;
-
struct mbox_slot {
struct mbox_client client;
struct mbox_chan *channel;
@@ -963,6 +962,8 @@ ssize_t aoc_service_read(struct aoc_service_dev *dev, uint8_t *buffer,
size_t msg_size;
int service_number;
int ret = 0;
+ bool was_full;
+ int interrupt = dev->mbox_index;
if (!dev || !buffer || !count)
return -EINVAL;
@@ -1014,9 +1015,18 @@ ssize_t aoc_service_read(struct aoc_service_dev *dev, uint8_t *buffer,
return -EFBIG;
msg_size = count;
+ was_full = !aoc_service_can_write_message(service, AOC_UP);
+
aoc_service_read_message(service, prvdata->ipc_base, AOC_UP, buffer,
&msg_size);
+ /*
+ * If the service queue was full right before reading, signal AoC that
+ * there is now space available to write.
+ */
+ if (was_full)
+ signal_aoc(prvdata->mbox_channels[interrupt].channel);
+
return msg_size;
}
EXPORT_SYMBOL_GPL(aoc_service_read);