NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
From: "Eliot Courtney" <ecourtney@nvidia.com>
To: "Timur Tabi" <ttabi@nvidia.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Eliot Courtney" <ecourtney@nvidia.com>,
	"John Hubbard" <jhubbard@nvidia.com>, <nova-gpu@lists.linux.dev>
Subject: Re: [PATCH v3 5/7] gpu: nova-core: add TLV versions of WPR heap size functions
Date: Tue, 24 Nov 2026 15:56:03 +0900	[thread overview]
Message-ID: <DN38TM2JOCRB.2FWSW6TESHUT4@nvidia.com> (raw)
In-Reply-To: <20261121002847.3358679-6-ttabi@nvidia.com>

On Sat Nov 21, 2026 at 9:28 AM JST, Timur Tabi wrote:
> Add TLV versions of vgpu_wpr_heap_size() and wpr_heap_size() to
> GspFwHeapParams.  These complement the same functions in LibosParams.
> We add them to GspFwHeapParams because LibosParams will be removed
> in a future commit, and the driver will use the GspFwHeapParams
> version instead.
>
> Signed-off-by: Timur Tabi <ttabi@nvidia.com>
> ---
>  drivers/gpu/nova-core/gsp/fw.rs | 33 +++++++++++++++++++++++++++++----
>  1 file changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
> index 837f7a522429..66f5bb1d0a8f 100644
> --- a/drivers/gpu/nova-core/gsp/fw.rs
> +++ b/drivers/gpu/nova-core/gsp/fw.rs
> @@ -68,13 +68,9 @@
>  
>  /// Heap memory requirements and constraints for booting GSP-RM.
>  pub(crate) struct GspFwHeapParams {
> -    #[expect(unused)]
>      tlv_gsp_fw_heap_base_size: u64,
> -    #[expect(unused)]
>      tlv_gsp_hw_heap_size_per_gb: u64,
> -    #[expect(unused)]
>      tlv_gsp_fw_heap_base_size_vgpu: u64,
> -    #[expect(unused)]
>      tlv_gsp_fw_heap_size_per_vm: u64,
>      pub(crate) tlv_pmu_reserved_size: u32,
>      pub(crate) tlv_non_wpr_heap_size: u64,
> @@ -127,6 +123,35 @@ fn management_overhead(fb_size: u64) -> Result<u64> {
>              .align_up(GSP_HEAP_ALIGNMENT)
>              .ok_or(EINVAL)
>      }
> +
> +    /// 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)

nit: stray commented out code

> +        let vm_size = self
> +            .tlv_gsp_fw_heap_size_per_vm
> +            .checked_mul(u64::from(total_vfs))
> +            .and_then(|size| size.align_up(GSP_HEAP_ALIGNMENT))
> +            .ok_or(EINVAL)?;
> +
> +        Ok(self.tlv_gsp_fw_heap_base_size_vgpu.saturating_add(vm_size))

nit: pretty easy to checked_add here too imo

With above changes:
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>


  reply	other threads:[~2026-11-24  6:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21  0:28 [PATCH v3 0/7] Transition nova-core to use TLV variables for heap sizes Timur Tabi
2026-11-21  0:28 ` [PATCH v3 1/7] gpu: nova-core: add Tlv.get_u64 Timur Tabi
2026-11-21  0:28 ` [PATCH v3 2/7] gpu: nova-core: read GSP heap variables from TLV Timur Tabi
2026-11-24  6:48   ` Eliot Courtney
2026-11-21  0:28 ` [PATCH v3 3/7] gpu: nova-core: use the TLV heap sizes for pmu and non-wpr Timur Tabi
2026-11-21  0:28 ` [PATCH v3 4/7] gpu: nova-core: remove heap size related HAL functions Timur Tabi
2026-11-21  0:28 ` [PATCH v3 5/7] gpu: nova-core: add TLV versions of WPR heap size functions Timur Tabi
2026-11-24  6:56   ` Eliot Courtney [this message]
2026-11-21  0:28 ` [PATCH v3 6/7] gpu: nova-core: change wpr2_heap_params to use TLV values Timur Tabi
2026-11-21  0:28 ` [PATCH v3 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=DN38TM2JOCRB.2FWSW6TESHUT4@nvidia.com \
    --to=ecourtney@nvidia.com \
    --cc=acourbot@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=jhubbard@nvidia.com \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ttabi@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