mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/1] braille: nbcon: Fix Braille console for NBCON API
@ 2026-10-01  9:39 Petr Mladek
  2026-10-01  9:39 ` [PATCH v3 1/1] braille: nbcon: Allow to use a serial console with NBCON API as Braille console Petr Mladek
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Mladek @ 2026-10-01  9:39 UTC (permalink / raw)
  To: John Ogness
  Cc: Sergey Senozhatsky, Steven Rostedt, Marcos Paulo de Souza,
	Samuel Thibault, Greg Kroah-Hartman, Jiri Slaby,
	Ilpo Järvinen, Hugo Villeneuve, Fushuai Wang, Kees Cook,
	Stepan Ionichev, linux-serial, Manuel Lauss, linux-kernel,
	Petr Mladek

Hi,

this is v3 patch which tries to fix Braille console driver to work
with serial console drivers ported to NBCON API.

I played with the locking. And I came up with another look.
I tried to simulate the legacy locking using the NBCON API.

IMPORTANT: I believe that it should work even in PREEMPT_RT
  because it worked with the legacy serial console drivers
  there. I think that it works because:

    + con->device_lock() is using normal spin_lock, aka rt_spin_lock().
      It should be safe in the VT context even in IRQ context.

    + The VT code can be called from the legacy loop when the related
      ttyX is registered as a console. But the legacy loop is offloaded
      to a dedicated kthread in PREEMT_RT. So, it will never be called
      in a truly atomic context there, except for panic().


Changes against v2:

  + Use con->device_lock() for non-panic case. Try even an unsafe
    acquire in panic(). This simulates the legacy locking using
    NBCON API.

  + Return when the nbcon context can't be acquired in panic().
    The NBCON API is not ready to ignore the lock. Well, it
    should never happen in practice because the unsafe acquire...

  + Avoid the newline prepend logic in all serial consoles
    ported to NBCON API which have it. Add two APIs for
    checking whether either "con" or "wctxt" is in Braille
    mode.

  + Update commit message and comments in the code.


Changes against v1:

  + Merged into one patch. It is hard to explain nbcon_braille*()
    API without the user.

  + Reworked the locking, see the commit message for more details.

  + Fixed the check of CON_NBCON_ATOMIC_UNSAFE [Sashiko]

IMPORTANT: The solution is not safe in PREEMPT_RT. But it is better
	then nothing. We could either solve it in v3. Or we could
	fix it later.

[v1] https://lore.kernel.org/r/20260922072558.98854-1-pmladek@suse.com
[v2] https://lore.kernel.org/r/20260925141729.173943-2-pmladek@suse.com

Petr Mladek (1):
  braille: nbcon: Allow to use a serial console with NBCON API as
    Braille console

 .../accessibility/braille/braille_console.c   | 64 ++++++++++++++-
 drivers/tty/serial/8250/8250_port.c           |  5 +-
 drivers/tty/serial/amba-pl011.c               |  2 +-
 drivers/tty/serial/imx.c                      |  2 +-
 drivers/tty/serial/sifive.c                   |  2 +-
 include/linux/console.h                       | 15 ++++
 kernel/printk/nbcon.c                         | 78 +++++++++++++++++++
 7 files changed, 162 insertions(+), 6 deletions(-)

-- 
2.55.0


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

end of thread, other threads:[~2026-10-01 12:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01  9:39 [PATCH v3 0/1] braille: nbcon: Fix Braille console for NBCON API Petr Mladek
2026-10-01  9:39 ` [PATCH v3 1/1] braille: nbcon: Allow to use a serial console with NBCON API as Braille console Petr Mladek
2026-10-01 10:48   ` John Ogness
2026-10-01 12:01     ` Petr Mladek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®