[PATCH v3 26/33] gpu: nova-core: gsp: add the GSP_SUSPEND request
From: John Hubbard
Date: Thu Sep 17 2026 - 21:11:57 EST
The r000 firmware suspends GSP-RM on a GSP_SUSPEND request, a GMC API
command whose payload is one word of flags. The one flag marks a
suspend that is a power management transition, S3 or hibernate, rather
than a full unload. GSP-RM sends no response on the message queue. It
reports the completed suspend in the GSP falcon's MAILBOX0 register
instead.
Add the request, and send it without waiting for a response. The
request has no caller until the following switch to r000 sends it in
place of the r570 unload RPC.
Assisted-by: LLM
Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
---
drivers/gpu/nova-core/gsp/commands.rs | 15 ++++++++++++-
drivers/gpu/nova-core/gsp/fw.rs | 4 ++++
drivers/gpu/nova-core/gsp/fw/commands.rs | 27 ++++++++++++++++++++++++
3 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index 74ae92428cad..00ff3271a46e 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -37,7 +37,8 @@
},
GspGmcMsgElement,
MsgFunction,
- GMCAPI_CMD_GSP_INIT, //
+ GMCAPI_CMD_GSP_INIT,
+ GMCAPI_CMD_GSP_SUSPEND, //
},
nvkv::{
Decoder,
@@ -382,6 +383,18 @@ fn decode_gsp_init_reply(payload_0: &[u8], payload_1: &[u8]) -> Result<GspStatic
pub(crate) use fw::commands::PowerStateLevel;
+/// Sends `GSP_SUSPEND`, which GSP-RM does not answer (see [`GMCAPI_CMD_GSP_SUSPEND`]).
+///
+/// # Errors
+///
+/// Errors from [`Cmdq::send_gmc_no_wait`] are propagated as-is.
+#[expect(dead_code)]
+pub(crate) fn gsp_suspend(cmdq: &Cmdq<'_>, level: PowerStateLevel) -> Result {
+ let params = fw::commands::GspSuspend::new(level);
+
+ cmdq.send_gmc_no_wait(GMCAPI_CMD_GSP_SUSPEND, AsBytes::as_bytes(¶ms), 0)
+}
+
/// The `UnloadingGuestDriver` command, used to shut down the GSP.
///
/// Only used within the `gsp` module.
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index cc0bc8f8ae87..ee582cbde5f6 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -1069,6 +1069,10 @@ pub(crate) struct GmcApiHeader {
pub(crate) const GMCAPI_CMD_EXEC_HS_BINARY: u32 =
r000_00::GMCAPI_COMMANDS_GMCAPI_CMD_EXEC_HS_BINARY;
+/// GMC request for GSP-RM to suspend. GSP-RM sends no response, and reports the completed
+/// suspend in the GSP falcon's `MAILBOX0` instead.
+pub(crate) const GMCAPI_CMD_GSP_SUSPEND: u32 = r000_00::GMCAPI_COMMANDS_GMCAPI_CMD_GSP_SUSPEND;
+
static_assert!(size_of::<GmcApiHeader>() == size_of::<r000_00::GMCAPI_HEADER>());
static_assert!(
core::mem::offset_of!(GmcApiHeader, command)
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 748639942fe1..4e6c712637b0 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -225,6 +225,33 @@ pub(crate) fn is_power_transition(self) -> bool {
}
}
+/// Set in [`GspSuspend::flags`] when the suspend is a power management transition (S3 or
+/// hibernate) rather than a full unload.
+const GMCAPI_GSP_SUSPEND_FLAGS_PM_TRANSITION: u64 = 1 << 0;
+
+/// Payload of the `GSP_SUSPEND` GMC command.
+#[repr(C)]
+#[derive(Clone, Copy, Debug, Zeroable)]
+pub(crate) struct GspSuspend {
+ flags: u64,
+}
+
+impl GspSuspend {
+ /// Creates a `GSP_SUSPEND` payload for the given [`PowerStateLevel`].
+ pub(crate) fn new(level: PowerStateLevel) -> Self {
+ Self {
+ flags: if level.is_power_transition() {
+ GMCAPI_GSP_SUSPEND_FLAGS_PM_TRANSITION
+ } else {
+ 0
+ },
+ }
+ }
+}
+
+// SAFETY: The single field is an integer type, and the struct has no padding.
+unsafe impl AsBytes for GspSuspend {}
+
/// Payload of the `UnloadingGuestDriver` command and message.
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Zeroable)]
--
2.55.0