public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Eliot Courtney <ecourtney@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
	Alexandre Courbot <acourbot@nvidia.com>,
	Alice Ryhl <aliceryhl@google.com>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	John Hubbard <jhubbard@nvidia.com>, Gary Guo <gary@garyguo.net>
Cc: Alistair Popple <apopple@nvidia.com>,
	Joel Fernandes <joelagnelf@nvidia.com>,
	Timur Tabi <ttabi@nvidia.com>,
	rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	Eliot Courtney <ecourtney@nvidia.com>
Subject: [PATCH 3/3] gpu: nova-core: add non-sec2 unload path
Date: Thu, 09 Apr 2026 23:19:41 +0900	[thread overview]
Message-ID: <20260409-b4-blackwell-unload-v1-3-0f5a2ff838dd@nvidia.com> (raw)
In-Reply-To: <20260409-b4-blackwell-unload-v1-0-0f5a2ff838dd@nvidia.com>

For non-sec2 it is only required to wait for GSP falcon to halt. This is
because GSP does the main work of unloading on GPUs not using sec2.

Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
 drivers/gpu/nova-core/gsp/boot.rs | 63 +++++++++++++++++++++++----------------
 1 file changed, 37 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index 1aac634c3b67..e536ad7222b2 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -453,37 +453,48 @@ pub(crate) fn unload(
             .inspect_err(|e| dev_err!(dev, "unload guest driver failed: {:?}", e))?;
         dev_dbg!(dev, "GSP shut down\n");
 
-        /* Run FWSEC-SB to reset the GSP falcon to its pre-libos state. */
+        if chipset.arch().uses_sec2() {
+            /* Run FWSEC-SB to reset the GSP falcon to its pre-libos state. */
 
-        let bios = Vbios::new(dev, bar)?;
-        let fwsec_sb = FwsecFirmware::new(dev, gsp_falcon, bar, &bios, FwsecCommand::Sb)?;
-        fwsec_sb.run(dev, gsp_falcon, bar)?;
-        dev_dbg!(dev, "FWSEC SB completed\n");
+            let bios = Vbios::new(dev, bar)?;
+            let fwsec_sb = FwsecFirmware::new(dev, gsp_falcon, bar, &bios, FwsecCommand::Sb)?;
+            fwsec_sb.run(dev, gsp_falcon, bar)?;
+            dev_dbg!(dev, "FWSEC SB completed\n");
 
-        /* Remove WPR2 region if set. */
+            /* Remove WPR2 region if set. */
 
-        let wpr2_hi = bar.read(regs::NV_PFB_PRI_MMU_WPR2_ADDR_HI);
-        dev_dbg!(dev, "WPR2 HI: {:?}\n", wpr2_hi);
-        if wpr2_hi.is_wpr2_set() {
-            let booter_unloader = BooterFirmware::new(
-                dev,
-                BooterKind::Unloader,
-                chipset,
-                FIRMWARE_VERSION,
-                sec2_falcon,
-                bar,
-            )?;
+            let wpr2_hi = bar.read(regs::NV_PFB_PRI_MMU_WPR2_ADDR_HI);
+            dev_dbg!(dev, "WPR2 HI: {:?}\n", wpr2_hi);
+            if wpr2_hi.is_wpr2_set() {
+                let booter_unloader = BooterFirmware::new(
+                    dev,
+                    BooterKind::Unloader,
+                    chipset,
+                    FIRMWARE_VERSION,
+                    sec2_falcon,
+                    bar,
+                )?;
 
-            dev_dbg!(dev, "Booter unloader created\n");
+                dev_dbg!(dev, "Booter unloader created\n");
 
-            sec2_falcon.reset(bar)?;
-            sec2_falcon.load(dev, bar, &booter_unloader)?;
-            let _ = sec2_falcon.boot(bar, Some(0xff), Some(0xff))?;
-            dev_dbg!(
-                dev,
-                "WPR2 HI: {:?}\n",
-                bar.read(regs::NV_PFB_PRI_MMU_WPR2_ADDR_HI)
-            );
+                sec2_falcon.reset(bar)?;
+                sec2_falcon.load(dev, bar, &booter_unloader)?;
+                let _ = sec2_falcon.boot(bar, Some(0xff), Some(0xff))?;
+                dev_dbg!(
+                    dev,
+                    "WPR2 HI: {:?}\n",
+                    bar.read(regs::NV_PFB_PRI_MMU_WPR2_ADDR_HI)
+                );
+            }
+        } else {
+            // GSP falcon does most of the work of resetting, so just wait for it to finish.
+            read_poll_timeout(
+                || Ok(gsp_falcon.is_riscv_active(bar)),
+                |&active| !active,
+                Delta::from_millis(10),
+                Delta::from_secs(5),
+            )
+            .inspect_err(|_| dev_err!(dev, "GSP falcon failed to halt\n"))?;
         }
 
         Ok(())

-- 
2.53.0


  parent reply	other threads:[~2026-04-09 14:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09 14:19 [PATCH 0/3] gpu: nova-core: unload extras for Hopper/Blackwell Eliot Courtney
2026-04-09 14:19 ` [PATCH 1/3] gpu: nova-core: fsp: wait to consume message before sending another Eliot Courtney
2026-04-12  1:19   ` Claude review: " Claude Code Review Bot
2026-04-09 14:19 ` [PATCH 2/3] gpu: nova-core: add Architecture::uses_sec2() helper Eliot Courtney
2026-04-12  1:19   ` Claude review: " Claude Code Review Bot
2026-04-09 14:19 ` Eliot Courtney [this message]
2026-04-12  1:19   ` Claude review: gpu: nova-core: add non-sec2 unload path Claude Code Review Bot
2026-04-12  1:19 ` Claude review: gpu: nova-core: unload extras for Hopper/Blackwell Claude Code Review Bot

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=20260409-b4-blackwell-unload-v1-3-0f5a2ff838dd@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=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=joelagnelf@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --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