* [PATCH 1/3] gpu: nova-core: fsp: wait to consume message before sending another
2026-04-09 14:19 [PATCH 0/3] gpu: nova-core: unload extras for Hopper/Blackwell Eliot Courtney
@ 2026-04-09 14:19 ` Eliot Courtney
2026-04-09 14:19 ` [PATCH 2/3] gpu: nova-core: add Architecture::uses_sec2() helper Eliot Courtney
2026-04-09 14:19 ` [PATCH 3/3] gpu: nova-core: add non-sec2 unload path Eliot Courtney
2 siblings, 0 replies; 5+ messages in thread
From: Eliot Courtney @ 2026-04-09 14:19 UTC (permalink / raw)
To: Danilo Krummrich, Alexandre Courbot, Alice Ryhl, David Airlie,
Simona Vetter, John Hubbard, Gary Guo
Cc: Alistair Popple, Joel Fernandes, Timur Tabi, rust-for-linux,
dri-devel, linux-kernel, Eliot Courtney
FSP can only get one message at a time, so make sure it has consumed the
previous one before trying to give it another.
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
drivers/gpu/nova-core/falcon/fsp.rs | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/nova-core/falcon/fsp.rs b/drivers/gpu/nova-core/falcon/fsp.rs
index f618a681ff28..1497f163806e 100644
--- a/drivers/gpu/nova-core/falcon/fsp.rs
+++ b/drivers/gpu/nova-core/falcon/fsp.rs
@@ -7,12 +7,14 @@
use kernel::{
io::{
+ poll::read_poll_timeout,
register::WithBase,
Io,
IoCapable, //
},
num::Bounded,
- prelude::*, //
+ prelude::*,
+ time::Delta, //
};
use kernel::io::register::RegisterBase;
@@ -186,6 +188,18 @@ pub(crate) fn send_msg(&self, bar: &Bar0, packet: &[u8]) -> Result {
return Err(EINVAL);
}
+ // Wait for FSP to consume any previous message before sending.
+ read_poll_timeout(
+ || {
+ let head = bar.read(regs::NV_PFSP_QUEUE_HEAD).address().get();
+ let tail = bar.read(regs::NV_PFSP_QUEUE_TAIL).address().get();
+ Ok(head == tail)
+ },
+ |&ready| ready,
+ Delta::from_millis(1),
+ Delta::from_secs(2),
+ )?;
+
// Write message to EMEM at offset 0 (validates 4-byte alignment)
self.write_emem(bar, 0, packet)?;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] gpu: nova-core: add Architecture::uses_sec2() helper
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-09 14:19 ` Eliot Courtney
2026-04-09 14:19 ` [PATCH 3/3] gpu: nova-core: add non-sec2 unload path Eliot Courtney
2 siblings, 0 replies; 5+ messages in thread
From: Eliot Courtney @ 2026-04-09 14:19 UTC (permalink / raw)
To: Danilo Krummrich, Alexandre Courbot, Alice Ryhl, David Airlie,
Simona Vetter, John Hubbard, Gary Guo
Cc: Alistair Popple, Joel Fernandes, Timur Tabi, rust-for-linux,
dri-devel, linux-kernel, Eliot Courtney
This will be used in the following patch as common logic.
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
drivers/gpu/nova-core/gpu.rs | 7 +++++++
drivers/gpu/nova-core/gsp/boot.rs | 5 +----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 2bcaa7bc5125..674dc286162a 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -180,6 +180,13 @@ pub(crate) enum Architecture with TryFrom<Bounded<u32, 6>> {
}
impl Architecture {
+ /// Returns `true` if this architecture uses SEC2 to boot GSP.
+ ///
+ /// Turing/Ampere/Ada use FWSEC + SEC2 booter firmware. Hopper and later use FSP instead.
+ pub(crate) const fn uses_sec2(&self) -> bool {
+ matches!(self, Self::Turing | Self::Ampere | Self::Ada)
+ }
+
/// Returns the DMA mask supported by this architecture.
pub(crate) const fn dma_mask(&self) -> DmaMask {
match self {
diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index e6d8b848ec46..1aac634c3b67 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -332,10 +332,7 @@ pub(crate) fn boot(
sec2_falcon: &Falcon<Sec2>,
) -> Result {
let dev = pdev.as_ref();
- let uses_sec2 = matches!(
- chipset.arch(),
- Architecture::Turing | Architecture::Ampere | Architecture::Ada
- );
+ let uses_sec2 = chipset.arch().uses_sec2();
let gsp_fw = KBox::pin_init(GspFirmware::new(dev, chipset, FIRMWARE_VERSION), GFP_KERNEL)?;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] gpu: nova-core: add non-sec2 unload path
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-09 14:19 ` [PATCH 2/3] gpu: nova-core: add Architecture::uses_sec2() helper Eliot Courtney
@ 2026-04-09 14:19 ` Eliot Courtney
2026-04-20 8:07 ` Alexandre Courbot
2 siblings, 1 reply; 5+ messages in thread
From: Eliot Courtney @ 2026-04-09 14:19 UTC (permalink / raw)
To: Danilo Krummrich, Alexandre Courbot, Alice Ryhl, David Airlie,
Simona Vetter, John Hubbard, Gary Guo
Cc: Alistair Popple, Joel Fernandes, Timur Tabi, rust-for-linux,
dri-devel, linux-kernel, Eliot Courtney
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
^ permalink raw reply related [flat|nested] 5+ messages in thread