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 <[email protected]>
---
 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

Reply via email to