On Wed Dec 3, 2025 at 5:59 AM GMT, John Hubbard wrote:
> Hopper, Blackwell and later require more space for the non-WPR heap.
>
> Signed-off-by: John Hubbard <[email protected]>
> ---
>  drivers/gpu/nova-core/fb.rs  | 15 ++++++++++++---
>  drivers/gpu/nova-core/fsp.rs |  2 +-
>  2 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs
> index e697436de29a..a402a9fe86f8 100644
> --- a/drivers/gpu/nova-core/fb.rs
> +++ b/drivers/gpu/nova-core/fb.rs
> @@ -98,6 +98,16 @@ pub(crate) fn unregister(&self, bar: &Bar0) {
>      }
>  }
>  
> +/// Calculate non-WPR heap size based on chipset architecture.
> +/// This matches the logic used in FSP for consistency.
> +pub(crate) fn calc_non_wpr_heap_size(chipset: Chipset) -> u64 {
> +    if chipset.needs_large_reserved_mem() {
> +        0x220000 // ~2.1MB for Hopper/Blackwell+
> +    } else {
> +        SZ_1M as u64 // 1MB for older architectures
> +    }
> +}

I think the patch that introduces the function should be merged with this one.

Best,
Gary

> +
>  pub(crate) struct FbRange(Range<u64>);
>  
>  impl FbRange {
> @@ -238,9 +248,8 @@ pub(crate) fn new(chipset: Chipset, bar: &Bar0, gsp_fw: 
> &GspFirmware) -> Result<
>          };
>  
>          let heap = {
> -            const HEAP_SIZE: u64 = usize_as_u64(SZ_1M);
> -
> -            FbRange(wpr2.start - HEAP_SIZE..wpr2.start)
> +            let heap_size = calc_non_wpr_heap_size(chipset);
> +            FbRange(wpr2.start - heap_size..wpr2.start)
>          };
>  
>          // Calculate reserved sizes. PMU reservation is a subset of the 
> total reserved size.
> diff --git a/drivers/gpu/nova-core/fsp.rs b/drivers/gpu/nova-core/fsp.rs
> index 5840ab78e79f..7d46fbcc7abd 100644
> --- a/drivers/gpu/nova-core/fsp.rs
> +++ b/drivers/gpu/nova-core/fsp.rs
> @@ -454,7 +454,7 @@ pub(crate) fn boot_gsp_fmc_with_signatures(
>          // frts_offset is relative to FB end: FRTS_location = FB_END - 
> frts_offset
>          let frts_offset = if !resume {
>              let mut frts_reserved_size = if 
> chipset.needs_large_reserved_mem() {
> -                0x220000 // heap_size_non_wpr for Hopper/Blackwell+
> +                crate::fb::calc_non_wpr_heap_size(chipset)
>              } else {
>                  total_reserved_size
>              };

Reply via email to