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>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Eliot Courtney" <ecourtney@nvidia.com>,
	<nova-gpu@lists.linux.dev>
Subject: Re: [PATCH v2 3/7] gpu: nova-core: use the TLV heap sizes for pmu and non-wpr
Date: Fri, 20 Nov 2026 15:47:04 +0900	[thread overview]
Message-ID: <DMZU4K5Y7ARN.24GTSON4AGVVV@nvidia.com> (raw)
In-Reply-To: <20261116195441.940595-4-ttabi@nvidia.com>

On Tue Nov 17, 2026 at 4:54 AM JST, Timur Tabi wrote:
> Instead of using hard-coded per-GPU values for the Non-WPR heap
> size and the PMU reserved size, use the values from gsp.tlv instead.
>
> This change will allow us to remove those HAL functions from FbHal.
>
> Signed-off-by: Timur Tabi <ttabi@nvidia.com>
> ---
>  drivers/gpu/nova-core/fb.rs            | 16 +++++++++++-----
>  drivers/gpu/nova-core/fb/hal.rs        |  2 ++
>  drivers/gpu/nova-core/firmware/gsp.rs  |  8 +++++++-
>  drivers/gpu/nova-core/gsp.rs           |  1 +
>  drivers/gpu/nova-core/gsp/fw.rs        |  7 ++-----
>  drivers/gpu/nova-core/gsp/hal/gh100.rs |  2 +-
>  6 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs
> index b0c0b8fe6008..048d3c5e655f 100644
> --- a/drivers/gpu/nova-core/fb.rs
> +++ b/drivers/gpu/nova-core/fb.rs
> @@ -264,7 +264,7 @@ pub(crate) fn new(
>          };
>  
>          let non_wpr_heap = {
> -            let non_wpr_heap_size = hal.non_wpr_heap_size();
> +            let non_wpr_heap_size = gsp_fw.heap_params.tlv_non_wpr_heap_size;
>              FbRange(wpr2.start - non_wpr_heap_size..wpr2.start)

Now that this is using a firmware defined value, it's possible this
could underflow, so what about using checked_sub instead?

>          };
>  
> @@ -278,7 +278,7 @@ pub(crate) fn new(
>              wpr2,
>              non_wpr_heap,
>              vf_partition_count,
> -            pmu_reserved_size: hal.pmu_reserved_size(),
> +            pmu_reserved_size: gsp_fw.heap_params.tlv_pmu_reserved_size,
>          })
>      }
>  }
> @@ -328,7 +328,13 @@ pub(crate) struct FbSizes {
>  
>  impl FbSizes {
>      /// Computes the framebuffer region sizes for GSP-FMC boot.
> -    pub(crate) fn new(chipset: Chipset, bar: Bar0<'_>, vgpu_state: VgpuState) -> Result<Self> {
> +    pub(crate) fn new(
> +        chipset: Chipset,
> +        bar: Bar0<'_>,
> +        gsp_fw: &GspFirmware<'_>,
> +
> +        vgpu_state: VgpuState,

nit: blank line between gsp_fw and vgpu_state

> +    ) -> 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)?;
> @@ -336,8 +342,8 @@ pub(crate) fn new(chipset: Chipset, bar: Bar0<'_>, vgpu_state: VgpuState) -> Res
>          Ok(Self {
>              frts_size: hal.frts_size(),
>              wpr2_heap_size,
> -            non_wpr_heap_size: hal.non_wpr_heap_size(),
> -            pmu_reserved_size: hal.pmu_reserved_size(),
> +            non_wpr_heap_size: gsp_fw.heap_params.tlv_non_wpr_heap_size,
> +            pmu_reserved_size: gsp_fw.heap_params.tlv_pmu_reserved_size,
>              vf_partition_count,
>          })
>      }
> diff --git a/drivers/gpu/nova-core/fb/hal.rs b/drivers/gpu/nova-core/fb/hal.rs
> index 99363cfb116b..e30eb7de2a1c 100644
> --- a/drivers/gpu/nova-core/fb/hal.rs
> +++ b/drivers/gpu/nova-core/fb/hal.rs
> @@ -34,9 +34,11 @@ pub(crate) trait FbHal {
>      fn vidmem_size(&self, bar: Bar0<'_>) -> u64;
>  
>      /// Returns the amount of VRAM to reserve for the PMU.
> +    #[expect(unused)]
>      fn pmu_reserved_size(&self) -> u32;

Unfortunately MSRV rust 1.85 doesn't have as good a handling of
expect(unused) as the latest one, so this patch produces some unused
warnings.  If you want to keep this patch separate to patch 4, I think
it needs #[expect(dead_code)] on pmu_reserved_size_tu102(),
non_wpr_heap_size_tu102() and pmu_reserved_size_gb100(). Thanks!

With above comments resolved,

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

  reply	other threads:[~2026-11-20  6:47 UTC|newest]

Thread overview: 14+ 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-18  4:51   ` Eliot Courtney
2026-11-16 19:54 ` [PATCH v2 2/7] gpu: nova-core: read GSP heap variables from TLV Timur Tabi
2026-11-20  5:23   ` Eliot Courtney
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-20  6:47   ` Eliot Courtney [this message]
2026-11-16 19:54 ` [PATCH v2 4/7] gpu: nova-core: remove heap size related HAL functions Timur Tabi
2026-11-20  6:47   ` Eliot Courtney
2026-11-16 19:54 ` [PATCH v2 5/7] gpu: nova-core: add TLV versions of WPR heap size functions Timur Tabi
2026-11-20  7:01   ` Eliot Courtney
2026-11-16 19:54 ` [PATCH v2 6/7] gpu: nova-core: change wpr2_heap_params to use TLV values Timur Tabi
2026-11-16 19:54 ` [PATCH v2 7/7] gpu: nova-core: remove LibosParams Timur Tabi
2026-11-20  6:53   ` Eliot Courtney

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=DMZU4K5Y7ARN.24GTSON4AGVVV@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