summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2020-11-30 03:36:02 +0300
committerMinda Chen <minda.chen@starfivetech.com>2023-11-06 14:24:37 +0300
commite87d635bbace7e3d37cae016a34cef8f490ed4ef (patch)
tree61f300bee0a14c08bbb5e902d127f93365ea27a6 /include
parentd485610e22d3db1cbd9c0391043a8fcfdbc3f945 (diff)
downloadlinux-e87d635bbace7e3d37cae016a34cef8f490ed4ef.tar.xz
serial: 8250: implement write_atomic
Implement a non-sleeping NMI-safe write_atomic() console function in order to support emergency console printing. Since interrupts need to be disabled during transmit, all usage of the IER register is wrapped with access functions that use the console_atomic_lock() function to synchronize register access while tracking the state of the interrupts. This is necessary because write_atomic() can be called from an NMI context that has preempted write_atomic(). Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/serial_8250.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 068ba67788bc..7cd20b5def9d 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -7,6 +7,7 @@
#ifndef _LINUX_SERIAL_8250_H
#define _LINUX_SERIAL_8250_H
+#include <linux/atomic.h>
#include <linux/serial_core.h>
#include <linux/serial_reg.h>
#include <linux/platform_device.h>
@@ -126,6 +127,8 @@ struct uart_8250_port {
#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
unsigned char msr_saved_flags;
+ atomic_t console_printing;
+
struct uart_8250_dma *dma;
const struct uart_8250_ops *ops;
@@ -181,6 +184,8 @@ void serial8250_init_port(struct uart_8250_port *up);
void serial8250_set_defaults(struct uart_8250_port *up);
void serial8250_console_write(struct uart_8250_port *up, const char *s,
unsigned int count);
+void serial8250_console_write_atomic(struct uart_8250_port *up, const char *s,
+ unsigned int count);
int serial8250_console_setup(struct uart_port *port, char *options, bool probe);
int serial8250_console_exit(struct uart_port *port);