[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <71e90bb8-b7de-48e7-a43a-68d1e73bbe6a@nvidia.com>
Date: Sun, 8 Feb 2026 18:05:43 -0800
From: John Hubbard <jhubbard@...dia.com>
To: Timur Tabi <ttabi@...dia.com>, Alexandre Courbot <acourbot@...dia.com>,
"dakr@...nel.org" <dakr@...nel.org>
Cc: "aliceryhl@...gle.com" <aliceryhl@...gle.com>,
"lossin@...nel.org" <lossin@...nel.org>,
"a.hindborg@...nel.org" <a.hindborg@...nel.org>,
"boqun.feng@...il.com" <boqun.feng@...il.com>, Zhi Wang <zhiw@...dia.com>,
"simona@...ll.ch" <simona@...ll.ch>,
"alex.gaynor@...il.com" <alex.gaynor@...il.com>,
"ojeda@...nel.org" <ojeda@...nel.org>, "tmgross@...ch.edu"
<tmgross@...ch.edu>,
"nouveau@...ts.freedesktop.org" <nouveau@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"rust-for-linux@...r.kernel.org" <rust-for-linux@...r.kernel.org>,
"bjorn3_gh@...tonmail.com" <bjorn3_gh@...tonmail.com>,
Eliot Courtney <ecourtney@...dia.com>, "airlied@...il.com"
<airlied@...il.com>, Joel Fernandes <joelagnelf@...dia.com>,
"bhelgaas@...gle.com" <bhelgaas@...gle.com>,
"gary@...yguo.net" <gary@...yguo.net>, Alistair Popple <apopple@...dia.com>
Subject: Re: [PATCH v3 25/30] gpu: nova-core: Hopper/Blackwell: larger WPR2
(GSP) heap
On 2/6/26 11:03 AM, Timur Tabi wrote:
> On Thu, 2026-02-05 at 20:21 -0800, John Hubbard wrote:
>> + fn client_alloc_size(chipset: Chipset) -> u64 {
>> + if crate::fb::hal::fb_hal(chipset)
>> + .non_wpr_heap_size()
>> + .is_some()
>> + {
>> + GSP_FW_HEAP_PARAM_CLIENT_ALLOC_SIZE_GH100
>> + } else {
>> + u64::from(bindings::GSP_FW_HEAP_PARAM_CLIENT_ALLOC_SIZE)
>> + }
>> + .align_up(GSP_HEAP_ALIGNMENT)
>> + .unwrap_or(u64::MAX)
>
> I understand not wanting to return a Result<> for impossible situations, but I don't know if this is
> the answer. For one thing, there is no way we can allocate a heap that large.
>
> Maybe we need to have some kind of infallible align_up() variant, but in this case, I would say a
> panic is warranted.
You are right. And that agrees with Miguel Ojeda's overall philosophy
about handling this type of error, too.
I'll change it to this for the next version:
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 0d1d9eecd77c..927bcee6a5a5 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -83,7 +83,7 @@ fn client_alloc_size(chipset: Chipset) -> u64 {
u64::from(bindings::GSP_FW_HEAP_PARAM_CLIENT_ALLOC_SIZE)
}
.align_up(GSP_HEAP_ALIGNMENT)
- .unwrap_or(u64::MAX)
+ .expect("client_alloc_size alignment overflow")
}
/// Returns the amount of memory to reserve for management purposes for a framebuffer of size
@@ -94,7 +94,7 @@ fn management_overhead(fb_size: u64) -> u64 {
u64::from(bindings::GSP_FW_HEAP_PARAM_SIZE_PER_GB_FB)
.saturating_mul(fb_size_gb)
.align_up(GSP_HEAP_ALIGNMENT)
- .unwrap_or(u64::MAX)
+ .expect("management_overhead alignment overflow")
}
}
thanks,
--
John Hubbard
Powered by blists - more mailing lists