Files
build/patch/kernel/archive/sunxi-5.18/patches.megous/mailbox-Allow-to-run-mailbox-while-timekeeping-is-suspended.patch
The-going 25e60a726b Sunxi 5.18 (#3879)
* sunxi-5.18: rebase megous patces to v5.18.3

* sunxi-5.18: Add upstream patches - tag: orange-pi-5.18-20220609-1318

* Check applicability to version 5.18.3

* sunxi-5.18: switch to version 5.18.3
2022-06-10 21:50:37 +02:00

61 lines
1.7 KiB
Diff

From b3f88f8519b919d6117860401dfb8a9b5a27dc4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sat, 2 Nov 2019 15:09:01 +0100
Subject: [PATCH 022/515] mailbox: Allow to run mailbox while timekeeping is
suspended
This makes it possible to send messages from CPU suspend finisher.
We simply implement cl->tx_block using a busywait loop when
timekeeping is suspended, instead of using hrtimer.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/mailbox/mailbox.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 3e7d4b20ab34..82ca7c317700 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -85,7 +85,10 @@ static void msg_submit(struct mbox_chan *chan)
if (!err && (chan->txdone_method & TXDONE_BY_POLL)) {
/* kick start the timer immediately to avoid delays */
spin_lock_irqsave(&chan->mbox->poll_hrt_lock, flags);
- hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
+ if (!timekeeping_suspended) {
+ /* but only if not already active */
+ hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
+ }
spin_unlock_irqrestore(&chan->mbox->poll_hrt_lock, flags);
}
}
@@ -268,6 +271,24 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)
msg_submit(chan);
+ if (chan->cl->tx_block && timekeeping_suspended) {
+ int i = chan->cl->tx_tout * 10;
+ bool txdone;
+
+ while (i--) {
+ txdone = chan->mbox->ops->last_tx_done(chan);
+ if (txdone) {
+ tx_tick(chan, 0);
+ return 0;
+ }
+
+ udelay(100);
+ }
+
+ tx_tick(chan, -ETIME);
+ return -ETIME;
+ }
+
if (chan->cl->tx_block) {
unsigned long wait;
int ret;
--
2.35.3