]> git.ipfire.org Git - thirdparty/linux.git/commit
printk: nbcon: Add callbacks to synchronize with driver
authorJohn Ogness <john.ogness@linutronix.de>
Tue, 20 Aug 2024 06:29:34 +0000 (08:35 +0206)
committerPetr Mladek <pmladek@suse.com>
Wed, 21 Aug 2024 12:56:23 +0000 (14:56 +0200)
commit7a16a771890746b4060333d665ebe674945a3cfa
treea2fc71cc4bfecb895250c830b637f34b34915f17
parent7d56936c1e5208b5eeea2a9a2f70e85248f6da49
printk: nbcon: Add callbacks to synchronize with driver

Console drivers typically must deal with access to the hardware
via user input/output (such as an interactive login shell) and
output of kernel messages via printk() calls. To provide the
necessary synchronization, usually some driver-specific locking
mechanism is used (for example, the port spinlock for uart
serial consoles).

Until now, usage of this driver-specific locking has been hidden
from the printk-subsystem and implemented within the various
console callbacks. However, nbcon consoles would need to use it
even in the generic code.

Add device_lock() and device_unlock() callback which will need
to get implemented by nbcon consoles.

The callbacks will use whatever synchronization mechanism the
driver is using for itself. The minimum requirement is to
prevent CPU migration. It would allow a context friendly
acquiring of nbcon console ownership in non-emergency and
non-panic context.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240820063001.36405-9-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
include/linux/console.h