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 7/7] gpu: nova-core: remove LibosParams
Date: Mon, 16 Nov 2026 13:54:41 -0600 [thread overview]
Message-ID: <20261116195441.940595-8-ttabi@nvidia.com> (raw)
In-Reply-To: <20261116195441.940595-1-ttabi@nvidia.com>
All functionality that was provided by LibosParams has now been replaced
with TLV-based implementations in GspFwHeapParams, so we can remove
LibosParams and all its dependencies.
This also allows us to remove the legacy methods base_rm_size(),
client_alloc_size(), and management_overhead(). These were used to
calculate intermediate values that are now represented by TLV values.
LibosParams and GspFwHeapParams were two types used to hold data and/or
methods for calculating the heap sides that GSP-RM needs for booting.
Although they technically represent distinct parts of the equations,
they were always used together, so it makes sense to merge LibosParams
into GspFwHeapParams.
Signed-off-by: Timur Tabi <ttabi@nvidia.com>
---
drivers/gpu/nova-core/gsp/fw.rs | 96 ---------------------------------
1 file changed, 96 deletions(-)
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 03deabfc2f06..a979e6a8d385 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -7,8 +7,6 @@
// Alias to avoid repeating the version number with every use.
use r000_00 as bindings;
-use core::ops::Range;
-
use kernel::{
bitfield,
dma::Coherent,
@@ -40,10 +38,6 @@
gsp::GspFirmware,
tlv::Tlv, //
},
- gpu::{
- Architecture,
- Chipset, //
- },
gsp::{
cmdq::Cmdq,
GSP_PAGE_SHIFT,
@@ -80,19 +74,6 @@ pub(crate) struct GspFwHeapParams {
const GSP_HEAP_ALIGNMENT: Alignment = Alignment::new::<{ 1 << 20 }>();
impl GspFwHeapParams {
- /// Returns the amount of GSP-RM heap memory used during GSP-RM boot and initialization (up to
- /// and including the first client subdevice allocation).
- fn base_rm_size(chipset: Chipset) -> u64 {
- match chipset.arch() {
- Architecture::Turing | Architecture::Ampere | Architecture::Ada => {
- u64::from(bindings::GSP_FW_HEAP_PARAM_BASE_RM_SIZE_TU10X)
- }
- Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => {
- u64::from(bindings::GSP_FW_HEAP_PARAM_BASE_RM_SIZE_GH100)
- }
- }
- }
-
/// Returns the heap parameters from the TLV
pub(crate) fn from_tlv(tlv: &Tlv<'_>) -> Result<Self> {
Ok(Self {
@@ -105,25 +86,6 @@ pub(crate) fn from_tlv(tlv: &Tlv<'_>) -> Result<Self> {
})
}
- /// Returns the amount of heap memory required to support a single channel allocation.
- fn client_alloc_size() -> u64 {
- u64::from(bindings::GSP_FW_HEAP_PARAM_CLIENT_ALLOC_SIZE)
- .align_up(GSP_HEAP_ALIGNMENT)
- .unwrap_or(u64::MAX)
- }
-
- /// Returns the amount of memory to reserve for management purposes for a framebuffer of size
- /// `fb_size`.
- fn management_overhead(fb_size: u64) -> Result<u64> {
- let fb_size_gb = fb_size.div_ceil(u64::SZ_1G);
-
- u64::from(bindings::GSP_FW_HEAP_PARAM_SIZE_PER_GB)
- .checked_mul(fb_size_gb)
- .ok_or(EINVAL)?
- .align_up(GSP_HEAP_ALIGNMENT)
- .ok_or(EINVAL)
- }
-
/// Returns the WPR heap size to reserve when vGPU is enabled.
pub(crate) fn vgpu_wpr_heap_size(&self, total_vfs: u16) -> Result<u64> {
//u64::from(bindings::GSP_FW_HEAP_SIZE_VGPU_DEFAULT)
@@ -152,64 +114,6 @@ pub(crate) fn wpr_heap_size(&self, fb_size: u64) -> Result<u64> {
}
}
-/// Heap memory requirements and constraints for a given version of the GSP LIBOS.
-pub(crate) struct LibosParams {
- /// The base amount of heap required by the GSP operating system, in bytes.
- carveout_size: u64,
- /// The minimum and maximum sizes allowed for the GSP FW heap, in bytes.
- allowed_heap_size: Range<u64>,
-}
-
-#[expect(unused)]
-impl LibosParams {
- /// Version 2 of the GSP LIBOS (Turing and GA100)
- const LIBOS2: LibosParams = LibosParams {
- carveout_size: cv!(bindings::GSP_FW_HEAP_PARAM_OS_SIZE_LIBOS2),
- allowed_heap_size: cv!(bindings::GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS2_MIN_MB => u64)
- * u64::SZ_1M
- ..cv!(bindings::GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS2_MAX_MB => u64) * u64::SZ_1M,
- };
-
- /// Version 3 of the GSP LIBOS (GA102+)
- const LIBOS3: LibosParams = LibosParams {
- carveout_size: cv!(bindings::GSP_FW_HEAP_PARAM_OS_SIZE_LIBOS3_BAREMETAL),
- allowed_heap_size: cv!(bindings::GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS3_BAREMETAL_MIN_MB => u64)
- * u64::SZ_1M
- ..cv!(bindings::GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS3_BAREMETAL_MAX_MB => u64) * u64::SZ_1M,
- };
-
- /// Returns the libos parameters corresponding to `chipset`.
- pub(crate) fn from_chipset(chipset: Chipset) -> &'static LibosParams {
- if chipset < Chipset::GA102 {
- &Self::LIBOS2
- } else {
- &Self::LIBOS3
- }
- }
-
- /// Returns the WPR heap size to reserve when vGPU is enabled.
- pub(crate) fn vgpu_wpr_heap_size() -> u64 {
- u64::from(bindings::GSP_FW_HEAP_SIZE_VGPU_DEFAULT)
- }
-
- /// Returns the amount of memory (in bytes) to allocate for the WPR heap for a framebuffer size
- /// of `fb_size` (in bytes) for `chipset`.
- pub(crate) fn wpr_heap_size(&self, chipset: Chipset, fb_size: u64) -> Result<u64> {
- // The WPR heap will contain the following:
- // LIBOS carveout,
- Ok(self
- .carveout_size
- // RM boot working memory,
- .saturating_add(GspFwHeapParams::base_rm_size(chipset))
- // One RM client,
- .saturating_add(GspFwHeapParams::client_alloc_size())
- // Overhead for memory management.
- .saturating_add(GspFwHeapParams::management_overhead(fb_size)?)
- // Clamp to the supported heap sizes.
- .clamp(self.allowed_heap_size.start, self.allowed_heap_size.end - 1))
- }
-}
-
/// Structure passed to the GSP bootloader, containing the framebuffer layout as well as the DMA
/// addresses of the GSP bootloader and firmware.
#[repr(transparent)]
--
2.54.0
prev parent reply other threads:[~2026-11-16 19:55 UTC|newest]
Thread overview: 9+ 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-16 19:54 ` [PATCH v2 3/7] gpu: nova-core: use the TLV heap sizes for pmu and non-wpr Timur Tabi
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 ` Timur Tabi [this message]
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-8-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.