From: Alexandre Courbot <acourbot@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
Alice Ryhl <aliceryhl@google.com>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>, Gary Guo <gary@garyguo.net>
Cc: John Hubbard <jhubbard@nvidia.com>,
Alistair Popple <apopple@nvidia.com>,
Timur Tabi <ttabi@nvidia.com>,
Eliot Courtney <ecourtney@nvidia.com>,
Zhi Wang <zhiw@nvidia.com>,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
Alexandre Courbot <acourbot@nvidia.com>
Subject: [PATCH v2 05/13] gpu: nova-core: gsp: move unload bundle error handling to Gsp::boot
Date: Mon, 22 Jun 2026 16:10:27 +0900 [thread overview]
Message-ID: <20260622-nova-bootcontext-v2-5-0ddeafc06f5d@nvidia.com> (raw)
In-Reply-To: <20260622-nova-bootcontext-v2-0-0ddeafc06f5d@nvidia.com>
The warning emitted when the unload bundle cannot be constructed is valid
regardless of the boot method, but it was local to `Tu102`. Move it to
`Gsp::boot` so it applies to all boot methods.
This requires the HAL's `boot` method to return the `Result` for the
unload bundle's creation, so `Gsp::boot` can display the warning.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drivers/gpu/nova-core/gsp/boot.rs | 12 ++++++++++++
drivers/gpu/nova-core/gsp/hal.rs | 4 ++--
drivers/gpu/nova-core/gsp/hal/gh100.rs | 6 +++---
drivers/gpu/nova-core/gsp/hal/tu102.rs | 13 ++-----------
4 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index 3574f1a87344..3f11eaec26c7 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -59,6 +59,18 @@ pub(crate) fn boot(
// Perform the chipset-specific boot sequence, and retrieve the unload bundle.
let (res, unload_bundle) = hal.boot(&self, &ctx, &fb_layout, &wpr_meta);
+ // Display error for unload bundle if any, and convert to `Option`.
+ let unload_bundle = unload_bundle
+ .inspect_err(|e| {
+ dev_warn!(dev, "Failed to prepare unload firmware: {:?}\n", e);
+ dev_warn!(dev, "The GSP won't be able to unload properly on unbind.\n");
+ dev_warn!(
+ dev,
+ "The GPU will need to be reset before the driver can bind again.\n"
+ );
+ })
+ .ok();
+
// Run from a closure so we can retrieve the result, and run the unload sequence of the GSP
// in case of error.
let res = res.and_then(|()| {
diff --git a/drivers/gpu/nova-core/gsp/hal.rs b/drivers/gpu/nova-core/gsp/hal.rs
index a76be4e43272..00e39cc1fbde 100644
--- a/drivers/gpu/nova-core/gsp/hal.rs
+++ b/drivers/gpu/nova-core/gsp/hal.rs
@@ -53,7 +53,7 @@ pub(super) trait GspHal: Send {
/// Returns two things:
///
/// - The `Result` of the boot process itself,
- /// - The `UnloadBundle` to use with [`Gsp::unload`], or `None` if the bundle could not be
+ /// - The `UnloadBundle` to use with [`Gsp::unload`], or `Err` if the bundle could not be
/// created.
///
/// Note that the two returned values are independent: it is possible for the boot process to
@@ -65,7 +65,7 @@ fn boot(
ctx: &GspBootContext<'_>,
fb_layout: &FbLayout,
wpr_meta: &Coherent<GspFwWprMeta>,
- ) -> (Result, Option<crate::gsp::UnloadBundle>);
+ ) -> (Result, Result<crate::gsp::UnloadBundle>);
/// Performs HAL-specific post-GSP boot tasks.
///
diff --git a/drivers/gpu/nova-core/gsp/hal/gh100.rs b/drivers/gpu/nova-core/gsp/hal/gh100.rs
index ece40403b831..02203dfd3584 100644
--- a/drivers/gpu/nova-core/gsp/hal/gh100.rs
+++ b/drivers/gpu/nova-core/gsp/hal/gh100.rs
@@ -150,16 +150,16 @@ fn boot(
ctx: &GspBootContext<'_>,
fb_layout: &FbLayout,
wpr_meta: &Coherent<GspFwWprMeta>,
- ) -> (Result, Option<crate::gsp::UnloadBundle>) {
+ ) -> (Result, Result<crate::gsp::UnloadBundle>) {
let dev = ctx.dev();
let bar = ctx.bar;
let chipset = ctx.chipset;
let gsp_falcon = ctx.gsp_falcon;
- let mut unload_bundle = None;
+ let mut unload_bundle = Err(EAGAIN);
let res = (|| {
- unload_bundle = Some(crate::gsp::UnloadBundle(
+ unload_bundle = Ok(crate::gsp::UnloadBundle(
KBox::new(FspUnloadBundle, GFP_KERNEL)? as KBox<dyn UnloadBundle>,
));
diff --git a/drivers/gpu/nova-core/gsp/hal/tu102.rs b/drivers/gpu/nova-core/gsp/hal/tu102.rs
index fca8da281e16..984716fc0bf9 100644
--- a/drivers/gpu/nova-core/gsp/hal/tu102.rs
+++ b/drivers/gpu/nova-core/gsp/hal/tu102.rs
@@ -269,14 +269,14 @@ fn boot(
ctx: &GspBootContext<'_>,
fb_layout: &FbLayout,
wpr_meta: &Coherent<GspFwWprMeta>,
- ) -> (Result, Option<crate::gsp::UnloadBundle>) {
+ ) -> (Result, Result<crate::gsp::UnloadBundle>) {
let dev = ctx.dev();
let bar = ctx.bar;
let chipset = ctx.chipset;
let gsp_falcon = ctx.gsp_falcon;
let sec2_falcon = ctx.sec2_falcon;
- let mut unload_bundle = None;
+ let mut unload_bundle = Err(EAGAIN);
let res = (|| {
let bios = Vbios::new(dev, bar)?;
@@ -287,15 +287,6 @@ fn boot(
// can be probed again.
unload_bundle =
Sec2UnloadBundle::build(dev, bar, chipset, &bios, gsp_falcon, sec2_falcon)
- .inspect_err(|e| {
- dev_warn!(dev, "Failed to prepare unload firmware: {:?}\n", e);
- dev_warn!(dev, "The GSP won't be able to unload properly on unbind.\n");
- dev_warn!(
- dev,
- "The GPU will need to be reset before the driver can bind again.\n"
- );
- })
- .ok()
.map(crate::gsp::UnloadBundle);
// FWSEC-FRTS is not executed on chips where the FRTS region size is 0 (e.g. GA100).
--
2.54.0
next prev parent reply other threads:[~2026-06-22 7:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 7:10 [PATCH v2 00/13] gpu: nova-core: consolidate and streamline GSP boot process Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 01/13] gpu: nova-core: gsp: sequencer: use GspBootContext Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 02/13] gpu: nova-core: gsp: sequencer: do not store sequence into GspSequencer Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 03/13] gpu: nova-core: gsp: move boot code into local closure Alexandre Courbot
2026-06-22 7:59 ` Eliot Courtney
2026-06-22 7:10 ` [PATCH v2 04/13] gpu: nova-core: gsp: replace BootUnloadGuard with local handler Alexandre Courbot
2026-06-22 7:10 ` Alexandre Courbot [this message]
2026-06-22 7:10 ` [PATCH v2 06/13] gpu: nova-core: gsp: make unload take GspBootContext Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 07/13] gpu: nova-core: gsp: fold TU102 unload bundle construction into HAL method Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 08/13] gpu: nova-core: gsp: turn FWSEC execution " Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 09/13] gpu: nova-core: gsp: make use of FWSEC bootloader a property of the TU102 HAL Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 10/13] gpu: nova-core: introduce GspBootMethod Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 11/13] gpu: nova-core: avoid repeated calls to pci::Device::as_ref Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 12/13] gpu: nova-core: gsp: pass GspBootContext mutably Alexandre Courbot
2026-06-22 7:10 ` [PATCH v2 13/13] gpu: nova-core: store Fsp instance in Gpu Alexandre Courbot
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=20260622-nova-bootcontext-v2-5-0ddeafc06f5d@nvidia.com \
--to=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=ttabi@nvidia.com \
--cc=zhiw@nvidia.com \
/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.