mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 v2 04/11] gpu: nova-core: gsp: add the short name and GID to the GSP_INIT reply
Date: Mon, 30 Nov 2026 00:11:03 +0900	[thread overview]
Message-ID: <20261130-nova-r000-staging-v2-4-afd079026a61@nvidia.com> (raw)
In-Reply-To: <20261130-nova-r000-staging-v2-0-afd079026a61@nvidia.com>

From: John Hubbard <jhubbard@nvidia.com>

The static GPU configuration holds the short name of the GPU and the GPU
identifier (GID). Nova-drm reports both to user space, and the r570
static-info reply provides both.

The r000 GSP-RM sends both in its reply to GSP_INIT, and nova-core's
schema of that reply has no key for either.

Add the two keys to the schema. Move the lengths of the names and of the
identifier onto the static configuration type, so that the schema and
the type share them.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/commands.rs    | 11 ++++++++---
 drivers/gpu/nova-core/gsp/fw/commands.rs | 23 ++++++++++++-----------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index 4aae94b7ca2e..390be8fdd0ba 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -14,10 +14,10 @@
 /// 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],
+    gpu_name: [u8; Self::MAX_GPU_NAME_LEN],
+    gpu_short_name: [u8; Self::MAX_GPU_NAME_LEN],
     /// The 16-byte SHA-1 based GPU identifier (GID) reported by GSP-RM.
-    pub gpu_gid: [u8; 16],
+    pub gpu_gid: [u8; Self::GID_LEN],
     /// BAR1 Page Directory Entry base address.
     pub(crate) bar1_pde_base: u64,
     /// Usable FB (VRAM) regions for driver memory allocation.
@@ -37,6 +37,11 @@ pub enum GpuNameError {
 }
 
 impl GspStaticInfo {
+    /// Length of the buffers holding the GPU names, NUL terminator included.
+    pub(crate) const MAX_GPU_NAME_LEN: usize = 64;
+    /// Length of the GPU identifier.
+    pub(crate) const GID_LEN: usize = 16;
+
     /// 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
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index b4bdbddad79f..d6926709a368 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -18,6 +18,7 @@
 use crate::{
     gpu::Chipset,
     gsp::{
+        commands::GspStaticInfo,
         nvkv::{
             nvkv_decode,
             nvkv_encode,
@@ -176,12 +177,12 @@ unsafe impl FromBytes for PackedRegistryTable {}
 
 impl GspStaticConfigInfo {
     /// Returns a bytes array containing the (hopefully) zero-terminated name of this GPU.
-    pub(crate) fn gpu_name_str(&self) -> [u8; 64] {
+    pub(crate) fn gpu_name_str(&self) -> [u8; GspStaticInfo::MAX_GPU_NAME_LEN] {
         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] {
+    pub(crate) fn gpu_short_name_str(&self) -> [u8; GspStaticInfo::MAX_GPU_NAME_LEN] {
         self.0.gpuShortNameString
     }
 
@@ -189,9 +190,9 @@ impl GspStaticConfigInfo {
     ///
     /// GSP-RM reports the GID in binary SHA-1 form, which occupies the first 16 bytes of the
     /// GID info payload.
-    pub(crate) fn gpu_gid(&self) -> [u8; 16] {
-        let mut gid = [0u8; 16];
-        gid.copy_from_slice(&self.0.gidInfo.data[..16]);
+    pub(crate) fn gpu_gid(&self) -> [u8; GspStaticInfo::GID_LEN] {
+        let mut gid = [0u8; GspStaticInfo::GID_LEN];
+        gid.copy_from_slice(&self.0.gidInfo.data[..GspStaticInfo::GID_LEN]);
         gid
     }
 
@@ -386,7 +387,9 @@ struct GspInitRequest {
     // https://github.com/rust-lang/rust/pull/154377
     #[allow(dead_code)]
     struct GspInitResponseSchema => GspInitResponse {
-        gpu_name: TruncatingArray<u8, { GspInitResponse::MAX_GPU_NAME_LEN }, 0x2000>,
+        gpu_name: TruncatingArray<u8, { GspStaticInfo::MAX_GPU_NAME_LEN }, 0x2000>,
+        gpu_short_name: TruncatingArray<u8, { GspStaticInfo::MAX_GPU_NAME_LEN }, 0x2001>,
+        gpu_gid: TruncatingArray<u8, { GspStaticInfo::GID_LEN }, 0x2002>,
         fb_regions: Accumulated<FbRegionSchema>,
         bar1_pde_base: Required<Key<u64, 0x1020>>,
         vmmu_segment_size: Key<u64, 0x1050>,
@@ -398,16 +401,14 @@ struct GspInitResponseSchema => GspInitResponse {
 // https://github.com/rust-lang/rust/pull/154377
 #[allow(dead_code)]
 struct GspInitResponse {
-    gpu_name: ArrayVec<u8, { Self::MAX_GPU_NAME_LEN }>,
+    gpu_name: ArrayVec<u8, { GspStaticInfo::MAX_GPU_NAME_LEN }>,
+    gpu_short_name: ArrayVec<u8, { GspStaticInfo::MAX_GPU_NAME_LEN }>,
+    gpu_gid: ArrayVec<u8, { GspStaticInfo::GID_LEN }>,
     fb_regions: KVVec<FbRegion>,
     bar1_pde_base: u64,
     vmmu_segment_size: u64,
 }
 
-impl GspInitResponse {
-    const MAX_GPU_NAME_LEN: usize = 64;
-}
-
 nvkv_decode! {
     /// Schema for one FB region of the `GSP_INIT` response.
     struct FbRegionSchema => FbRegion {

-- 
2.56.1


  parent reply	other threads:[~2026-11-29 15:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 15:10 [PATCH v2 00/11] gpu: nova-core: gsp: preparatory patches for the r000 firmware Alexandre Courbot
2026-11-29 15:11 ` [PATCH v2 01/11] gpu: nova-core: gsp: add the r000 queue element header Alexandre Courbot
2026-11-29 15:11 ` [PATCH v2 02/11] gpu: nova-core: gsp: rename and move the static configuration type Alexandre Courbot
2026-11-29 15:11 ` [PATCH v2 03/11] gpu: nova-core: gsp: return the static GPU configuration from boot Alexandre Courbot
2026-11-29 15:11 ` Alexandre Courbot [this message]
2026-11-29 15:11 ` [PATCH v2 05/11] gpu: nova-core: gsp: logbuffer: add LogBuffers::init_arguments() Alexandre Courbot
2026-11-29 15:11 ` [PATCH v2 06/11] gpu: nova-core: gsp: logbuffer: make LogBuffer generic over its size Alexandre Courbot
2026-11-29 15:11 ` [PATCH v2 07/11] gpu: nova-core: gsp: logbuffer: add RetainedLogBuffers::is_empty() Alexandre Courbot
2026-11-29 15:11 ` [PATCH v2 08/11] gpu: nova-core: gsp: cmdq: reduce visibility of gsp-level constants Alexandre Courbot
2026-11-29 15:11 ` [PATCH v2 09/11] gpu: nova-core: gsp: compute the msgq entry offset in MsgqTxHeader::new() Alexandre Courbot
2026-11-29 15:11 ` [PATCH v2 10/11] gpu: nova-core: gsp: take all the msgq layout values from Cmdq " Alexandre Courbot
2026-11-29 15:11 ` [PATCH v2 11/11] gpu: nova-core: firmware: tlv: add method to load the file referenced by a TLV 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=20261130-nova-r000-staging-v2-4-afd079026a61@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®