mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Beleswar Padhi <b-padhi@ti.com>
To: <jassisinghbrar@gmail.com>, <linux-kernel@vger.kernel.org>
Cc: <hiagofranco@gmail.com>, <afd@ti.com>, <hnagalla@ti.com>,
	<u-kumar1@ti.com>, <b-padhi@ti.com>
Subject: [RFC PATCH] mailbox: omap-mailbox: Flush out pending msgs before entering suspend
Date: Wed, 22 Oct 2025 15:50:15 +0530	[thread overview]
Message-ID: <20251022102015.1345696-1-b-padhi@ti.com> (raw)

There may be pending messages in the mailbox FIFO that are not consumed
by the remote processor for various reasons; the remote processor may
already be powered off or may be in a bad state. Instead of aborting
suspend because of these pending messages, flush the FIFOs and proceed
with suspend. Pending messages could also be restored in the resume
context, but since remote processors are typically rebooted during
suspend/resume today, there is no point in restoring stale messages.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
 drivers/mailbox/omap-mailbox.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c
index 680243751d62..5e6373911630 100644
--- a/drivers/mailbox/omap-mailbox.c
+++ b/drivers/mailbox/omap-mailbox.c
@@ -341,13 +341,10 @@ static int omap_mbox_suspend(struct device *dev)
 	if (pm_runtime_status_suspended(dev))
 		return 0;
 
-	for (fifo = 0; fifo < mdev->num_fifos; fifo++) {
-		if (mbox_read_reg(mdev, MAILBOX_MSGSTATUS(fifo))) {
-			dev_err(mdev->dev, "fifo %d has unexpected unread messages\n",
-				fifo);
-			return -EBUSY;
-		}
-	}
+	/* Flush out pending mbox messages before entering suspend */
+	for (fifo = 0; fifo < mdev->num_fifos; fifo++)
+		while (mbox_read_reg(mdev, MAILBOX_MSGSTATUS(fifo)) != 0)
+			mbox_read_reg(mdev, MAILBOX_MESSAGE(fifo));
 
 	for (usr = 0; usr < mdev->num_users; usr++) {
 		reg = MAILBOX_IRQENABLE(mdev->intr_type, usr);
-- 
2.34.1


             reply	other threads:[~2025-10-22 10:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 10:20 Beleswar Padhi [this message]
2025-10-22 13:45 ` Hiago De Franco
2025-10-22 16:07 ` Andrew Davis
2025-10-23  4:38   ` Beleswar Prasad Padhi
2025-10-23 17:18     ` Hari Nagalla
2025-10-24  4:48       ` Beleswar Prasad Padhi
2025-10-24 14:08         ` Andrew Davis
2025-10-30  8:59           ` Francesco Dolcini
2025-10-30  9:12             ` Beleswar Prasad Padhi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251022102015.1345696-1-b-padhi@ti.com \
    --to=b-padhi@ti.com \
    --cc=afd@ti.com \
    --cc=hiagofranco@gmail.com \
    --cc=hnagalla@ti.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u-kumar1@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®