[PATCH v6 12/13] drm: nova: Report GPU short name in GPU info

From: Alistair Popple

Date: Wed Sep 09 2026 - 03:00:07 EST


Add the short GPU name to the GPU info structure. As with the full name
it is copied from a validated, NUL-terminated string extracted by
nova-core rather than from the raw firmware bytes.

Signed-off-by: Alistair Popple <apopple@xxxxxxxxxx>

---

Changes since v5:

- Add a validating gpu_short_name() accessor to nova-core and use it
instead of exposing the raw bytes, as suggested by Danilo

Changes since v4:

- New for v5
---
drivers/gpu/drm/nova/file.rs | 5 +++++
drivers/gpu/nova-core/gsp/commands.rs | 13 +++++++++++++
drivers/gpu/nova-core/gsp/fw/commands.rs | 5 +++++
include/uapi/drm/nova_drm.h | 5 +++++
4 files changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/nova/file.rs b/drivers/gpu/drm/nova/file.rs
index 4753d9bca13b..d2e1f9f798a4 100644
--- a/drivers/gpu/drm/nova/file.rs
+++ b/drivers/gpu/drm/nova/file.rs
@@ -61,6 +61,11 @@ fn new(reg_data: &DrmRegData<'_>) -> Result<Self> {

copy_name(&mut info.gpu_name, gsp_static_info.gpu_name().map_err(|_| EINVAL)?)?;

+ copy_name(
+ &mut info.gpu_short_name,
+ gsp_static_info.gpu_short_name().map_err(|_| EINVAL)?,
+ )?;
+
Ok(Self(info))
}
}
diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index 00cfcef260c5..5ea0f625f7df 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -214,6 +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],
/// Usable FB (VRAM) regions for driver memory allocation.
pub(crate) usable_fb_regions: KVec<Range<u64>>,
}
@@ -234,6 +235,7 @@ fn read(

Ok(GetGspStaticInfoReply {
gpu_name: msg.gpu_name_str(),
+ gpu_short_name: msg.gpu_short_name_str(),
usable_fb_regions,
})
}
@@ -261,6 +263,17 @@ pub fn gpu_name(&self) -> core::result::Result<&str, GpuNameError> {
.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 {
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 6dc31d1bf5ae..f62fb85f4473 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -131,6 +131,11 @@ impl GspStaticConfigInfo {
self.0.gpuNameString
}

+ /// Returns a bytes array containing the (hopefully) zero-terminated short name of this GPU.
+ pub(crate) fn gpu_short_name_str(&self) -> [u8; 64] {
+ self.0.gpuShortNameString
+ }
+
/// Returns an iterator over valid FB regions from GSP firmware data.
fn fb_regions(
&self,
diff --git a/include/uapi/drm/nova_drm.h b/include/uapi/drm/nova_drm.h
index c692cacaa552..b0af9945b6c5 100644
--- a/include/uapi/drm/nova_drm.h
+++ b/include/uapi/drm/nova_drm.h
@@ -191,6 +191,11 @@ struct drm_nova_info_gpu {
* @gpu_name: NUL-terminated full GPU name.
*/
__u8 gpu_name[64];
+
+ /**
+ * @gpu_short_name: NUL-terminated short GPU name.
+ */
+ __u8 gpu_short_name[64];
};

#define DRM_NOVA_GETPARAM 0x00
--
2.54.0