Nova and staging Rust abstractions
Danilo Krummrich
dakr at redhat.com
Wed Mar 20 17:58:43 UTC 2024
Hi all,
In this mail I briefly want to announce the Nova project and subsequently talk about the first
efforts taken in order to upstream required Rust abstractions:
We just started to work on Nova, a Rust-based GSP-only driver for Nvidia GPUs. Nova, in the long
term, is intended to serve as the successor of Nouveau for GSP-firmware-based GPUs.
With Nova we see the chance to significantly decrease the complexity of the driver compared to
Nouveau for mainly two reasons. First, Nouveau's historic architecture, especially around nvif/nvkm,
is rather complicated and inflexible and requires major rework to solve certain problems (such as
locking hierarchy in VMM / MMU code for VM_BIND currently being solved with a workaround) and
second, with a GSP-only driver there is no need to maintain compatibility with pre-GSP code.
Besides that, we also want to take the chance to contribute to the Rust efforts in the kernel and
benefit from from more memory safety offered by the Rust programming language. Ideally, all that
leads to better maintainability and a driver that makes it easy for people to get involved into this
project.
With the choice of Rust the first problem to deal with are missing C binding abstractions for
integral kernel infrastructure (e.g. device / driver abstractions). Since this is a bit of a chicken
and egg problem - we need a user to upstream abstractions, but we also need the abstractions to
create a driver - we want to develop Nova upstream and start with just a driver stub that only makes
use of some basic Rust abstractions.
In particular, we want to start with basic device / driver, DRM and PCI abstractions and a Nova stub
driver making use of them.
Fortunately, a lot of those abstractions did already exist in various downstream trees (big thanks
to all the authors). We started picking up existing work, figured out the dependencies, fixed a few
issues and warnings and applied some structure by organizing it in the following branches.
Remotes: drm-misc [1], rust (Rust-for-Linux) [2], nova [3]
- drm-misc/topic/rust-drm: [4] contains basic DRM abstractions, e.g. DRM device, GEM; depends on
rust-device
- rust/staging/rust-device: [5] contains all common device / driver abstractions
- rust/staging/rust-pci: [6] contains basic PCI abstractions, e.g. PCI device, but also other
dependencies such as IoMem and Ressources; depends on rust-device
- rust/staging/dev: [7] integration branch for all staging Rust abstractions
- nova/stub/nova: [8] the nova stub driver; depends on rust-drm and rust-pci
All branches and commits are functional, but the code and commit messages are not yet in a state for
sending actual patch series. While we are working on improving those patches we would like to ask
for feedback and / or improvements already.
@Greg, can you please have a first quick look at rust-device [5]?
- Danilo
[1] https://cgit.freedesktop.org/drm/drm-misc
[2] https://github.com/Rust-for-Linux/linux
[3] https://gitlab.freedesktop.org/drm/nova
[4] https://cgit.freedesktop.org/drm/drm-misc/log/?h=topic/rust-drm
[5] https://github.com/Rust-for-Linux/linux/tree/staging/rust-device
[6] https://github.com/Rust-for-Linux/linux/tree/staging/rust-pci
[7] https://github.com/Rust-for-Linux/linux/tree/staging/dev
[8] https://gitlab.freedesktop.org/drm/nova/-/tree/stub/nova
More information about the dri-devel
mailing list