[PATCH 7/7] gpu: nova-core: falcon: load the firmware image in Falcon::boot

From: Eliot Courtney

Date: Thu Nov 26 2026 - 03:21:14 EST


Remove the separate `load` step for booting falcons. This `load` step
was always paired with `boot` right after. It is simpler to merge these
steps and also statically prevents trying to boot a falcon without
loading the firmware first.

Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
---
drivers/gpu/nova-core/falcon.rs | 12 ++++++------
drivers/gpu/nova-core/firmware/booter.rs | 1 -
drivers/gpu/nova-core/firmware/fwsec.rs | 3 ---
drivers/gpu/nova-core/firmware/gen_bootloader.rs | 1 -
drivers/gpu/nova-core/gsp/hal/tu102.rs | 1 -
5 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs
index b1ba94fd2bcd..9f0550e24ee5 100644
--- a/drivers/gpu/nova-core/falcon.rs
+++ b/drivers/gpu/nova-core/falcon.rs
@@ -616,11 +616,8 @@ fn load_dmem(&self, segment: &FalconDmemSegment<'_>) -> Result {
}
}

- /// Load a firmware image into Falcon memory, using the preferred method for the current
- /// chipset.
- pub(crate) fn load<F: FalconFirmware<Target = E>>(&self, fw: &F) -> Result {
- let image = fw.image()?;
-
+ /// Load a firmware image into Falcon memory.
+ fn load(&self, image: &FalconImage<'_>) -> Result {
self.dma_reset();

if let Some(segment) = &image.imem_ns {
@@ -690,7 +687,7 @@ pub(crate) fn read_mailboxes(&self) -> (u32, u32) {
(mbox0, mbox1)
}

- /// Start running `fw`, which must already be loaded into the falcon.
+ /// Load `fw` into the falcon and start running it.
///
/// `mbox0` and `mbox1` are optional parameters to write into the `MBOX0` and `MBOX1` registers
/// prior to running.
@@ -703,6 +700,9 @@ pub(crate) fn boot<F: FalconFirmware<Target = E>>(
mbox0: Option<u32>,
mbox1: Option<u32>,
) -> Result<(u32, u32)> {
+ fw.image()
+ .and_then(|image| self.load(&image))
+ .inspect_err(|e| dev_err!(self.dev, "Failed to load falcon firmware: {:?}\n", e))?;
self.hal.program_brom(self, &fw.brom_params());
self.pfalcon
.write_reg(regs::NV_PFALCON_FALCON_BOOTVEC::zeroed().with_value(fw.boot_addr()));
diff --git a/drivers/gpu/nova-core/firmware/booter.rs b/drivers/gpu/nova-core/firmware/booter.rs
index 9c02a7a6a977..976885b0ca13 100644
--- a/drivers/gpu/nova-core/firmware/booter.rs
+++ b/drivers/gpu/nova-core/firmware/booter.rs
@@ -191,7 +191,6 @@ pub(crate) fn run<T>(
wpr_meta: &Coherent<'_, T>,
) -> Result {
sec2_falcon.reset()?;
- sec2_falcon.load(self)?;
let wpr_dma_address = wpr_meta.dma_address();
let (mbox0, mbox1) = sec2_falcon.boot(
self,
diff --git a/drivers/gpu/nova-core/firmware/fwsec.rs b/drivers/gpu/nova-core/firmware/fwsec.rs
index bde546c95a41..a5cc4e2e424c 100644
--- a/drivers/gpu/nova-core/firmware/fwsec.rs
+++ b/drivers/gpu/nova-core/firmware/fwsec.rs
@@ -392,9 +392,6 @@ pub(crate) fn run(&self, dev: &Device<device::Bound>, falcon: &Falcon<'_, Gsp>)
falcon
.reset()
.inspect_err(|e| dev_err!(dev, "Failed to reset GSP falcon: {:?}\n", e))?;
- falcon
- .load(self)
- .inspect_err(|e| dev_err!(dev, "Failed to load FWSEC firmware: {:?}\n", e))?;
let (mbox0, _) = falcon
.boot(self, Some(0), None)
.inspect_err(|e| dev_err!(dev, "Failed to boot FWSEC firmware: {:?}\n", e))?;
diff --git a/drivers/gpu/nova-core/firmware/gen_bootloader.rs b/drivers/gpu/nova-core/firmware/gen_bootloader.rs
index f2dd88d27098..6cb5292c1c4e 100644
--- a/drivers/gpu/nova-core/firmware/gen_bootloader.rs
+++ b/drivers/gpu/nova-core/firmware/gen_bootloader.rs
@@ -219,7 +219,6 @@ pub(crate) fn run(
dmem_desc,
};

- falcon.load(&fw)?;
falcon.boot(&fw, Some(mbox0), None)
},
)
diff --git a/drivers/gpu/nova-core/gsp/hal/tu102.rs b/drivers/gpu/nova-core/gsp/hal/tu102.rs
index 80936194806a..2c95d178b020 100644
--- a/drivers/gpu/nova-core/gsp/hal/tu102.rs
+++ b/drivers/gpu/nova-core/gsp/hal/tu102.rs
@@ -97,7 +97,6 @@ fn run(&self, ctx: &mut GspBootContext<'_, '_>) -> Result {
}

ctx.sec2_falcon.reset()?;
- ctx.sec2_falcon.load(&self.booter_unloader)?;

// Sentinel value to confirm that Booter Unloader has run.
const MAILBOX_SENTINEL: u32 = 0xff;

--
2.56.1