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 3/7] gpu: nova-core: use the TLV heap sizes for pmu and non-wpr
Date: Mon, 16 Nov 2026 13:54:37 -0600 [thread overview]
Message-ID: <20261116195441.940595-4-ttabi@nvidia.com> (raw)
In-Reply-To: <20261116195441.940595-1-ttabi@nvidia.com>
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)
};
@@ -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,
+ ) -> 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;
/// Returns the non-WPR heap size for this chipset, in bytes.
+ #[expect(unused)]
fn non_wpr_heap_size(&self) -> u64;
/// Returns the FRTS size, in bytes.
diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs
index a2db7b6ba131..f1124238071c 100644
--- a/drivers/gpu/nova-core/firmware/gsp.rs
+++ b/drivers/gpu/nova-core/firmware/gsp.rs
@@ -18,7 +18,8 @@
Tlv,
},
},
- gpu::Chipset, //
+ gpu::Chipset,
+ gsp::GspFwHeapParams, //
};
/// The GSP firmware image, its signatures, and the GSP bootloader.
@@ -31,6 +32,8 @@ pub(crate) struct GspFirmware<'a> {
pub(crate) signatures: Coherent<'a, [u8]>,
/// GSP bootloader, verifies the GSP firmware before loading and running it.
pub(crate) bootloader: RiscvFirmware<'a>,
+ /// Heap sizing parameters reported by the firmware metadata.
+ pub(crate) heap_params: GspFwHeapParams,
}
impl<'a> GspFirmware<'a> {
@@ -49,6 +52,8 @@ pub(crate) fn new(
let signatures = Coherent::from_slice(dev, tlv.get_bytes(b"SIGN")?, GFP_KERNEL)?;
+ let heap_params = GspFwHeapParams::from_tlv(&tlv)?;
+
Ok(try_pin_init!(Self {
radix3 <- Radix3::new(dev, fw_vvec),
signatures,
@@ -57,6 +62,7 @@ pub(crate) fn new(
RiscvFirmware::new(dev, &bl)?
},
+ heap_params,
}))
})
}
diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
index 908d4ea72ad1..e487efd90b22 100644
--- a/drivers/gpu/nova-core/gsp.rs
+++ b/drivers/gpu/nova-core/gsp.rs
@@ -29,6 +29,7 @@
pub(crate) use fw::{
GspFmcBootParams,
+ GspFwHeapParams,
GspFwWprMeta,
LibosMemoryRegionInitArgument,
LibosParams, //
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index a44550b70d44..837f7a522429 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -76,10 +76,8 @@ pub(crate) struct GspFwHeapParams {
tlv_gsp_fw_heap_base_size_vgpu: u64,
#[expect(unused)]
tlv_gsp_fw_heap_size_per_vm: u64,
- #[expect(unused)]
- tlv_pmu_reserved_size: u32,
- #[expect(unused)]
- tlv_non_wpr_heap_size: u64,
+ pub(crate) tlv_pmu_reserved_size: u32,
+ pub(crate) tlv_non_wpr_heap_size: u64,
}
/// Minimum required alignment for the GSP heap.
@@ -100,7 +98,6 @@ fn base_rm_size(chipset: Chipset) -> u64 {
}
/// Returns the heap parameters from the TLV
- #[expect(unused)]
pub(crate) fn from_tlv(tlv: &Tlv<'_>) -> Result<Self> {
Ok(Self {
tlv_gsp_fw_heap_base_size: tlv.get_u64(b"HBSZ")?,
diff --git a/drivers/gpu/nova-core/gsp/hal/gh100.rs b/drivers/gpu/nova-core/gsp/hal/gh100.rs
index 91201b51030e..f43fbe3dd798 100644
--- a/drivers/gpu/nova-core/gsp/hal/gh100.rs
+++ b/drivers/gpu/nova-core/gsp/hal/gh100.rs
@@ -151,7 +151,7 @@ fn boot<'gpu>(
let chipset = ctx.chipset;
let gsp_falcon = ctx.gsp_falcon;
- let fb_sizes = FbSizes::new(chipset, ctx.bar, ctx.vgpu.state())?;
+ let fb_sizes = FbSizes::new(chipset, ctx.bar, gsp_fw, ctx.vgpu.state())?;
dev_dbg!(dev, "{:#x?}\n", fb_sizes);
let wpr_meta =
--
2.54.0
next prev 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 ` Timur Tabi [this message]
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 ` [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
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-4-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