Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 2026 13:59:39 +0000
From:      Lorenzo Salvadore <salvadore@FreeBSD.org>
To:        doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org
Cc:        Ayrto=?utf-8?Q?n Mu=C3=B1o?=z <a.munoz3327@gmail.com>
Subject:   git: a27569e15a - main - Status/2025Q4/kernel_rust.adoc: Add report
Message-ID:  <6967a14b.46da3.26b5a189@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by salvadore:

URL: https://cgit.FreeBSD.org/doc/commit/?id=a27569e15a1f400e2913829fb0cae2b98642cc1e

commit a27569e15a1f400e2913829fb0cae2b98642cc1e
Author:     Ayrton Muñoz <a.munoz3327@gmail.com>
AuthorDate: 2026-01-10 12:48:49 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2026-01-14 13:59:18 +0000

    Status/2025Q4/kernel_rust.adoc: Add report
    
    Differential Revision:  https://reviews.freebsd.org/D54392
---
 .../status/report-2025-10-2025-12/kernel_rust.adoc | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/website/content/en/status/report-2025-10-2025-12/kernel_rust.adoc b/website/content/en/status/report-2025-10-2025-12/kernel_rust.adoc
new file mode 100644
index 0000000000..a186ad8831
--- /dev/null
+++ b/website/content/en/status/report-2025-10-2025-12/kernel_rust.adoc
@@ -0,0 +1,33 @@
+=== Kernel Rust Support
+
+Links: +
+link:https://github.com/ayrtonm/freebsd-kpi-rs[rust KPI repository] URL: link:https://github.com/ayrtonm/freebsd-kpi-rs[] +
+link:https://github.com/ayrtonm/freebsd-src/tree/virtio_snd[virtio sound rust driver] URL: link:https://github.com/ayrtonm/freebsd-src/tree/virtio_snd[]
+
+Contact: Ayrton Muñoz <a.munoz3327@gmail.com>
+
+I have been adding support for using rust in the kernel and writing device drivers with it.
+Rust is a good tool for taking existing rules about how pointers may be used and enforcing them with the type system.
+These rules are often implicit in C meaning additional mental bookkeeping for developers.
+Rust will not prevent every bug, but it lets developers avoid some of this and focus more on implementing the functionality they care about.
+
+The rust KPIs are currently under development and not very stable, but there is no dependency on the wider rust ecosystem or unstable language features/APIs.
+This means that they should eventually be able to provide as much stability as equivalent C KPIs and upgrading to newer rust toolchains should not introduce breakage.
+It also provides as much transparency as C about when allocations happen since it uses a non-allocating subset of the link:https://doc.rust-lang.org/core/[rust standard library].
+Different kernel subsystems will require rust wrappers, but these can build off of the base functionality provided in the rust KPI repository.
+
+I have been experimenting on and off with this since late 2024 and development mainly happens in my rust KPI repository.
+This repository also has makefiles and patches for man:config[8]/build system integration.
+The easiest driver for developers to build and try themselves is my link:https://github.com/ayrtonm/freebsd-src/tree/virtio_snd[virtio sound driver].
+Some interfaces it uses are in flux, but the driver is functional enough for music playback in link:https://www.qemu.org/docs/master/system/devices/virtio/virtio-snd.html[QEMU].
+That branch also includes rust wrappers that may be reused for other virtio devices or sound/PCM drivers.
+
+Only x86-64 and aarch64 are currently supported.
+Other architectures supported by LLVM can be added if there is interest, but I wanted to initially focus on just a few use-cases.
+Aside from QEMU I have also been testing rust drivers on hardware with some drivers for link:https://github.com/ayrtonm/freebsd-src/tree/apple[ARM64 Apple machines].
+This was the initial use-case and involves taking some WIP drivers I started helping with in 2024 and porting the greenfield parts to rust.
+This is mostly low-level drivers, but also includes the DockChannel HID driver for the keyboard on the M2 MacBook.
+
+At some point in early 2026 the rust KPIs should be stable enough for interested developers to try writing new code with them.
+They will not be perfect, but I want to make sure they work roughly like existing drivers expect and also fit the expectations of rust developers before asking for testers.
+Hopefully the Apple drivers will be back up to parity with the initial WIP in C in the first half of 2026 as well.


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6967a14b.46da3.26b5a189>