diff options
author | Alex Iacobucci <alexiacobucci@google.com> | 2023-01-25 17:26:33 +0000 |
---|---|---|
committer | Alex Iacobucci <alexiacobucci@google.com> | 2023-02-13 20:11:48 +0000 |
commit | ae76dd71db076f350c6c62596c0aeb7853f17eb2 (patch) | |
tree | 2029cda3b01bae7be10916001b2fc025105da9b7 | |
parent | 26cd925f424feb0f7053e731f3139e7e73abb738 (diff) | |
download | aoc-ae76dd71db076f350c6c62596c0aeb7853f17eb2.tar.gz |
aoc: add support for backpressure notificationsandroid-t-qpr3-beta-2_r0.5android-t-qpr3-beta-2_r0.3android-t-qpr3-beta-1_r0.5android-gs-raviole-5.10-t-qpr3-beta-2android-gs-pantah-5.10-t-qpr3-beta-2android-gs-pantah-5.10-android13-qpr3-beta1
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.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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); |