mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] gpu: nova: Report compute properties of the GPU to userspace
@ 2026-12-04  4:06 Alistair Popple
  2026-12-04  4:06 ` [PATCH 1/2] gpu: nova-core: gsp: Add compute properties to GspStaticInfo Alistair Popple
  2026-12-04  4:06 ` [PATCH 2/2] drm: nova: Report compute properties in GPU info Alistair Popple
  0 siblings, 2 replies; 3+ messages in thread
From: Alistair Popple @ 2026-12-04  4:06 UTC (permalink / raw)
  To: Danilo Krummrich, Alexandre Courbot, David Airlie
  Cc: John Hubbard, nova-gpu, dri-devel, linux-kernel, rust-for-linux,
	Alistair Popple

Userspace compute drivers report a handful of static GPU properties to
applications. For example the CUDA deviceQuery sample prints the number
of streaming multiprocessors (SMs), the memory bus width, the L2 cache
size and the maximum graphics and memory clock rates.

GSP will soon report these properties as keys of the GMCAPI static
config, which it returns in reply to GSP_INIT. The first patch adds the
keys to the GSP_INIT response schema and to GspStaticInfo. The new keys
are all optional and decode as None if firmware does not provide them.

The second patch appends the properties to struct drm_nova_info_gpu. A
property which GSP does not provide is reported to userspace as zero.
Existing userspace is unaffected, as the kernel truncates what it writes
to the size userspace passes.

This series depends on the r000 series as it relies on GSP_INIT, so it
is based on drm-rust-next with the remainder of the r000 series applied.
Tested against a new firmware using drm-test to ensure values are
reported correctly.

A merge request will be raised there for testing.

Signed-off-by: Alistair Popple <apopple@nvidia.com>
---
Alistair Popple (2):
      gpu: nova-core: gsp: Add compute properties to GspStaticInfo
      drm: nova: Report compute properties in GPU info

 drivers/gpu/drm/nova/file.rs              |  6 +++++
 drivers/gpu/drm/nova/nova_drm_unstable.h  | 27 ++++++++++++++++++++
 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 +++++++++++++++++++++++++++++++
 5 files changed, 94 insertions(+)
---
base-commit: 594391a32cd30bc9ec863db1b310bcbcf370bfac
change-id: 20261204-nova_gpu_static_info_v2-e353310cf405

Best regards,
--  
Alistair Popple <apopple@nvidia.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] gpu: nova-core: gsp: Add compute properties to GspStaticInfo
  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
  2026-12-04  4:06 ` [PATCH 2/2] drm: nova: Report compute properties in GPU info Alistair Popple
  1 sibling, 0 replies; 3+ messages in thread
From: Alistair Popple @ 2026-12-04  4:06 UTC (permalink / raw)
  To: Danilo Krummrich, Alexandre Courbot, David Airlie
  Cc: John Hubbard, nova-gpu, dri-devel, linux-kernel, rust-for-linux,
	Alistair Popple

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] drm: nova: Report compute properties in GPU info
  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 ` [PATCH 1/2] gpu: nova-core: gsp: Add compute properties to GspStaticInfo Alistair Popple
@ 2026-12-04  4:06 ` Alistair Popple
  1 sibling, 0 replies; 3+ messages in thread
From: Alistair Popple @ 2026-12-04  4:06 UTC (permalink / raw)
  To: Danilo Krummrich, Alexandre Courbot, David Airlie
  Cc: John Hubbard, nova-gpu, dri-devel, linux-kernel, rust-for-linux,
	Alistair Popple

DRM_NOVA_INFO_GPU reports static properties of the GPU such as its
architecture, names and VRAM size.

nova-core now also provides the number of streaming multiprocessors
(SMs), the VRAM bus width, the L2 cache size and the maximum graphics
and memory clock frequencies in GspStaticInfo. Add them to struct
drm_nova_info_gpu. On older GSP firmware versions that don't report
these fields initialise them to zero.

Signed-off-by: Alistair Popple <apopple@nvidia.com>
---
 drivers/gpu/drm/nova/file.rs             |  6 ++++++
 drivers/gpu/drm/nova/nova_drm_unstable.h | 27 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/nova/file.rs b/drivers/gpu/drm/nova/file.rs
index 8b800f821e2c..e4e6acd39d1c 100644
--- a/drivers/gpu/drm/nova/file.rs
+++ b/drivers/gpu/drm/nova/file.rs
@@ -61,6 +61,12 @@ fn new(reg_data: &DrmRegData<'_>) -> Result<Self> {
             vram_size: gsp_static_info.vram_size(),
             vram_bar_size: reg_data.api.with(|api| api.bar1_size())?,
             gpu_gid: gsp_static_info.gpu_gid,
+            // The uAPI reports a value which the GSP does not provide as zero.
+            sm_count: gsp_static_info.sm_count.unwrap_or(0),
+            vram_bus_width: gsp_static_info.fb_bus_width.unwrap_or(0),
+            l2_cache_size: gsp_static_info.l2_cache_size.unwrap_or(0).into(),
+            max_graphics_clock: gsp_static_info.max_gpc_clk_hz.unwrap_or(0),
+            max_memory_clock: gsp_static_info.max_mem_clk_hz.unwrap_or(0),
             ..pin_init::zeroed()
         };
 
diff --git a/drivers/gpu/drm/nova/nova_drm_unstable.h b/drivers/gpu/drm/nova/nova_drm_unstable.h
index 3577dede15a6..23273ee596e0 100644
--- a/drivers/gpu/drm/nova/nova_drm_unstable.h
+++ b/drivers/gpu/drm/nova/nova_drm_unstable.h
@@ -189,6 +189,33 @@ struct drm_nova_info_gpu {
 	 * @gpu_gid: 16-byte SHA-1 GPU identifier supplied by GSP-RM.
 	 */
 	__u8 gpu_gid[16];
+
+	/**
+	 * @sm_count: Number of streaming multiprocessors (SMs), or 0 if unknown.
+	 */
+	__u32 sm_count;
+
+	/**
+	 * @vram_bus_width: Width of the VRAM memory bus in bits, or 0 if unknown.
+	 */
+	__u32 vram_bus_width;
+
+	/**
+	 * @l2_cache_size: Size of the GPU L2 cache in bytes, or 0 if unknown.
+	 */
+	__u64 l2_cache_size;
+
+	/**
+	 * @max_graphics_clock: Maximum frequency of the graphics clock in Hz, or
+	 * 0 if unknown.
+	 */
+	__u64 max_graphics_clock;
+
+	/**
+	 * @max_memory_clock: Maximum frequency of the memory clock in Hz, or 0 if
+	 * unknown.
+	 */
+	__u64 max_memory_clock;
 };
 
 #define DRM_NOVA_INFO			0x00

-- 
2.54.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-04  4:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 1/2] gpu: nova-core: gsp: Add compute properties to GspStaticInfo Alistair Popple
2026-12-04  4:06 ` [PATCH 2/2] drm: nova: Report compute properties in GPU info Alistair Popple

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®