linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages
@ 2016-01-13  1:04 Russell Currey
  2016-01-13  2:20 ` Andrew Donnellan
  2016-01-13 13:09 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Russell Currey @ 2016-01-13  1:04 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: stewart, Russell Currey

The recently added OPAL API call, OPAL_CONSOLE_FLUSH, originally took no
parameters and returned nothing.  The call was updated to accept the
terminal number to flush, and returned various values depending on the
state of the output buffer.

The prototype has been updated and its usage in the OPAL kmsg dumper has
been modified to support its new behaviour as an incremental flush.

Signed-off-by: Russell Currey <ruscur@russell.cc>
---
This patch should be applied on top of "powerpc/powernv: Add a kmsg_dumper
that flushes console output on panic", which was recently merged into
powerpc-next.
---
 arch/powerpc/include/asm/opal.h            | 2 +-
 arch/powerpc/platforms/powernv/opal-kmsg.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index a5fd407..07a99e6 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -35,7 +35,7 @@ int64_t opal_console_read(int64_t term_number, __be64 *length,
 			  uint8_t *buffer);
 int64_t opal_console_write_buffer_space(int64_t term_number,
 					__be64 *length);
-void opal_console_flush(void);
+int64_t opal_console_flush(int64_t term_number);
 int64_t opal_rtc_read(__be32 *year_month_day,
 		      __be64 *hour_minute_second_millisecond);
 int64_t opal_rtc_write(uint32_t year_month_day,
diff --git a/arch/powerpc/platforms/powernv/opal-kmsg.c b/arch/powerpc/platforms/powernv/opal-kmsg.c
index bd3b2ee..6f1214d 100644
--- a/arch/powerpc/platforms/powernv/opal-kmsg.c
+++ b/arch/powerpc/platforms/powernv/opal-kmsg.c
@@ -27,6 +27,7 @@ static void force_opal_console_flush(struct kmsg_dumper *dumper,
 				     enum kmsg_dump_reason reason)
 {
 	int i;
+	int64_t ret;
 
 	/*
 	 * Outside of a panic context the pollers will continue to run,
@@ -36,7 +37,13 @@ static void force_opal_console_flush(struct kmsg_dumper *dumper,
 		return;
 
 	if (opal_check_token(OPAL_CONSOLE_FLUSH)) {
-		opal_console_flush();
+		ret = opal_console_flush(0);
+
+		if (ret == OPAL_UNSUPPORTED || ret == OPAL_PARAMETER)
+			return;
+
+		/* Incrementally flush until there's nothing left */
+		while (opal_console_flush(0) != OPAL_SUCCESS);
 	} else {
 		/*
 		 * If OPAL_CONSOLE_FLUSH is not implemented in the firmware,
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages
  2016-01-13  1:04 [PATCH] powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages Russell Currey
@ 2016-01-13  2:20 ` Andrew Donnellan
  2016-01-13 13:09 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Donnellan @ 2016-01-13  2:20 UTC (permalink / raw)
  To: Russell Currey, linuxppc-dev; +Cc: stewart

On 13/01/16 12:04, Russell Currey wrote:
> The recently added OPAL API call, OPAL_CONSOLE_FLUSH, originally took no
> parameters and returned nothing.  The call was updated to accept the
> terminal number to flush, and returned various values depending on the
> state of the output buffer.
>
> The prototype has been updated and its usage in the OPAL kmsg dumper has
> been modified to support its new behaviour as an incremental flush.
>
> Signed-off-by: Russell Currey <ruscur@russell.cc>

Looks fine to me.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

-- 
Andrew Donnellan              Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)        IBM Australia Limited

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages
  2016-01-13  1:04 [PATCH] powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages Russell Currey
  2016-01-13  2:20 ` Andrew Donnellan
@ 2016-01-13 13:09 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2016-01-13 13:09 UTC (permalink / raw)
  To: Russell Currey, linuxppc-dev; +Cc: stewart

On Wed, 2016-13-01 at 01:04:32 UTC, Russell Currey wrote:
> The recently added OPAL API call, OPAL_CONSOLE_FLUSH, originally took no
> parameters and returned nothing.  The call was updated to accept the
> terminal number to flush, and returned various values depending on the
> state of the output buffer.
> 
> The prototype has been updated and its usage in the OPAL kmsg dumper has
> been modified to support its new behaviour as an incremental flush.
> 
> Signed-off-by: Russell Currey <ruscur@russell.cc>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/c88c5d43732a0356f99e5e4d1a

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-13 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-13  1:04 [PATCH] powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages Russell Currey
2016-01-13  2:20 ` Andrew Donnellan
2016-01-13 13:09 ` Michael Ellerman

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).