NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
From: Timur Tabi <ttabi@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
	Alexandre Courbot <acourbot@nvidia.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Eliot Courtney <ecourtney@nvidia.com>, <nova-gpu@lists.linux.dev>
Subject: [PATCH v2 6/7] gpu: nova-core: change wpr2_heap_params to use TLV values
Date: Mon, 16 Nov 2026 13:54:40 -0600	[thread overview]
Message-ID: <20261116195441.940595-7-ttabi@nvidia.com> (raw)
In-Reply-To: <20261116195441.940595-1-ttabi@nvidia.com>

Now that GspFwHeapParams has TLV-based implementations of wpr_heap_size()
and vgpu_wpr_heap_size(), change wpr2_heap_params() to use those
functions instead of the LibosParams versions.  This renders LibosParams
unused, and it is marked as such.

Signed-off-by: Timur Tabi <ttabi@nvidia.com>
---
 drivers/gpu/nova-core/fb.rs     | 20 +++++++++++---------
 drivers/gpu/nova-core/gsp.rs    |  3 +--
 drivers/gpu/nova-core/gsp/fw.rs |  3 +--
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs
index 048d3c5e655f..ca1cb4af9ca5 100644
--- a/drivers/gpu/nova-core/fb.rs
+++ b/drivers/gpu/nova-core/fb.rs
@@ -242,7 +242,8 @@ pub(crate) fn new(
             FbRange(fw_image_addr..fw_image_addr + fw_image_size)
         };
 
-        let (vf_partition_count, wpr2_heap_size) = wpr2_heap_params(chipset, vgpu_state, fb.end)?;
+        let (vf_partition_count, wpr2_heap_size) =
+            wpr2_heap_params(&gsp_fw.heap_params, vgpu_state, fb.end)?;
 
         let wpr2_heap = {
             const WPR2_HEAP_DOWN_ALIGN: Alignment = Alignment::new::<SZ_1M>();
@@ -298,15 +299,16 @@ pub(crate) fn wpr2_range(bar: Bar0<'_>) -> Option<Range<u64>> {
 }
 
 /// Computes the number of VF partitions and the WPR2 heap size from the vGPU state.
-fn wpr2_heap_params(chipset: Chipset, vgpu_state: VgpuState, fb_size: u64) -> Result<(u8, u64)> {
+fn wpr2_heap_params(
+    heap_params: &gsp::GspFwHeapParams,
+    vgpu_state: VgpuState,
+    fb_size: u64,
+) -> Result<(u8, u64)> {
     Ok(match vgpu_state {
-        VgpuState::Disabled => (
-            0,
-            gsp::LibosParams::from_chipset(chipset).wpr_heap_size(chipset, fb_size)?,
-        ),
+        VgpuState::Disabled => (0, heap_params.wpr_heap_size(fb_size)?),
         VgpuState::Enabled { total_vfs } => (
             u8::try_from(total_vfs.get()).map_err(|_| EINVAL)?,
-            gsp::LibosParams::vgpu_wpr_heap_size(),
+            heap_params.vgpu_wpr_heap_size(total_vfs.get())?,
         ),
     })
 }
@@ -332,12 +334,12 @@ pub(crate) fn new(
         chipset: Chipset,
         bar: Bar0<'_>,
         gsp_fw: &GspFirmware<'_>,
-
         vgpu_state: VgpuState,
     ) -> Result<Self> {
         let hal = hal::fb_hal(chipset);
         let fb_size = hal.vidmem_size(bar);
-        let (vf_partition_count, wpr2_heap_size) = wpr2_heap_params(chipset, vgpu_state, fb_size)?;
+        let (vf_partition_count, wpr2_heap_size) =
+            wpr2_heap_params(&gsp_fw.heap_params, vgpu_state, fb_size)?;
 
         Ok(Self {
             frts_size: hal.frts_size(),
diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
index e487efd90b22..85ef94a8b5c7 100644
--- a/drivers/gpu/nova-core/gsp.rs
+++ b/drivers/gpu/nova-core/gsp.rs
@@ -31,8 +31,7 @@
     GspFmcBootParams,
     GspFwHeapParams,
     GspFwWprMeta,
-    LibosMemoryRegionInitArgument,
-    LibosParams, //
+    LibosMemoryRegionInitArgument, //
 };
 pub(crate) use hal::boot_firmware_files;
 
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index a0277ba6dc88..03deabfc2f06 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -125,7 +125,6 @@ fn management_overhead(fb_size: u64) -> Result<u64> {
     }
 
     /// Returns the WPR heap size to reserve when vGPU is enabled.
-    #[expect(unused)]
     pub(crate) fn vgpu_wpr_heap_size(&self, total_vfs: u16) -> Result<u64> {
         //u64::from(bindings::GSP_FW_HEAP_SIZE_VGPU_DEFAULT)
         let vm_size = self
@@ -139,7 +138,6 @@ pub(crate) fn vgpu_wpr_heap_size(&self, total_vfs: u16) -> Result<u64> {
 
     /// Returns the amount of memory (in bytes) to allocate for the WPR heap for a framebuffer size
     /// of `fb_size` (in bytes).
-    #[expect(unused)]
     pub(crate) fn wpr_heap_size(&self, fb_size: u64) -> Result<u64> {
         let fb_size_gb = fb_size.div_ceil(u64::SZ_1G);
         let management_overhead: u64 = self
@@ -162,6 +160,7 @@ pub(crate) struct LibosParams {
     allowed_heap_size: Range<u64>,
 }
 
+#[expect(unused)]
 impl LibosParams {
     /// Version 2 of the GSP LIBOS (Turing and GA100)
     const LIBOS2: LibosParams = LibosParams {
-- 
2.54.0


  parent reply	other threads:[~2026-11-16 19:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 19:54 [PATCH v2 0/7] Transition nova-core to use TLV variables for heap sizes Timur Tabi
2026-11-16 19:54 ` [PATCH v2 1/7] gpu: nova-core: add Tlv.get_u64 Timur Tabi
2026-11-16 19:54 ` [PATCH v2 2/7] gpu: nova-core: read GSP heap variables from TLV Timur Tabi
2026-11-16 19:54 ` [PATCH v2 3/7] gpu: nova-core: use the TLV heap sizes for pmu and non-wpr Timur Tabi
2026-11-16 19:54 ` [PATCH v2 4/7] gpu: nova-core: remove heap size related HAL functions Timur Tabi
2026-11-16 19:54 ` [PATCH v2 5/7] gpu: nova-core: add TLV versions of WPR heap size functions Timur Tabi
2026-11-16 19:54 ` Timur Tabi [this message]
2026-11-16 19:54 ` [PATCH v2 7/7] gpu: nova-core: remove LibosParams Timur Tabi

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=20261116195441.940595-7-ttabi@nvidia.com \
    --to=ttabi@nvidia.com \
    --cc=acourbot@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=ecourtney@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=nova-gpu@lists.linux.dev \
    /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