From: Alexandre Courbot <acourbot@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
Alice Ryhl <aliceryhl@google.com>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>
Cc: John Hubbard <jhubbard@nvidia.com>,
Alistair Popple <apopple@nvidia.com>,
Timur Tabi <ttabi@nvidia.com>,
Eliot Courtney <ecourtney@nvidia.com>,
Zhi Wang <zhiw@nvidia.com>,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Alexandre Courbot <acourbot@nvidia.com>
Subject: [PATCH 2/4] gpu: nova-core: gsp: rename and move the static configuration type
Date: Fri, 27 Nov 2026 23:04:06 +0900 [thread overview]
Message-ID: <20261127-nova-r000-staging-v1-2-4eaf6e3c0942@nvidia.com> (raw)
In-Reply-To: <20261127-nova-r000-staging-v1-0-4eaf6e3c0942@nvidia.com>
From: John Hubbard <jhubbard@nvidia.com>
With the r000 firmware, GSP-RM reports the static GPU configuration in
its reply to GSP_INIT, a GMC command, and no RPC command fetches it.
The type that holds the configuration is named after the r570 RPC
command that fetches it, and it is defined among the RPC commands.
In order to make the type available to a GMC reply, name it after its
contents, and move it out of the RPC commands, up into the commands
module.
No functional changes.
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drivers/gpu/nova-core/api.rs | 6 +--
drivers/gpu/nova-core/gpu.rs | 4 +-
drivers/gpu/nova-core/gsp.rs | 2 +-
drivers/gpu/nova-core/gsp/commands.rs | 65 +++++++++++++++++++++++++++++
drivers/gpu/nova-core/gsp/commands/rpc.rs | 68 +++----------------------------
5 files changed, 76 insertions(+), 69 deletions(-)
diff --git a/drivers/gpu/nova-core/api.rs b/drivers/gpu/nova-core/api.rs
index dc877ddebe8c..f800ba6c4183 100644
--- a/drivers/gpu/nova-core/api.rs
+++ b/drivers/gpu/nova-core/api.rs
@@ -18,7 +18,7 @@
use crate::{
driver,
gpu::Gpu,
- gsp::commands::rpc::GetGspStaticInfoReply, //
+ gsp::commands::GspStaticInfo, //
};
/// API handle for the auxiliary bus child drivers to interact with nova-core.
@@ -39,8 +39,8 @@ pub fn of(adev: &auxiliary::Device<Bound>) -> Result<NovaCoreApiHandle<'_>> {
NovaCoreApiHandle::of(adev)
}
- /// Returns the GPU [`GetGspStaticInfoReply`].
- pub fn gsp_static_info(&self) -> &GetGspStaticInfoReply {
+ /// Returns the GPU [`GspStaticInfo`].
+ pub fn gsp_static_info(&self) -> &GspStaticInfo {
&self.gpu.gsp_static_info
}
diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 8ab1687847ff..590d81f4e479 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -32,7 +32,7 @@
gsp::{
self,
cmdq::Cmdq,
- commands::rpc::GetGspStaticInfoReply,
+ commands::GspStaticInfo,
Gsp,
GspBootContext, //
},
@@ -394,7 +394,7 @@ pub(crate) struct Gpu<'gpu> {
#[uses('tree)]
_gsp_subtree: GspSubtree<'gsp_resources>,
/// Static GPU information as provided by the GSP.
- pub(crate) gsp_static_info: GetGspStaticInfoReply,
+ pub(crate) gsp_static_info: GspStaticInfo,
/// GPU memory manager owning memory management resources.
///
/// Must be kept declared *before* `gsp_resources`, so that its components are dropped while
diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
index 2f1cdf8b7bec..398d6525b133 100644
--- a/drivers/gpu/nova-core/gsp.rs
+++ b/drivers/gpu/nova-core/gsp.rs
@@ -159,7 +159,7 @@ pub(crate) fn new(
}
/// Query the GSP for the static GPU information.
- pub(crate) fn get_static_info(&self) -> Result<commands::rpc::GetGspStaticInfoReply> {
+ pub(crate) fn get_static_info(&self) -> Result<commands::GspStaticInfo> {
self.cmdq.send_rpc_command(commands::rpc::GetGspStaticInfo)
}
}
diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index 5f1c944678be..4aae94b7ca2e 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -2,3 +2,68 @@
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
pub(crate) mod rpc;
+
+use core::{
+ ffi::FromBytesUntilNulError,
+ ops::Range,
+ str::Utf8Error, //
+};
+
+use kernel::prelude::*;
+
+/// The static GPU configuration, which GSP-RM reports in reply to
+/// [`GetGspStaticInfo`](rpc::GetGspStaticInfo).
+pub struct GspStaticInfo {
+ gpu_name: [u8; 64],
+ gpu_short_name: [u8; 64],
+ /// The 16-byte SHA-1 based GPU identifier (GID) reported by GSP-RM.
+ pub gpu_gid: [u8; 16],
+ /// BAR1 Page Directory Entry base address.
+ pub(crate) bar1_pde_base: u64,
+ /// Usable FB (VRAM) regions for driver memory allocation.
+ pub(crate) usable_fb_regions: KVec<Range<u64>>,
+ /// Exclusive end of the FB physical address space.
+ pub(crate) total_fb_end: u64,
+}
+
+/// Error type for [`GspStaticInfo::gpu_name`].
+#[derive(Debug)]
+pub enum GpuNameError {
+ /// The GPU name string does not contain a null terminator.
+ NoNullTerminator(FromBytesUntilNulError),
+
+ /// The GPU name string contains invalid UTF-8.
+ InvalidUtf8(Utf8Error),
+}
+
+impl GspStaticInfo {
+ /// Returns the name of the GPU as a string.
+ ///
+ /// Returns an error if the string given by the GSP does not contain a null terminator or
+ /// contains invalid UTF-8.
+ pub fn gpu_name(&self) -> Result<&str, GpuNameError> {
+ CStr::from_bytes_until_nul(&self.gpu_name)
+ .map_err(GpuNameError::NoNullTerminator)?
+ .to_str()
+ .map_err(GpuNameError::InvalidUtf8)
+ }
+
+ /// Returns the short name of the GPU as a string.
+ ///
+ /// Returns an error if the string given by the GSP does not contain a null terminator or
+ /// contains invalid UTF-8.
+ pub fn gpu_short_name(&self) -> core::result::Result<&str, GpuNameError> {
+ CStr::from_bytes_until_nul(&self.gpu_short_name)
+ .map_err(GpuNameError::NoNullTerminator)?
+ .to_str()
+ .map_err(GpuNameError::InvalidUtf8)
+ }
+
+ /// Returns the total usable VRAM size in bytes, i.e. the summed lengths of all usable FB
+ /// regions.
+ pub fn vram_size(&self) -> u64 {
+ self.usable_fb_regions.iter().fold(0, |size, region| {
+ size.saturating_add(region.end - region.start)
+ })
+ }
+}
diff --git a/drivers/gpu/nova-core/gsp/commands/rpc.rs b/drivers/gpu/nova-core/gsp/commands/rpc.rs
index 023090ac6bd9..ab6d1114cead 100644
--- a/drivers/gpu/nova-core/gsp/commands/rpc.rs
+++ b/drivers/gpu/nova-core/gsp/commands/rpc.rs
@@ -3,10 +3,7 @@
use core::{
array,
- convert::Infallible,
- ffi::FromBytesUntilNulError,
- ops::Range,
- str::Utf8Error, //
+ convert::Infallible, //
};
use kernel::{
@@ -30,6 +27,7 @@
Cmdq,
NoReply, //
},
+ commands::GspStaticInfo,
fw::{
self,
MsgFunction, //
@@ -208,7 +206,7 @@ pub(crate) fn wait_gsp_init_done(cmdq: &Cmdq<'_>) -> Result {
impl CommandToGsp for GetGspStaticInfo {
const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo;
type Command = fw::commands::GspStaticConfigInfo;
- type Reply = GetGspStaticInfoReply;
+ type Reply = GspStaticInfo;
type InitError = Infallible;
fn init(&self) -> impl Init<Self::Command, Self::InitError> {
@@ -216,21 +214,7 @@ fn init(&self) -> impl Init<Self::Command, Self::InitError> {
}
}
-/// The reply from the GSP to the [`GetGspStaticInfo`] command.
-pub struct GetGspStaticInfoReply {
- gpu_name: [u8; 64],
- gpu_short_name: [u8; 64],
- /// The 16-byte SHA-1 based GPU identifier (GID) reported by GSP-RM.
- pub gpu_gid: [u8; 16],
- /// BAR1 Page Directory Entry base address.
- pub(crate) bar1_pde_base: u64,
- /// Usable FB (VRAM) regions for driver memory allocation.
- pub(crate) usable_fb_regions: KVec<Range<u64>>,
- /// Exclusive end of the FB physical address space.
- pub(crate) total_fb_end: u64,
-}
-
-impl MessageFromGsp for GetGspStaticInfoReply {
+impl MessageFromGsp for GspStaticInfo {
const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo;
type Message = fw::commands::GspStaticConfigInfo;
type InitError = Error;
@@ -245,7 +229,7 @@ fn read(
}
let total_fb_end = msg.total_fb_end().ok_or(EINVAL)?;
- Ok(GetGspStaticInfoReply {
+ Ok(GspStaticInfo {
gpu_name: msg.gpu_name_str(),
gpu_short_name: msg.gpu_short_name_str(),
gpu_gid: msg.gpu_gid(),
@@ -256,48 +240,6 @@ fn read(
}
}
-/// Error type for [`GetGspStaticInfoReply::gpu_name`].
-#[derive(Debug)]
-pub enum GpuNameError {
- /// The GPU name string does not contain a null terminator.
- NoNullTerminator(FromBytesUntilNulError),
-
- /// The GPU name string contains invalid UTF-8.
- InvalidUtf8(Utf8Error),
-}
-
-impl GetGspStaticInfoReply {
- /// Returns the name of the GPU as a string.
- ///
- /// Returns an error if the string given by the GSP does not contain a null terminator or
- /// contains invalid UTF-8.
- pub fn gpu_name(&self) -> Result<&str, GpuNameError> {
- CStr::from_bytes_until_nul(&self.gpu_name)
- .map_err(GpuNameError::NoNullTerminator)?
- .to_str()
- .map_err(GpuNameError::InvalidUtf8)
- }
-
- /// Returns the short name of the GPU as a string.
- ///
- /// Returns an error if the string given by the GSP does not contain a null terminator or
- /// contains invalid UTF-8.
- pub fn gpu_short_name(&self) -> core::result::Result<&str, GpuNameError> {
- CStr::from_bytes_until_nul(&self.gpu_short_name)
- .map_err(GpuNameError::NoNullTerminator)?
- .to_str()
- .map_err(GpuNameError::InvalidUtf8)
- }
-
- /// Returns the total usable VRAM size in bytes, i.e. the summed lengths of all usable FB
- /// regions.
- pub fn vram_size(&self) -> u64 {
- self.usable_fb_regions.iter().fold(0, |size, region| {
- size.saturating_add(region.end - region.start)
- })
- }
-}
-
pub(crate) use fw::commands::PowerStateLevel;
/// The `UnloadingGuestDriver` command, used to shut down the GSP.
--
2.56.1
next prev parent reply other threads:[~2026-11-27 14:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 14:04 [PATCH 0/4] gpu: nova-core: gsp: preparatory patches for the r000 firmware Alexandre Courbot
2026-11-27 14:04 ` [PATCH 1/4] gpu: nova-core: gsp: add the r000 queue element header Alexandre Courbot
2026-11-27 14:52 ` Gary Guo
2026-11-27 14:04 ` Alexandre Courbot [this message]
2026-11-27 14:04 ` [PATCH 3/4] gpu: nova-core: gsp: return the static GPU configuration from boot Alexandre Courbot
2026-11-27 14:04 ` [PATCH 4/4] gpu: nova-core: gsp: add the short name and GID to the GSP_INIT reply Alexandre Courbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127-nova-r000-staging-v1-2-4eaf6e3c0942@nvidia.com \
--to=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=simona@ffwll.ch \
--cc=ttabi@nvidia.com \
--cc=zhiw@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®