|
1 | 1 | # Nova GPU Driver
|
2 | 2 |
|
3 |
| -Nova is a driver for GSP-based Nvidia GPUs that is currently under development |
4 |
| -and is being written in Rust. |
| 3 | +Nova is a driver for GSP (GPU system processor) based Nvidia GPUs. It is |
| 4 | +intended to become the successor of Nouveau as the mainline driver for Nvidia |
| 5 | +(GSP) GPUs in Linux. |
5 | 6 |
|
6 |
| -Currently, the objective is to upstream Rust abstractions for the relevant |
7 |
| -subsystems a prerequisite for the actual driver. Hence, the first mainline |
8 |
| -version of Nova will be a stub driver which helps establishing the necessary |
9 |
| -infrastructure in other subsystems (notably PCI and DRM). |
| 7 | +It will support all Nvidia GPUs beginning with the GeForce RTX20 (Turing family) |
| 8 | +series and newer. |
10 | 9 |
|
11 | 10 | ## Contact
|
12 | 11 |
|
13 |
| -To contact the team and / or participate in development, please use the mailing |
14 |
| -list: nouveau@lists.freedesktop.org |
| 12 | +Available communication channels are: |
| 13 | + |
| 14 | +- The mailing list: nouveau@lists.freedesktop.org |
| 15 | +- IRC: #nouveau on OFTC |
| 16 | +- [Zulip Chat](https://rust-for-linux.zulipchat.com/#narrow/channel/509436-Nova) |
15 | 17 |
|
16 | 18 |
|
17 | 19 | ## Resources
|
18 | 20 |
|
19 |
| -- [Official Source Tree](https://gitlab.freedesktop.org/drm/nova) |
20 |
| -- [Announcement E-Mail](https://lore.kernel.org/dri-devel/Zfsj0_tb-0-tNrJy@cassiopeiae/) |
| 21 | +The parts that are already in mainline Linux can be found in |
| 22 | +`drivers/gpu/nova-core/` and `drivers/gpu/drm/nova/` |
| 23 | + |
| 24 | +The development repository for the in-tree driver is located on |
| 25 | +[Freedesktop](https://gitlab.freedesktop.org/drm/nova). |
| 26 | + |
| 27 | + |
| 28 | +## Background |
| 29 | + |
| 30 | +### Why a new driver? |
| 31 | + |
| 32 | +Nouveau was, for the most part, designed for pre-GSP hardware. The driver exists |
| 33 | +since ~2009 and its authors back in the day had to reverse engineer a lot about |
| 34 | +the hardware's internals, resulting in a relatively difficult to maintain |
| 35 | +codebase. |
| 36 | + |
| 37 | +Moreover, Nouveau's maintainers concluded that a new driver, exclusively for |
| 38 | +GSP hardware, would allow for significantly simplifying the driver design: Most |
| 39 | +of the hardware internals that Nouveau had to reverse engineer reside in the |
| 40 | +GSP firmware. Hereby, the GSP takes up the role of a hardware abstraction layer |
| 41 | +which communicates with the host kernel through IPC. Thereby, a lot of the |
| 42 | +stack's complexity is moved from the GPU driver into the GSP firmware. |
| 43 | + |
| 44 | +This, in consequence, enables better maintainability. Another chance with a new |
| 45 | +driver is to obtain active community participation from the very beginning. |
| 46 | + |
| 47 | + |
| 48 | +### Why write it in Rust? |
21 | 49 |
|
22 |
| -In the source tree, the driver lives in `drivers/gpu/drm/nova`. |
| 50 | +Besides Rust's built-in ownership and lifetime model, its powerful type system |
| 51 | +allows us to avoid a large portion of a whole class of bugs (i.e. memory safety |
| 52 | +bugs). |
23 | 53 |
|
| 54 | +Additionally, the same features allow us to model APIs in a way that also |
| 55 | +certain logic errors can be caught at compile time already. |
24 | 56 |
|
25 |
| -## Status |
| 57 | +Especially GPU drivers can benefit a lot from Rust's ownership and lifetime |
| 58 | +model, given their highly concurrent and asynchronous design. |
26 | 59 |
|
27 |
| -Currently, Nova is just a stub driver intended to lift the bindings necessary |
28 |
| -for a real GPU driver into the (mainline) kernel. |
| 60 | +Since Nova is a new driver, written from scratch, it is an opportunity to try to |
| 61 | +leverage the advantages of Rust and obtain a more reliable, maintainable driver. |
29 | 62 |
|
30 |
| -Currently, those efforts are mostly focused on getting bindings for PCI, DRM |
31 |
| -and the Device (driver) model upstream. |
32 | 63 |
|
33 |
| -It can be expected that, as the driver continues to grow, various other abstractions |
34 |
| -will be needed. |
| 64 | +## Architecture |
35 | 65 |
|
| 66 | + |
36 | 67 |
|
37 |
| -## Utilized Common Rust Infrastructure |
| 68 | +The overall GPU driver is split into two parts: |
38 | 69 |
|
39 |
| -Nova depends on the Rust for Linux `staging/*` [branches](Branches.md). |
| 70 | +1. "Nova-Core", living in `drivers/gpu/nova-core/`. Nova-Core implements |
| 71 | + the fundamental interaction with the hardware (through PCI etc.) and, |
| 72 | + notably, boots up the GSP and interacts with it through a command queue. |
| 73 | +2. "Nova-DRM" (the official name is actually just "Nova", but to avoid |
| 74 | + confusion developers usually call it "Nova-DRM"), living in |
| 75 | + `drivers/gpu/drm/nova/`. This is the actual graphics driver, |
| 76 | + implementing all the typical DRM interfaces for userspace. |
40 | 77 |
|
| 78 | +This split architecture allows for different drivers building on top of the |
| 79 | +abstraction layer provided by Nova-Core. Besides Nova-DRM, for instance, a VFIO |
| 80 | +driver to virtualize the GPU can be built on top of Nova-Core. Through this |
| 81 | +driver Nova-Core can be used to instruct the GPU's firmware to spawn new PCI |
| 82 | +virtual functions (through |
| 83 | +[SR-IOV](https://docs.kernel.org/PCI/pci-iov-howto.html)), representing virtual |
| 84 | +GPUs. Those virtual functions (or vGPUs) can be used by virtual machines. Such |
| 85 | +a virtual machine running Linux may run Nova-Core and Nova-DRM as conventional |
| 86 | +GPU drivers on top of this vGPU. |
41 | 87 |
|
42 |
| -## Contributing |
| 88 | +A main advantage of this design is that the amount of software running on the |
| 89 | +host (where crashes would be far more fatal than inside of a VM) is kept small, |
| 90 | +which contributes to stability. |
43 | 91 |
|
44 |
| -As with every real open source program, help and participation is highly welcome! |
| 92 | +It is also possible to use Nova-Core + Nova-DRM on one physical machine (not |
| 93 | +depicted in the diagram) in order to expose a DRM compatible uAPI to the host |
| 94 | +userspace. |
45 | 95 |
|
46 |
| -As the driver is very young, however, it is currently difficult to assign tasks |
47 |
| -to people. Many things still have to settle until a steadily paced workflow |
48 |
| -produces atomic work topics a new one can work on. |
| 96 | +For more details about vGPUs, take a look at |
| 97 | +[Zhi's announcement email](https://lore.kernel.org/nouveau/20240922124951.1946072-1-zhiw@nvidia.com/). |
49 | 98 |
|
50 |
| -If you really want to jump in immediately regardless, here are a few things you |
51 |
| -can consider: |
52 | 99 |
|
53 |
| -- Most work to do right now is with more bindings for Rust. Notably, this |
54 |
| - includes the device driver model, DRM and PCI. If you have expertise there, |
55 |
| - have a look at the existing code in the [topic branches](Branches.md) and see |
56 |
| - if there's something you can add or improve. |
57 |
| -- Feel free to go over Nova's code base and make suggestions or send patches, |
58 |
| - for example for improved comments, grammar fixes, improving code readability |
59 |
| - etc. |
| 100 | +## Status and Contributing |
60 | 101 |
|
| 102 | +The necessary Rust infrastructure has been progressing a lot. Current work now |
| 103 | +focuses more on the actual driver. In case you want to contribute, take a look |
| 104 | +at the |
| 105 | +[NOVA TODO List](https://docs.kernel.org/gpu/nova/core/todo.html). |
61 | 106 |
|
62 |
| -Happy hacking! |
| 107 | +Don't hesitate reaching out on the aforementioned community channels. |
0 commit comments