mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eliot Courtney <ecourtney@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
	Alice Ryhl <aliceryhl@google.com>,
	 Alexandre Courbot <acourbot@nvidia.com>,
	David Airlie <airlied@gmail.com>,
	 Simona Vetter <simona@ffwll.ch>
Cc: John Hubbard <jhubbard@nvidia.com>,
	 Alistair Popple <apopple@nvidia.com>,
	Timur Tabi <ttabi@nvidia.com>,
	 nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
	 linux-kernel@vger.kernel.org,
	Eliot Courtney <ecourtney@nvidia.com>
Subject: [PATCH 7/7] gpu: nova-core: falcon: load the firmware image in Falcon::boot
Date: Thu, 26 Nov 2026 17:20:16 +0900	[thread overview]
Message-ID: <20261126-boot-rework2-v1-7-99a1dc6c7cc4@nvidia.com> (raw)
In-Reply-To: <20261126-boot-rework2-v1-0-99a1dc6c7cc4@nvidia.com>

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@nvidia.com>
---
 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


      parent reply	other threads:[~2026-11-26  8:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  8:20 [PATCH 0/7] gpu: nova-core: merge `load` and `boot` for falcons Eliot Courtney
2026-11-26  8:20 ` [PATCH 1/7] gpu: nova-core: falcon: make pfalcon private Eliot Courtney
2026-11-26  8:20 ` [PATCH 2/7] gpu: nova-core: gsp: remove unnecessary start of `gsp_falcon` Eliot Courtney
2026-11-26  8:20 ` [PATCH 3/7] gpu: nova-core: falcon: program BROM and BOOTVEC in `boot` Eliot Courtney
2026-11-26  8:20 ` [PATCH 4/7] gpu: nova-core: falcon: separate staging data for DMA from its location Eliot Courtney
2026-11-26  8:20 ` [PATCH 5/7] gpu: nova-core: falcon: add `FalconImage` for `FalconFirmware` trait Eliot Courtney
2026-11-26  8:20 ` [PATCH 6/7] gpu: nova-core: falcon: rename FalconDmaLoadTarget to FalconLoadTarget Eliot Courtney
2026-11-26  8:20 ` Eliot Courtney [this message]

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=20261126-boot-rework2-v1-7-99a1dc6c7cc4@nvidia.com \
    --to=ecourtney@nvidia.com \
    --cc=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=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=simona@ffwll.ch \
    --cc=ttabi@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

all inboxes | Powered by JetHome®