mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 08:58:07 +00:00
d2a2262e68
A new console flushing firmware API was introduced to replace event
polling loops, and implemented in opal-kmsg with affddff69c
("powerpc/powernv: Add a kmsg_dumper that flushes console output on
panic"), to flush the console in the panic path.
The OPAL console driver has other situations where interrupts are off
and it needs to flush the console synchronously. These still use a
polling loop.
So move the opal-kmsg flush code to opal_flush_console, and use the
new function in opal-kmsg and opal_put_chars.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
51 lines
1.5 KiB
C
51 lines
1.5 KiB
C
/*
|
|
* kmsg dumper that ensures the OPAL console fully flushes panic messages
|
|
*
|
|
* Author: Russell Currey <ruscur@russell.cc>
|
|
*
|
|
* Copyright 2015 IBM Corporation.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*/
|
|
|
|
#include <linux/kmsg_dump.h>
|
|
|
|
#include <asm/opal.h>
|
|
#include <asm/opal-api.h>
|
|
|
|
/*
|
|
* Console output is controlled by OPAL firmware. The kernel regularly calls
|
|
* OPAL_POLL_EVENTS, which flushes some console output. In a panic state,
|
|
* however, the kernel no longer calls OPAL_POLL_EVENTS and the panic message
|
|
* may not be completely printed. This function does not actually dump the
|
|
* message, it just ensures that OPAL completely flushes the console buffer.
|
|
*/
|
|
static void kmsg_dump_opal_console_flush(struct kmsg_dumper *dumper,
|
|
enum kmsg_dump_reason reason)
|
|
{
|
|
/*
|
|
* Outside of a panic context the pollers will continue to run,
|
|
* so we don't need to do any special flushing.
|
|
*/
|
|
if (reason != KMSG_DUMP_PANIC)
|
|
return;
|
|
|
|
opal_flush_console(0);
|
|
}
|
|
|
|
static struct kmsg_dumper opal_kmsg_dumper = {
|
|
.dump = kmsg_dump_opal_console_flush
|
|
};
|
|
|
|
void __init opal_kmsg_init(void)
|
|
{
|
|
int rc;
|
|
|
|
/* Add our dumper to the list */
|
|
rc = kmsg_dump_register(&opal_kmsg_dumper);
|
|
if (rc != 0)
|
|
pr_err("opal: kmsg_dump_register failed; returned %d\n", rc);
|
|
}
|