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 10/13] gpu: nova-core: introduce GspBootMethod
Date: Mon, 22 Jun 2026 16:10:32 +0900 [thread overview]
Message-ID: <20260622-nova-bootcontext-v2-10-0ddeafc06f5d@nvidia.com> (raw)
In-Reply-To: <20260622-nova-bootcontext-v2-0-0ddeafc06f5d@nvidia.com>
The GSP boot method is currently determined by two ad-hoc methods of
`Chipset`: `uses_fsp` (a boolean telling whether to use the FSP boot
path or the Sec2 Booter one) and `needs_fwsec_bootloader` (another
boolean valid only for the Sec2 Booter method that tells whether the
FWSEC bootloader must be used).
This is neither extensible nor sound: the combination `uses_fsp &&
needs_fwsec_bootloader` is invalid, but can still be expressed.
Thus, unify these two predicates into a single `gsp_boot_method` method
that returns an enum type unambiguously describing the boot method to
use. This ensures that no invalid combination can be expressed, which
makes matching sounder.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drivers/gpu/nova-core/firmware.rs | 25 ++++++++++++--------
drivers/gpu/nova-core/firmware/fwsec.rs | 5 ++--
drivers/gpu/nova-core/gpu.rs | 16 -------------
drivers/gpu/nova-core/gsp.rs | 42 ++++++++++++++++++++++++++++++++-
drivers/gpu/nova-core/gsp/hal.rs | 22 ++++++++---------
5 files changed, 70 insertions(+), 40 deletions(-)
diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova-core/firmware.rs
index 15a61edaaa82..0b7047646bf2 100644
--- a/drivers/gpu/nova-core/firmware.rs
+++ b/drivers/gpu/nova-core/firmware.rs
@@ -21,6 +21,7 @@
FalconFirmware, //
},
gpu,
+ gsp::GspBootMethod,
num::{
FromSafeCast,
IntoSafeCast, //
@@ -432,17 +433,21 @@ const fn make_entry_chipset(self, chipset: gpu::Chipset) -> Self {
// FSP-based chipsets (Hopper, Blackwell and later) boot the GSP via the FMC image loaded by
// FSP. Older chipsets use the SEC2 booter instead.
- let this = if chipset.uses_fsp() {
- this.make_entry_file(name, "fmc")
- } else {
- this.make_entry_file(name, "booter_load")
- .make_entry_file(name, "booter_unload")
- };
+ match chipset.gsp_boot_method() {
+ GspBootMethod::Sec2 {
+ needs_fwsec_bootloader,
+ } => {
+ let mut this = this
+ .make_entry_file(name, "booter_load")
+ .make_entry_file(name, "booter_unload");
- if chipset.needs_fwsec_bootloader() {
- this.make_entry_file(name, "gen_bootloader")
- } else {
- this
+ if needs_fwsec_bootloader {
+ this = this.make_entry_file(name, "gen_bootloader")
+ }
+
+ this
+ }
+ GspBootMethod::Fsp => this.make_entry_file(name, "fmc"),
}
}
diff --git a/drivers/gpu/nova-core/firmware/fwsec.rs b/drivers/gpu/nova-core/firmware/fwsec.rs
index 199ae2adb664..a1cdf1aa8773 100644
--- a/drivers/gpu/nova-core/firmware/fwsec.rs
+++ b/drivers/gpu/nova-core/firmware/fwsec.rs
@@ -388,8 +388,9 @@ pub(crate) fn new(
/// Loads the FWSEC firmware into `falcon` and execute it.
///
/// This must only be called on chipsets that do not need the FWSEC bootloader (i.e., where
- /// [`Chipset::needs_fwsec_bootloader()`](crate::gpu::Chipset::needs_fwsec_bootloader) returns
- /// `false`). On chipsets that do, use [`bootloader::FwsecFirmwareWithBl`] instead.
+ /// [`Chipset::gsp_boot_method()`](crate::gpu::Chipset::gsp_boot_method) returns
+ /// `GspBootMethod::Sec2 { needs_fwsec_bootloader: false }`). On chipsets where
+ /// `needs_fwsec_bootloader` is `true` do, use [`bootloader::FwsecFirmwareWithBl`] instead.
pub(crate) fn run(
&self,
dev: &Device<device::Bound>,
diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 7918ebb508f9..d80c6dbb4cba 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -132,22 +132,6 @@ pub(crate) const fn arch(self) -> Architecture {
}
}
- /// Returns `true` if this chipset requires the PIO-loaded bootloader in order to boot FWSEC.
- ///
- /// This includes all chipsets < GA102.
- pub(crate) const fn needs_fwsec_bootloader(self) -> bool {
- matches!(self.arch(), Architecture::Turing) || matches!(self, Self::GA100)
- }
-
- /// Returns `true` if this chipset boots via FSP (Hopper and later), which requires the FMC
- /// firmware image.
- pub(crate) const fn uses_fsp(self) -> bool {
- matches!(
- self.arch(),
- Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x
- )
- }
-
/// Returns the address range of the PCI config mirror space.
pub(crate) fn pci_config_mirror_range(self) -> Range<u32> {
hal::gpu_hal(self).pci_config_mirror_range()
diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
index 73e93403601c..771b38e6335d 100644
--- a/drivers/gpu/nova-core/gsp.rs
+++ b/drivers/gpu/nova-core/gsp.rs
@@ -38,7 +38,10 @@
sec2::Sec2 as Sec2Falcon,
Falcon, //
},
- gpu::Chipset,
+ gpu::{
+ Architecture,
+ Chipset, //
+ },
gsp::{
cmdq::Cmdq,
fw::{
@@ -217,5 +220,42 @@ pub(crate) fn get_static_info(&self, bar: Bar0<'_>) -> Result<commands::GetGspSt
}
}
+/// Method used to boot the GSP.
+#[derive(Copy, Clone, PartialEq, Eq)]
+pub(crate) enum GspBootMethod {
+ /// GSP is booted by running FWSEC-FRTS on the GSP falcon, followed by the Booter loader on the
+ /// SEC2 falcon.
+ ///
+ /// `needs_fwsec_bootloader` indicates whether the chipset requires the PIO-loaded bootloader in
+ /// order to boot FWSEC.
+ Sec2 { needs_fwsec_bootloader: bool },
+ /// GSP is booted via FSP Chain-of-Trust.
+ Fsp,
+}
+
+impl Chipset {
+ /// Returns the method used to boot the GSP on this chipset.
+ pub(crate) const fn gsp_boot_method(self) -> GspBootMethod {
+ match self.arch() {
+ // All Turing chipsets require the FWSEC bootloader.
+ Architecture::Turing => GspBootMethod::Sec2 {
+ needs_fwsec_bootloader: true,
+ },
+ // GA100 also requires the FWSEC bootloader.
+ Architecture::Ampere if matches!(self, Self::GA100) => GspBootMethod::Sec2 {
+ needs_fwsec_bootloader: true,
+ },
+ // Other Ampere chipsets, as well as Ada chipsets, do not require the FWSEC bootloader.
+ Architecture::Ampere | Architecture::Ada => GspBootMethod::Sec2 {
+ needs_fwsec_bootloader: false,
+ },
+ // Hopper and more recent use the FSP Chain-of-Trust boot method.
+ Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => {
+ GspBootMethod::Fsp
+ }
+ }
+ }
+}
+
/// Opaque bundle required to unload the GSP. Created by [`Gsp::boot`], consumed by [`Gsp::unload`].
pub(crate) struct UnloadBundle(KBox<dyn hal::UnloadBundle>);
diff --git a/drivers/gpu/nova-core/gsp/hal.rs b/drivers/gpu/nova-core/gsp/hal.rs
index ae4c44aeddaa..9abdafbdbb57 100644
--- a/drivers/gpu/nova-core/gsp/hal.rs
+++ b/drivers/gpu/nova-core/gsp/hal.rs
@@ -13,13 +13,11 @@
use crate::{
fb::FbLayout,
firmware::gsp::GspFirmware,
- gpu::{
- Architecture,
- Chipset, //
- },
+ gpu::Chipset,
gsp::{
Gsp,
GspBootContext,
+ GspBootMethod,
GspFwWprMeta, //
},
};
@@ -66,12 +64,14 @@ fn post_boot(&self, _gsp: &Gsp, _ctx: &GspBootContext<'_>, _gsp_fw: &GspFirmware
/// Returns the GSP HAL to be used for `chipset`.
pub(super) fn gsp_hal(chipset: Chipset) -> &'static dyn GspHal {
- match chipset.arch() {
- Architecture::Turing => tu102::TU102_HAL,
- Architecture::Ampere if matches!(chipset, Chipset::GA100) => tu102::TU102_HAL,
- Architecture::Ampere | Architecture::Ada => ga102::GA102_HAL,
- Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => {
- gh100::GH100_HAL
- }
+ // The GSP HAL is entirely determined by the boot method.
+ match chipset.gsp_boot_method() {
+ GspBootMethod::Sec2 {
+ needs_fwsec_bootloader: true,
+ } => tu102::TU102_HAL,
+ GspBootMethod::Sec2 {
+ needs_fwsec_bootloader: false,
+ } => ga102::GA102_HAL,
+ GspBootMethod::Fsp => gh100::GH100_HAL,
}
}
--
2.54.0
next prev parent reply other threads:[~2026-06-22 7:12 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 ` [PATCH v2 05/13] gpu: nova-core: gsp: move unload bundle error handling to Gsp::boot Alexandre Courbot
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 ` Alexandre Courbot [this message]
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-10-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox