|
|
Log in / Subscribe / Register

gpu: drm: nova: enable calling into nova-core

From:  Alexandre Courbot <acourbot-AT-nvidia.com>
To:  Miguel Ojeda <ojeda-AT-kernel.org>, Nicolas Schier <nsc-AT-kernel.org>, Boqun Feng <boqun-AT-kernel.org>, Gary Guo <gary-AT-garyguo.net>, Björn Roy Baron <bjorn3_gh-AT-protonmail.com>, Benno Lossin <lossin-AT-kernel.org>, Andreas Hindborg <a.hindborg-AT-kernel.org>, Alice Ryhl <aliceryhl-AT-google.com>, Trevor Gross <tmgross-AT-umich.edu>, Danilo Krummrich <dakr-AT-kernel.org>, David Airlie <airlied-AT-gmail.com>, Simona Vetter <simona-AT-ffwll.ch>, Maarten Lankhorst <maarten.lankhorst-AT-linux.intel.com>, Maxime Ripard <mripard-AT-kernel.org>
Subject:  [PATCH v4 0/6] gpu: drm: nova: enable calling into nova-core
Date:  Fri, 05 Jun 2026 17:31:50 +0900
Message-ID:  <20260605-nova-exports-v4-0-e948c287407c@nvidia.com>
Cc:  John Hubbard <jhubbard-AT-nvidia.com>, Alistair Popple <apopple-AT-nvidia.com>, Timur Tabi <ttabi-AT-nvidia.com>, Zhi Wang <zhiw-AT-nvidia.com>, Eliot Courtney <ecourtney-AT-nvidia.com>, linux-kbuild-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org, rust-for-linux-AT-vger.kernel.org, nova-gpu-AT-lists.linux.dev, dri-devel-AT-lists.freedesktop.org, Alexandre Courbot <acourbot-AT-nvidia.com>
Archive-link:  Article

`nova-drm` is scheduled to expose a user-space API to receive IOCTLs
from user-mode drivers, and to call into `nova-core` to perform the
actual work. We are about to reach the state where we need the ability
to call into `nova-core`, but the current Rust build system does not
support this, and the solution will likely take at least a couple of
cycles to be merged.

In the meantime, this series introduces a Nova-local workaround for
`nova-drm` to call into `nova-core`. It generates the `nova-core`
metadata that `nova-drm` can use to resolve references at build-time,
and also builds a list of exported symbols for symbol resolution when
modules are loaded.

Since Rust symbols are long, this work ran into the limits on symbol
sizes `modpost` can handle. Thus, the first patch instructs the compiler
to inline initializers for some Rust basic types to avoid those long
symbol names when symbols from `nova-core` are exported. Interestingly,
this also results in a smaller nova-core binary size [1].

The rest of the patches enable inter-module calls from nova-drm to
nova-core.

This series is based on `drm-rust-next`. The current revision includes
the feedback received on v3. In particular, moving everything to
`drivers/gpu/Makefile` simplifies things considerably, and I have tried
to align more with what is done in `rust/Makefile`.

[1] https://lore.kernel.org/all/DIN76NTFEU1N.1RT6G4IFD62RG@nv...

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Changes in v4:
- Build nova-core and nova-drm from `drivers/gpu/Makefile`.
- Emit nova-core's crate metadata as a side-effect of its normal object
  build.
- Align more closely with the rules of `rust/Makefile`.
- Add `.gitignore` entries for generated files.
- Inline a few more Rust methods per Sashiko's recommendation.
- Drop a few `Reviewed-by`s as the implementation has changed
  significantly.
- Link to v3: https://patch.msgid.link/20260530-nova-exports-v3-0-1202a...

Changes in v3:
- Drop the modpost overflow detection patch as it is to be merged
  through the KBuild tree.
- Drop obsolete (and actually unnecessary) changes to `pin_init`.
- Do not inline methods returning `impl PinInit` as they cannot
  contribute to the long symbol names problem.
- Use `#[inline]` instead of `#[inline(always)]` for methods that could
  create excessively long symbols.
- Link to v2: https://patch.msgid.link/20260527-nova-exports-v2-0-06de4...

Changes in v2:
- Rebase on top of HRT v5.
- Inline some `pin_init` and Rust basic types methods to avoid long
  symbol names and optimize code.
- Print truncating modpost symbols and abort upon meeting them.
- Drop increase of `buf_printf`'s buffer.
- Drop obsolete nova-core renaming patch.
- Link to v1: https://patch.msgid.link/20260430-nova-exports-v1-0-7ca31...

---
Alexandre Courbot (6):
      rust: inline some init methods
      gpu: build nova-core and nova-drm from drivers/gpu/Makefile
      gpu: nova-core: export Rust symbols for nova-drm
      gpu: nova-core: emit Rust metadata for nova-drm
      gpu: drm: nova: build after nova-core and use its symbols
      [POC] gpu: drm: nova: demonstrate interaction with nova-core

 drivers/gpu/Makefile                      | 36 ++++++++++++++++++-
 drivers/gpu/drm/Makefile                  |  2 +-
 drivers/gpu/drm/nova/Makefile             |  4 +--
 drivers/gpu/drm/nova/driver.rs            |  9 ++++-
 drivers/gpu/nova-core/.gitignore          |  2 ++
 drivers/gpu/nova-core/Makefile            |  4 +--
 drivers/gpu/nova-core/driver.rs           | 59 +++++++++++++++++++++++--------
 drivers/gpu/nova-core/gpu.rs              |  9 +++--
 drivers/gpu/nova-core/gsp/hal.rs          |  2 +-
 drivers/gpu/nova-core/nova_core.rs        |  4 +--
 drivers/gpu/nova-core/nova_core_exports.c | 15 ++++++++
 rust/kernel/alloc/kbox.rs                 |  2 ++
 rust/kernel/init.rs                       |  2 ++
 rust/kernel/sync/arc.rs                   |  4 +++
 14 files changed, 125 insertions(+), 29 deletions(-)
---
base-commit: fea3a2dd7d3fc1936211ced5f84420e610435730
change-id: 20260430-nova-exports-502f996c5aab

Best regards,
--  
Alexandre Courbot <acourbot@nvidia.com>




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds