From: Timur Tabi <ttabi@nvidia.com>
To: 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: [PATCH v3 3/7] gpu: nova-core: use the TLV heap sizes for pmu and non-wpr
Date: Fri, 20 Nov 2026 18:28:43 -0600 [thread overview]
Message-ID: <20261121002847.3358679-4-ttabi@nvidia.com> (raw)
In-Reply-To: <20261121002847.3358679-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>
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
---
drivers/gpu/nova-core/fb.rs | 21 +++++++++++++++------
drivers/gpu/nova-core/fb/hal.rs | 2 ++
drivers/gpu/nova-core/fb/hal/gb100.rs | 1 +
drivers/gpu/nova-core/fb/hal/tu102.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 +-
8 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs
index b0c0b8fe6008..b6ee4e48d5f6 100644
--- a/drivers/gpu/nova-core/fb.rs
+++ b/drivers/gpu/nova-core/fb.rs
@@ -264,8 +264,12 @@ pub(crate) fn new(
};
let non_wpr_heap = {
- let non_wpr_heap_size = hal.non_wpr_heap_size();
- FbRange(wpr2.start - non_wpr_heap_size..wpr2.start)
+ let non_wpr_start = wpr2
+ .start
+ .checked_sub(gsp_fw.heap_params.tlv_non_wpr_heap_size)
+ .ok_or(EOVERFLOW)?;
+
+ FbRange(non_wpr_start..wpr2.start)
};
Ok(Self {
@@ -278,7 +282,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 +332,12 @@ 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 +345,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/fb/hal/gb100.rs b/drivers/gpu/nova-core/fb/hal/gb100.rs
index 7e6dc40dff32..ff04cd25fad9 100644
--- a/drivers/gpu/nova-core/fb/hal/gb100.rs
+++ b/drivers/gpu/nova-core/fb/hal/gb100.rs
@@ -99,6 +99,7 @@ fn write_sysmem_flush_page_gb100(hshub0: Mmio<'_, regs::Hshub0Registers>, addr:
)
.unwrap();
+#[allow(dead_code)]
pub(super) const fn pmu_reserved_size_gb100() -> u32 {
cv!(PMU_RESERVED_SIZE)
}
diff --git a/drivers/gpu/nova-core/fb/hal/tu102.rs b/drivers/gpu/nova-core/fb/hal/tu102.rs
index bf5967cbffd3..d3c3c1adb9ce 100644
--- a/drivers/gpu/nova-core/fb/hal/tu102.rs
+++ b/drivers/gpu/nova-core/fb/hal/tu102.rs
@@ -42,10 +42,12 @@ pub(super) fn vidmem_size_gp102(bar: Bar0<'_>) -> u64 {
.usable_fb_size()
}
+#[allow(dead_code)]
pub(super) const fn pmu_reserved_size_tu102() -> u32 {
0
}
+#[allow(dead_code)]
pub(super) const fn non_wpr_heap_size_tu102() -> u64 {
u64::SZ_1M
}
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-21 0:29 UTC|newest]
Thread overview: 12+ 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-24 18:27 ` Timur Tabi
2026-11-21 0:28 ` Timur Tabi [this message]
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
2026-11-24 18:28 ` Timur Tabi
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=20261121002847.3358679-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.