linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>, Russell Currey <ruscur@russell.cc>
Subject: [PATCH v2 9/9] powerpc/powernv: opal-kmsg standardise OPAL_BUSY handling
Date: Mon,  9 Apr 2018 15:24:31 +1000	[thread overview]
Message-ID: <20180409052431.26405-10-npiggin@gmail.com> (raw)
In-Reply-To: <20180409052431.26405-1-npiggin@gmail.com>

OPAL_CONSOLE_FLUSH is documented as being able to return OPAL_BUSY,
so implement the standard OPAL_BUSY handling for it.

Cc: Russell Currey <ruscur@russell.cc>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/platforms/powernv/opal-kmsg.c | 24 ++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal-kmsg.c b/arch/powerpc/platforms/powernv/opal-kmsg.c
index 6f1214d4de92..f8f41ccce75f 100644
--- a/arch/powerpc/platforms/powernv/opal-kmsg.c
+++ b/arch/powerpc/platforms/powernv/opal-kmsg.c
@@ -12,6 +12,7 @@
  */
 
 #include <linux/kmsg_dump.h>
+#include <linux/delay.h>
 
 #include <asm/opal.h>
 #include <asm/opal-api.h>
@@ -26,8 +27,7 @@
 static void force_opal_console_flush(struct kmsg_dumper *dumper,
 				     enum kmsg_dump_reason reason)
 {
-	int i;
-	int64_t ret;
+	s64 rc;
 
 	/*
 	 * Outside of a panic context the pollers will continue to run,
@@ -37,14 +37,22 @@ static void force_opal_console_flush(struct kmsg_dumper *dumper,
 		return;
 
 	if (opal_check_token(OPAL_CONSOLE_FLUSH)) {
-		ret = opal_console_flush(0);
+		do  {
+			rc = OPAL_BUSY;
+			while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
+				rc = opal_console_flush(0);
+				if (rc == OPAL_BUSY_EVENT) {
+					mdelay(OPAL_BUSY_DELAY_MS);
+					opal_poll_events(NULL);
+				} else if (rc == OPAL_BUSY) {
+					mdelay(OPAL_BUSY_DELAY_MS);
+				}
+			}
+		} while (rc == OPAL_PARTIAL); /* More to flush */
 
-		if (ret == OPAL_UNSUPPORTED || ret == OPAL_PARAMETER)
-			return;
-
-		/* Incrementally flush until there's nothing left */
-		while (opal_console_flush(0) != OPAL_SUCCESS);
 	} else {
+		int i;
+
 		/*
 		 * If OPAL_CONSOLE_FLUSH is not implemented in the firmware,
 		 * the console can still be flushed by calling the polling
-- 
2.17.0

  parent reply	other threads:[~2018-04-09  5:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-09  5:24 [PATCH v2 0/9] first step of standardising OPAL_BUSY handling Nicholas Piggin
2018-04-09  5:24 ` [PATCH v2 1/9] powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops Nicholas Piggin
2018-04-09  5:24 ` [PATCH v2 2/9] powerpc/powernv: OPAL RTC driver standardise OPAL_BUSY loops Nicholas Piggin
2018-04-09  5:24 ` [PATCH v2 3/9] powerpc/powernv: opal_put_chars partial write fix Nicholas Piggin
2018-04-09  5:50   ` Benjamin Herrenschmidt
2018-04-09  5:24 ` [PATCH v2 4/9] powerpc/powernv: OPAL console standardise OPAL_BUSY loops Nicholas Piggin
2018-04-09  5:53   ` Benjamin Herrenschmidt
2018-04-09  6:13     ` Nicholas Piggin
2018-04-09  8:22       ` Benjamin Herrenschmidt
2018-04-09  5:24 ` [PATCH v2 5/9] powerpc/powernv: OPAL platform " Nicholas Piggin
2018-04-09  5:24 ` [PATCH v2 6/9] powerpc/powernv: OPAL NVRAM driver standardise OPAL_BUSY delays Nicholas Piggin
2018-04-09  5:24 ` [PATCH v2 7/9] powerpc/powernv: OPAL dump support " Nicholas Piggin
2018-04-09  5:24 ` [PATCH v2 8/9] powerpc/xive: " Nicholas Piggin
2018-04-09  5:24 ` Nicholas Piggin [this message]
2018-04-10  5:01   ` [PATCH v2 9/9] powerpc/powernv: opal-kmsg standardise OPAL_BUSY handling Russell Currey

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=20180409052431.26405-10-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=ruscur@russell.cc \
    /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;
as well as URLs for NNTP newsgroup(s).