[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877d2ayh2s.ffs@tglx>
Date: Sun, 11 Sep 2022 00:56:11 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: John Ogness <john.ogness@...utronix.de>,
Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...uxfoundation.org>,
Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Daniel Vetter <daniel@...ll.ch>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Helge Deller <deller@....de>,
Jason Wessel <jason.wessel@...driver.com>,
Daniel Thompson <daniel.thompson@...aro.org>
Subject: Re: [patch RFC 00/29] printk: A new approach - WIP
On Sun, Sep 11 2022 at 00:27, Thomas Gleixner wrote:
> For testing we used the most simple driver: a hacked up version of the
> early uart8250 console as we wanted to concentrate on validating the core
> mechanisms of friendly handover and hostile takeovers instead of dealing
> with the horrors of port locks or whatever at the same time. That's the
> next challenge. Hack patch will be provided in a reply.
Here you go.
---
Subject: serial: 8250: Use 8250 serial for exploring noBKL consoles
From: John Ogness <jogness@...utronix.de>
Date: Sat, 10 Sep 2022 01:05:34 +0200
From: John Ogness <jogness@...utronix.de>
Utilize 8250 early console - the only console in the kernel which is
reentrancy and NMI safe - to explore the noBKL console infrastructure.
Not-Signed-off-by: John Ogness <jogness@...utronix.de>
Not-Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
drivers/tty/serial/8250/8250_early.c | 32 ++++++++++++++++++++++++++++++++
drivers/tty/serial/8250/Kconfig | 11 ++++++++++-
drivers/tty/serial/8250/Makefile | 2 +-
3 files changed, 43 insertions(+), 2 deletions(-)
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -107,6 +107,34 @@ static void early_serial8250_write(struc
uart_console_write(port, s, count, serial_putc);
}
+static bool __early_serial8250_write(struct console *con, struct cons_write_context *wctxt,
+ unsigned char c)
+{
+ struct earlycon_device *device = con->data;
+ struct uart_port *port = &device->port;
+ unsigned char *s = wctxt->outbuf;
+
+ serial_putc(port, c);
+
+ for (; wctxt->pos < wctxt->len; wctxt->pos++, s++) {
+ if (!console_can_proceed(wctxt))
+ return false;
+
+ uart_console_write(port, s, 1, serial_putc);
+ }
+ return true;
+}
+
+static bool early_serial8250_write_thread(struct console *con, struct cons_write_context *wctxt)
+{
+ return __early_serial8250_write(con, wctxt, 'T');
+}
+
+static bool early_serial8250_write_atomic(struct console *con, struct cons_write_context *wctxt)
+{
+ return __early_serial8250_write(con, wctxt, 'A');
+}
+
#ifdef CONFIG_CONSOLE_POLL
static int early_serial8250_read(struct console *console,
char *s, unsigned int count)
@@ -170,6 +198,10 @@ int __init early_serial8250_setup(struct
device->con->write = early_serial8250_write;
device->con->read = early_serial8250_read;
+ device->con->flags &= ~CON_BOOT;
+ device->con->flags |= CON_NO_BKL;
+ device->con->write_thread = early_serial8250_write_thread;
+ device->con->write_atomic = early_serial8250_write_atomic;
return 0;
}
EARLYCON_DECLARE(uart8250, early_serial8250_setup);
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -82,9 +82,18 @@ config SERIAL_8250_FINTEK
If unsure, say N.
+config SERIAL_8250_CONSOLE_EARLY
+ bool "Console on 8250/16550 and compatible noBKL console mockup"
+ default SERIAL_8250
+ select SERIAL_CORE_CONSOLE
+ select SERIAL_EARLYCON
+ help
+ Mockup to demonstrate the core capabilities for noBKL consoles.
+ OTOH, the _only_ reliable reentrant and NMI safe console...
+
config SERIAL_8250_CONSOLE
bool "Console on 8250/16550 and compatible serial port"
- depends on SERIAL_8250=y
+ depends on SERIAL_8250=y && !SERIAL_8250_CONSOLE_EARLY
select SERIAL_CORE_CONSOLE
select SERIAL_EARLYCON
help
--- a/drivers/tty/serial/8250/Makefile
+++ b/drivers/tty/serial/8250/Makefile
@@ -20,7 +20,7 @@ obj-$(CONFIG_SERIAL_8250_CS) += serial_
obj-$(CONFIG_SERIAL_8250_ACORN) += 8250_acorn.o
obj-$(CONFIG_SERIAL_8250_ASPEED_VUART) += 8250_aspeed_vuart.o
obj-$(CONFIG_SERIAL_8250_BCM2835AUX) += 8250_bcm2835aux.o
-obj-$(CONFIG_SERIAL_8250_CONSOLE) += 8250_early.o
+obj-$(CONFIG_SERIAL_8250_CONSOLE_EARLY) += 8250_early.o
obj-$(CONFIG_SERIAL_8250_FOURPORT) += 8250_fourport.o
obj-$(CONFIG_SERIAL_8250_ACCENT) += 8250_accent.o
obj-$(CONFIG_SERIAL_8250_BOCA) += 8250_boca.o
Powered by blists - more mailing lists