[PATCH v5 00/11] gpu: nova: Export parameters from nova-core to nova-drm

Alistair Popple posted 11 patches 4 weeks, 1 day ago
There is a newer version of this series
drivers/gpu/drm/nova/driver.rs           | 18 ++++-
drivers/gpu/drm/nova/file.rs             | 83 ++++++++++++++++++++----
drivers/gpu/nova-core/api.rs             | 68 +++++++++++++++++++
drivers/gpu/nova-core/driver.rs          | 46 +++++++++----
drivers/gpu/nova-core/gpu.rs             | 43 +++++++-----
drivers/gpu/nova-core/gsp/commands.rs    | 27 ++++++++
drivers/gpu/nova-core/gsp/fw/commands.rs | 12 ++++
drivers/gpu/nova-core/gsp/hal.rs         |  2 +-
drivers/gpu/nova-core/nova_core.rs       |  1 +
drivers/gpu/nova-core/num.rs             |  2 +-
include/uapi/drm/nova_drm.h              | 82 +++++++++++++++++++++++
rust/kernel/uaccess.rs                   | 14 ++++
12 files changed, 352 insertions(+), 46 deletions(-)
create mode 100644 drivers/gpu/nova-core/api.rs
[PATCH v5 00/11] gpu: nova: Export parameters from nova-core to nova-drm
Posted by Alistair Popple 4 weeks, 1 day ago
This patch series adds some basic GPU properties via a new GPU info
ioctl. It builds on top of the "drm: Higher-Ranked Lifetime private data"
series[1] to correctly manage lifetimes of registration data shared between
DRM, auxbus and nova-core. It's also based on top of "ForLt/CovariantForLt
split, auxiliary closure API and DevresLt"[2]

A tree with this series applied on top of all pre-requisites is available
at [3].

Properties are exported via a new NovaCoreApi type which implements methods
to read data from the GPU. This has been implemented in a separate module
to make the public API implementations obvious and to keep them in one
place. Auxiliary bus drivers can obtain a handle to this type using
NovaCoreApi::of().

This handle can then be stored as part of the DRM registration data and
used to interact with the GPU via the nova-core driver.

A new info ioctl is introduced which provides an info type field and a
method for reading extendable structs containing GPU information. This
series can be tested using the drm-test[4]. A pull request containing
updated tests will be raised once this has been posted. A pull request for
Mesa has also been raised but is out of date. That will be updated once
this series has been merged.

Changes since v4:

 - No longer export chip-id, instead export architecture and implementation
 - Add a separate info ioctl with types to read GPU info as suggested by
   Danilo

Changes since v3:

 - Use an ioctl to return all parameters rather than multiple key/value
   queries

Changes since v2:

 - Addressed review Danilo and Alex
 - Minor renames to better align with HW based on internal feedback

Changes since v1:

 - Address review comments from Danilo
 - Add an API call to read VRAM PCI BAR size using nova-core
 
[1] - https://lore.kernel.org/rust-for-linux/20260628145406.2107056-1-dakr@kernel.org/
[2] - https://lore.kernel.org/driver-core/20260626183630.2585057-1-dakr@kernel.org/
[3] - https://github.com/apopple-nvidia/linux/tree/nova-drm
[4] - https://gitlab.freedesktop.org/dakr/drm-test

Cc: M Henning <mhenning@darkrefraction.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Benno Lossin <lossin@kernel.org>
Cc: Gary Guo <gary@garyguo.net>
Cc: Eliot Courtney <ecourtney@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: linux-kernel@vger.kernel.org
Cc: nova-gpu@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org
Cc: rust-for-linux@vger.kernel.org

Alistair Popple (11):
  gpu: nova-core: Add public driver API to nova-core
  drm: nova: Add DRM registration data
  drm: nova: Add GPU architecture enum to nova-drm UAPI
  rust: uaccess: add UserSliceWriter::write_truncated()
  drm: nova: Add an info ioctl
  drm: nova: Add usable VRAM size to GPU info
  drm: nova: Use nova-core to read VRAM_BAR_SIZE parameter
  drm: nova: Expose a render node
  drm: nova: Report GPU name in GPU info
  drm: nova: Report GPU short name in GPU info
  drm: nova: Report GPU GID in GPU info

 drivers/gpu/drm/nova/driver.rs           | 18 ++++-
 drivers/gpu/drm/nova/file.rs             | 83 ++++++++++++++++++++----
 drivers/gpu/nova-core/api.rs             | 68 +++++++++++++++++++
 drivers/gpu/nova-core/driver.rs          | 46 +++++++++----
 drivers/gpu/nova-core/gpu.rs             | 43 +++++++-----
 drivers/gpu/nova-core/gsp/commands.rs    | 27 ++++++++
 drivers/gpu/nova-core/gsp/fw/commands.rs | 12 ++++
 drivers/gpu/nova-core/gsp/hal.rs         |  2 +-
 drivers/gpu/nova-core/nova_core.rs       |  1 +
 drivers/gpu/nova-core/num.rs             |  2 +-
 include/uapi/drm/nova_drm.h              | 82 +++++++++++++++++++++++
 rust/kernel/uaccess.rs                   | 14 ++++
 12 files changed, 352 insertions(+), 46 deletions(-)
 create mode 100644 drivers/gpu/nova-core/api.rs

-- 
2.54.0
Re: [PATCH v5 00/11] gpu: nova: Export parameters from nova-core to nova-drm
Posted by Alistair Popple 4 weeks, 1 day ago
On 2026-08-28 at 13:35 +1000, Alistair Popple <apopple@nvidia.com> wrote...
> This patch series adds some basic GPU properties via a new GPU info
> ioctl. It builds on top of the "drm: Higher-Ranked Lifetime private data"
> series[1] to correctly manage lifetimes of registration data shared between
> DRM, auxbus and nova-core. It's also based on top of "ForLt/CovariantForLt
> split, auxiliary closure API and DevresLt"[2]
> 
> A tree with this series applied on top of all pre-requisites is available
> at [3].
> 
> Properties are exported via a new NovaCoreApi type which implements methods
> to read data from the GPU. This has been implemented in a separate module
> to make the public API implementations obvious and to keep them in one
> place. Auxiliary bus drivers can obtain a handle to this type using
> NovaCoreApi::of().
> 
> This handle can then be stored as part of the DRM registration data and
> used to interact with the GPU via the nova-core driver.
> 
> A new info ioctl is introduced which provides an info type field and a
> method for reading extendable structs containing GPU information. This
> series can be tested using the drm-test[4]. A pull request containing
> updated tests will be raised once this has been posted.

Pull request is here:

https://gitlab.freedesktop.org/dakr/drm-test/-/merge_requests/1

> A pull request for
> Mesa has also been raised but is out of date. That will be updated once
> this series has been merged.
> 
> Changes since v4:
> 
>  - No longer export chip-id, instead export architecture and implementation
>  - Add a separate info ioctl with types to read GPU info as suggested by
>    Danilo
> 
> Changes since v3:
> 
>  - Use an ioctl to return all parameters rather than multiple key/value
>    queries
> 
> Changes since v2:
> 
>  - Addressed review Danilo and Alex
>  - Minor renames to better align with HW based on internal feedback
> 
> Changes since v1:
> 
>  - Address review comments from Danilo
>  - Add an API call to read VRAM PCI BAR size using nova-core
>  
> [1] - https://lore.kernel.org/rust-for-linux/20260628145406.2107056-1-dakr@kernel.org/
> [2] - https://lore.kernel.org/driver-core/20260626183630.2585057-1-dakr@kernel.org/
> [3] - https://github.com/apopple-nvidia/linux/tree/nova-drm
> [4] - https://gitlab.freedesktop.org/dakr/drm-test
> 
> Cc: M Henning <mhenning@darkrefraction.com>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Alice Ryhl <aliceryhl@google.com>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Cc: Benno Lossin <lossin@kernel.org>
> Cc: Gary Guo <gary@garyguo.net>
> Cc: Eliot Courtney <ecourtney@nvidia.com>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: nova-gpu@lists.linux.dev
> Cc: dri-devel@lists.freedesktop.org
> Cc: rust-for-linux@vger.kernel.org
> 
> Alistair Popple (11):
>   gpu: nova-core: Add public driver API to nova-core
>   drm: nova: Add DRM registration data
>   drm: nova: Add GPU architecture enum to nova-drm UAPI
>   rust: uaccess: add UserSliceWriter::write_truncated()
>   drm: nova: Add an info ioctl
>   drm: nova: Add usable VRAM size to GPU info
>   drm: nova: Use nova-core to read VRAM_BAR_SIZE parameter
>   drm: nova: Expose a render node
>   drm: nova: Report GPU name in GPU info
>   drm: nova: Report GPU short name in GPU info
>   drm: nova: Report GPU GID in GPU info
> 
>  drivers/gpu/drm/nova/driver.rs           | 18 ++++-
>  drivers/gpu/drm/nova/file.rs             | 83 ++++++++++++++++++++----
>  drivers/gpu/nova-core/api.rs             | 68 +++++++++++++++++++
>  drivers/gpu/nova-core/driver.rs          | 46 +++++++++----
>  drivers/gpu/nova-core/gpu.rs             | 43 +++++++-----
>  drivers/gpu/nova-core/gsp/commands.rs    | 27 ++++++++
>  drivers/gpu/nova-core/gsp/fw/commands.rs | 12 ++++
>  drivers/gpu/nova-core/gsp/hal.rs         |  2 +-
>  drivers/gpu/nova-core/nova_core.rs       |  1 +
>  drivers/gpu/nova-core/num.rs             |  2 +-
>  include/uapi/drm/nova_drm.h              | 82 +++++++++++++++++++++++
>  rust/kernel/uaccess.rs                   | 14 ++++
>  12 files changed, 352 insertions(+), 46 deletions(-)
>  create mode 100644 drivers/gpu/nova-core/api.rs
> 
> -- 
> 2.54.0
>