[PATCH RFC 0/3] rust: tty: introduce TTY subsystem abstractions and rttyprintk

SeungJong Ha via B4 Relay posted 3 patches 1 week, 4 days ago
drivers/char/Kconfig            |  13 ++
drivers/char/Makefile           |   1 +
drivers/char/rttyprintk.rs      | 180 +++++++++++++++
rust/bindings/bindings_helper.h |   3 +
rust/kernel/lib.rs              |   2 +
rust/kernel/tty.rs              | 173 +++++++++++++++
rust/kernel/tty/driver.rs       | 478 ++++++++++++++++++++++++++++++++++++++++
rust/kernel/tty/port.rs         | 148 +++++++++++++
8 files changed, 998 insertions(+)
[PATCH RFC 0/3] rust: tty: introduce TTY subsystem abstractions and rttyprintk
Posted by SeungJong Ha via B4 Relay 1 week, 4 days ago
Hello,

This RFC patch series introduces Rust abstractions for the
TTY subsystem and implements a sample driver, rttyprintk.

Currently, TTY abstractions are missing in the
Rust for Linux implementation. This series aims to fill that gap.

It consists of two main parts:
- Rust TTY abstractions
- The rttyprintk driver
rttyprintk serves as the first example of a Rust TTY driver.
I chose to port ttyprintk because its simplicity makes it and 
ideal candidate for validating the new abstractions and demonstrating
their usage.

Thank you!

Signed-off-by: SeungJong Ha <engineer.jjhama@gmail.com>
---
SeungJong Ha (3):
      rust: bindings: add TTY subsystem headers
      rust: tty: add TTY subsystem abstractions
      char: rttyprintk: add Rust TTY printk driver

 drivers/char/Kconfig            |  13 ++
 drivers/char/Makefile           |   1 +
 drivers/char/rttyprintk.rs      | 180 +++++++++++++++
 rust/bindings/bindings_helper.h |   3 +
 rust/kernel/lib.rs              |   2 +
 rust/kernel/tty.rs              | 173 +++++++++++++++
 rust/kernel/tty/driver.rs       | 478 ++++++++++++++++++++++++++++++++++++++++
 rust/kernel/tty/port.rs         | 148 +++++++++++++
 8 files changed, 998 insertions(+)
---
base-commit: e741e19d7691c5e6f5c2bbff980d835dccb86054
change-id: 20260126-rust-tty-printk-driver-ccdca3263d61

Best regards,
-- 
SeungJong Ha <engineer.jjhama@gmail.com>
Re: [PATCH RFC 0/3] rust: tty: introduce TTY subsystem abstractions and rttyprintk
Posted by Greg Kroah-Hartman 1 week, 4 days ago
On Mon, Jan 26, 2026 at 12:22:07PM +0000, SeungJong Ha via B4 Relay wrote:
> Hello,
> 
> This RFC patch series introduces Rust abstractions for the
> TTY subsystem and implements a sample driver, rttyprintk.
> 
> Currently, TTY abstractions are missing in the
> Rust for Linux implementation. This series aims to fill that gap.
> 
> It consists of two main parts:
> - Rust TTY abstractions

What type of new tty driver are you writing that you need these
bindings?  The need for new tty drivers is quite low based on the lack
of new ones being added to the tree anymore.  Are you sure you just
don't want a serial port driver instead?

> - The rttyprintk driver
> rttyprintk serves as the first example of a Rust TTY driver.
> I chose to port ttyprintk because its simplicity makes it and 
> ideal candidate for validating the new abstractions and demonstrating
> their usage.

I would want to see a real need for this before going any further.  It's
great that you created these bindings, but without a need, I don't see
why this should even be reviewed.

thanks,

greg k-h
Re: [PATCH RFC 0/3] rust: tty: introduce TTY subsystem abstractions and rttyprintk
Posted by 하승종 1 week, 4 days ago
2026년 1월 26일 (월) PM 9:48, Greg Kroah-Hartman <gregkh@linuxfoundation.org>님이 작성:
>
> On Mon, Jan 26, 2026 at 12:22:07PM +0000, SeungJong Ha via B4 Relay wrote:
> > Hello,
> >
> > This RFC patch series introduces Rust abstractions for the
> > TTY subsystem and implements a sample driver, rttyprintk.
> >
> > Currently, TTY abstractions are missing in the
> > Rust for Linux implementation. This series aims to fill that gap.
> >
> > It consists of two main parts:
> > - Rust TTY abstractions
>
> What type of new tty driver are you writing that you need these
> bindings?  The need for new tty drivers is quite low based on the lack
> of new ones being added to the tree anymore.  Are you sure you just
> don't want a serial port driver instead?
>

To answer your question directly: I do not have a plan to implement a specific
serial port driver at this moment.
My motivation for this patch series was simply to fill the missing TTY subsystem
gap in the Rust for Linux project. I believed that providing these abstractions
would be valuable as foundational infrastructure, enabling future developers to
write TTY-related drivers in Rust.

> > - The rttyprintk driver
> > rttyprintk serves as the first example of a Rust TTY driver.
> > I chose to port ttyprintk because its simplicity makes it and
> > ideal candidate for validating the new abstractions and demonstrating
> > their usage.
>
> I would want to see a real need for this before going any further.  It's
> great that you created these bindings, but without a need, I don't see
> why this should even be reviewed.
>
> thanks,
>
> greg k-h

I understand your concern about adding code without a "real need" or an
active user in the tree.

If you believe that these abstractions are premature or unnecessary without
a concrete driver implementation to back them up, I fully accept that decision.
In that case, I am content with leaving this work as a reference implementation
for those who might be interested in the future.

Thanks,

SeungJong Ha
Re: [PATCH RFC 0/3] rust: tty: introduce TTY subsystem abstractions and rttyprintk
Posted by Miguel Ojeda 1 week, 4 days ago
On Mon, Jan 26, 2026 at 2:13 PM 하승종 <engineer.jjhama@gmail.com> wrote:
>
> To answer your question directly: I do not have a plan to implement a specific
> serial port driver at this moment.
> My motivation for this patch series was simply to fill the missing TTY subsystem
> gap in the Rust for Linux project. I believed that providing these abstractions
> would be valuable as foundational infrastructure, enabling future developers to
> write TTY-related drivers in Rust.

Yeah, as Greg says, the kernel needs a user for new code.

In these two pages I explain a bit the usual rules involved and some
general guidelines on how to proceed with new abstractions:

  https://rust-for-linux.com/contributing#submitting-new-abstractions-and-modules
  https://rust-for-linux.com/rust-reference-drivers

I hope that helps, and thanks for contributing -- a reference
implementation is always good to have in the list :)

Cheers,
Miguel
Re: [PATCH RFC 0/3] rust: tty: introduce TTY subsystem abstractions and rttyprintk
Posted by 하승종 1 week, 4 days ago
2026년 1월 26일 (월) PM 10:25, Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>님이 작성:
>
> On Mon, Jan 26, 2026 at 2:13 PM 하승종 <engineer.jjhama@gmail.com> wrote:
> >
> > To answer your question directly: I do not have a plan to implement a specific
> > serial port driver at this moment.
> > My motivation for this patch series was simply to fill the missing TTY subsystem
> > gap in the Rust for Linux project. I believed that providing these abstractions
> > would be valuable as foundational infrastructure, enabling future developers to
> > write TTY-related drivers in Rust.
>
> Yeah, as Greg says, the kernel needs a user for new code.
>
> In these two pages I explain a bit the usual rules involved and some
> general guidelines on how to proceed with new abstractions:
>
>   https://rust-for-linux.com/contributing#submitting-new-abstractions-and-modules
>   https://rust-for-linux.com/rust-reference-drivers
>
> I hope that helps, and thanks for contributing -- a reference
> implementation is always good to have in the list :)
>
> Cheers,
> Miguel

Thanks for good comments!

I will make sure to read the guidelines carefully to align with the
community standards for
future contributions. I am glad that this series can serve as a
reference for others.

Best regards,

SeungJong Ha