[PATCH v2 05/32] gpu: nova-core: gsp: expose the VMMU segment size

From: Zhi Wang

Date: Mon Sep 14 2026 - 04:12:58 EST


GSP_INIT reports the VMMU segment size needed to align vGPU guest memory
allocations.

Add a getter for the existing decoded value and propagate it into
GetGspStaticInfoReply. Keep zero when firmware omits the optional key.

Cc: Alexandre Courbot <acourbot@xxxxxxxxxx>
Signed-off-by: Zhi Wang <zhiw@xxxxxxxxxx>
---
drivers/gpu/nova-core/gsp/commands.rs | 4 ++++
drivers/gpu/nova-core/gsp/fw/commands.rs | 5 +++++
2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index 09223bc3b793..afc32c2a230e 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -53,6 +53,9 @@ pub(crate) struct GetGspStaticInfoReply {
pub(crate) usable_fb_regions: KVec<Range<u64>>,
/// Exclusive end of the FB physical address space.
pub(crate) total_fb_end: u64,
+ /// VMMU segment size in bytes, or zero if GSP-RM omitted it.
+ #[expect(dead_code)]
+ pub(crate) vmmu_segment_size: u64,
}

/// Error type for [`GetGspStaticInfoReply::gpu_name`].
@@ -276,6 +279,7 @@ fn decode_gsp_info(words: &[u64]) -> Result<GetGspStaticInfoReply> {
bar1_pde_base: decoded.bar1_pde_base(),
usable_fb_regions,
total_fb_end: decoded.total_fb_end().ok_or(EINVAL)?,
+ vmmu_segment_size: decoded.vmmu_segment_size(),
})
}

diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 2b9f8edb039d..c2e199688b79 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -367,6 +367,11 @@ pub(crate) fn total_fb_end(&self) -> Option<u64> {
.max()?
.checked_add(1)
}
+
+ /// Returns the VMMU segment size in bytes, or zero if GSP-RM omitted it.
+ pub(in crate::gsp) const fn vmmu_segment_size(&self) -> u64 {
+ self.vmmu_segment_size
+ }
}

nvkv_decode! {