mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alistair Popple <apopple@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
	 Alexandre Courbot <acourbot@nvidia.com>,
	David Airlie <airlied@gmail.com>
Cc: John Hubbard <jhubbard@nvidia.com>,
	nova-gpu@lists.linux.dev,  dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,  rust-for-linux@vger.kernel.org,
	Alistair Popple <apopple@nvidia.com>
Subject: [PATCH 1/2] gpu: nova-core: gsp: Add compute properties to GspStaticInfo
Date: Fri, 04 Dec 2026 15:06:13 +1100	[thread overview]
Message-ID: <20261204-nova_gpu_static_info_v2-v1-1-162bc6bf0a4a@nvidia.com> (raw)
In-Reply-To: <20261204-nova_gpu_static_info_v2-v1-0-162bc6bf0a4a@nvidia.com>

GspStaticInfo holds the static GPU configuration which GSP returns in
reply to GSP_INIT, such as the GPU names, the GID and the FB regions.

GSP reports these as keys of the GMCAPI static config, so add them
to the GSP_INIT response schema and to GspStaticInfo. A subsequent patch
allows nova-drm to report them to userspace.

None of the keys are required. Firmware which predates a key does not
send it, in which case the value decodes as None. GSP also reports zero
for a clock it cannot determine, so zero means unknown for all of these.

Signed-off-by: Alistair Popple <apopple@nvidia.com>
---
 drivers/gpu/nova-core/gsp/commands.rs     | 14 +++++++++++
 drivers/gpu/nova-core/gsp/commands/gmc.rs |  5 ++++
 drivers/gpu/nova-core/gsp/fw/commands.rs  | 42 +++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)

diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index 985cfc2a958e..e7281fb8997e 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -23,6 +23,20 @@ pub struct GspStaticInfo {
     pub(crate) usable_fb_regions: KVec<Range<u64>>,
     /// Exclusive end of the FB physical address space.
     pub(crate) total_fb_end: u64,
+    /// Number of streaming multiprocessors (SMs), or `None` if GSP does not report it.
+    pub sm_count: Option<u32>,
+    /// Width of the FB memory bus in bits, or `None` if GSP does not report it.
+    pub fb_bus_width: Option<u32>,
+    /// Size of the GPU L2 cache in bytes, or `None` if GSP does not report it.
+    pub l2_cache_size: Option<u32>,
+    /// Maximum frequency of the graphics clock in Hz, or `None` if GSP does not report it.
+    ///
+    /// GSP reports zero if it cannot determine the frequency.
+    pub max_gpc_clk_hz: Option<u64>,
+    /// Maximum frequency of the memory clock in Hz, or `None` if GSP does not report it.
+    ///
+    /// GSP reports zero if it cannot determine the frequency.
+    pub max_mem_clk_hz: Option<u64>,
 }
 
 /// Error type for [`GspStaticInfo::gpu_name`].
diff --git a/drivers/gpu/nova-core/gsp/commands/gmc.rs b/drivers/gpu/nova-core/gsp/commands/gmc.rs
index a6cc5759c2a2..0b19acbdbed7 100644
--- a/drivers/gpu/nova-core/gsp/commands/gmc.rs
+++ b/drivers/gpu/nova-core/gsp/commands/gmc.rs
@@ -190,6 +190,11 @@ fn read(payload: &mut SBufferIter<core::array::IntoIter<&[u8], 2>>) -> Result<Se
             bar1_pde_base: reply.bar1_pde_base(),
             usable_fb_regions,
             total_fb_end: reply.total_fb_end().ok_or(EINVAL)?,
+            sm_count: reply.sm_count(),
+            fb_bus_width: reply.fb_bus_width(),
+            l2_cache_size: reply.l2_cache_size(),
+            max_gpc_clk_hz: reply.max_gpc_clk_hz(),
+            max_mem_clk_hz: reply.max_mem_clk_hz(),
         })
     }
 }
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 9083175ee6e5..48a327082358 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -26,6 +26,7 @@
             Encodable,
             Encoder,
             Key,
+            Optional,
             Required,
             TruncatingArray, //
         },
@@ -334,6 +335,11 @@ pub(crate) struct GspInitResponseSchema => GspInitResponse {
         fb_regions: Accumulated<FbRegionSchema>,
         bar1_pde_base: Required<Key<u64, 0x1020>>,
         vmmu_segment_size: Key<u64, 0x1050>,
+        sm_count: Optional<Key<u32, 0x0400>>,
+        fb_bus_width: Optional<Key<u32, 0x0401>>,
+        l2_cache_size: Optional<Key<u32, 0x0402>>,
+        max_gpc_clk_hz: Optional<Key<u64, 0x1060>>,
+        max_mem_clk_hz: Optional<Key<u64, 0x1061>>,
     }
 }
 
@@ -345,6 +351,11 @@ pub(crate) struct GspInitResponse {
     fb_regions: KVVec<FbRegion>,
     bar1_pde_base: u64,
     vmmu_segment_size: u64,
+    sm_count: Option<u32>,
+    fb_bus_width: Option<u32>,
+    l2_cache_size: Option<u32>,
+    max_gpc_clk_hz: Option<u64>,
+    max_mem_clk_hz: Option<u64>,
 }
 
 impl GspInitResponse {
@@ -402,6 +413,37 @@ pub(crate) fn total_fb_end(&self) -> Option<u64> {
     pub(crate) fn bar1_pde_base(&self) -> u64 {
         self.bar1_pde_base
     }
+
+    /// Returns the number of streaming multiprocessors (SMs), or `None` if GSP did not send it.
+    pub(crate) fn sm_count(&self) -> Option<u32> {
+        self.sm_count
+    }
+
+    /// Returns the width of the FB memory bus in bits, or `None` if GSP did not send it.
+    pub(crate) fn fb_bus_width(&self) -> Option<u32> {
+        self.fb_bus_width
+    }
+
+    /// Returns the size of the GPU L2 cache in bytes, or `None` if GSP did not send it.
+    pub(crate) fn l2_cache_size(&self) -> Option<u32> {
+        self.l2_cache_size
+    }
+
+    /// Returns the maximum frequency of the graphics clock in Hz, or `None` if GSP did not
+    /// send it.
+    ///
+    /// GSP sends zero if it could not determine the frequency.
+    pub(crate) fn max_gpc_clk_hz(&self) -> Option<u64> {
+        self.max_gpc_clk_hz
+    }
+
+    /// Returns the maximum frequency of the memory clock in Hz, or `None` if GSP did not send
+    /// it.
+    ///
+    /// GSP sends zero if it could not determine the frequency.
+    pub(crate) fn max_mem_clk_hz(&self) -> Option<u64> {
+        self.max_mem_clk_hz
+    }
 }
 
 nvkv_decode! {

-- 
2.54.0


  reply	other threads:[~2026-12-04  4:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  4:06 [PATCH 0/2] gpu: nova: Report compute properties of the GPU to userspace Alistair Popple
2026-12-04  4:06 ` Alistair Popple [this message]
2026-12-04  4:06 ` [PATCH 2/2] drm: nova: Report compute properties in GPU info Alistair Popple

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=20261204-nova_gpu_static_info_v2-v1-1-162bc6bf0a4a@nvidia.com \
    --to=apopple@nvidia.com \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    /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®