Linux Documentation
 help / color / mirror / Atom feed
* [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware
@ 2026-12-03 12:09 Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 01/15] gpu: nova-core: gsp: nvkv: add const constructor for Key Alexandre Courbot
                   ` (14 more replies)
  0 siblings, 15 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

This series completes the work started from John's r000 series [1] and
switches nova-core from the r570 GSP firmware to the ABI-stable r000
firmware interface (used by OpenRM 6xx and later).

Because the driver boots a single firmware format, the incompatible
parts of the protocol (queue pointers in BAR0 registers, MCTP/NVDM
element headers, GSP_INIT/GSP_SUSPEND GMC commands, load-and-execute
events, ucodes and state monitor buffers) must switch together. To keep
that switch commit as small and reviewable as possible, everything that
can either run on r570 or be compiled ahead of time is landed first, and
the removal of r570-only code is performed in follow-up patches:

- Patches 1-6 add the remaining r000 building blocks (GSP_INIT with
  SR-IOV VF info, GSP_SUSPEND, and the ucodes loader).
- Patches 7-11 prepare existing code and bindings for the switch while
  remaining compatible with r570.
- Patch 12 performs the atomic switch to the r000 GSP firmware.
- Patches 13-15 delete the now-unused r570 code (GSP sequencer, r570 RPC
  commands, and r570 bindings).

The tree right before patch 12 has been tested to boot on r570, and
patch 12 onwards has been tested to boot on r615 across Turing, Ampere,
and Blackwell.

Based on drm-rust-next.

[1] https://lore.kernel.org/20260918010719.1176945-1-jhubbard@nvidia.com

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Alexandre Courbot (3):
      gpu: nova-core: gsp: nvkv: add const constructor for Key
      gpu: nova-core: gsp: re-export PowerStateLevel from gsp::commands
      gpu: nova-core: gsp: zero-initialize FMC boot parameter structs

John Hubbard (11):
      gpu: nova-core: gsp: add the GSP_INIT command and its reply
      gpu: nova-core: gsp: add the GSP_SUSPEND request
      gpu: nova-core: firmware: add the ucodes firmware loader
      gpu: nova-core: gsp: define GSP_MSG_QUEUE_ELEMENT_SIZE_MAX without bindings
      gpu: nova-core: fb: increase Blackwell reserved memory sizes for r000
      gpu: nova-core: gsp: drain the message queue while waiting for GSP suspend
      gpu: nova-core: firmware: add r000 GSP bindings
      gpu: nova-core: switch to the r000 GSP firmware
      gpu: nova-core: gsp: delete the GSP sequencer
      gpu: nova-core: gsp: delete the r570 RPC commands
      gpu: nova-core: firmware: delete the r570 bindings

Zhi Wang (1):
      gpu: nova-core: gsp: populate VF information in GSP_INIT

 Documentation/gpu/nova/core/falcon.rst             |    2 +-
 Documentation/gpu/nova/core/interrupts.rst         |   30 +-
 drivers/gpu/nova-core/fb/hal/gb100.rs              |   23 +-
 drivers/gpu/nova-core/fb/hal/gb202.rs              |    4 +-
 drivers/gpu/nova-core/firmware.rs                  |    7 +-
 drivers/gpu/nova-core/firmware/ucodes.rs           |   65 ++
 drivers/gpu/nova-core/fsp.rs                       |    3 +-
 drivers/gpu/nova-core/gsp.rs                       |    9 +-
 drivers/gpu/nova-core/gsp/boot.rs                  |   72 +-
 drivers/gpu/nova-core/gsp/cmdq.rs                  |  366 ++++---
 drivers/gpu/nova-core/gsp/cmdq/gmc.rs              |   21 +-
 drivers/gpu/nova-core/gsp/cmdq/rpc.rs              |   42 +-
 drivers/gpu/nova-core/gsp/cmdq/rpc/continuation.rs |   10 +-
 drivers/gpu/nova-core/gsp/commands.rs              |    7 +-
 drivers/gpu/nova-core/gsp/commands/gmc.rs          |  174 ++++
 drivers/gpu/nova-core/gsp/commands/rpc.rs          |  284 ------
 drivers/gpu/nova-core/gsp/fw.rs                    |  530 ++--------
 drivers/gpu/nova-core/gsp/fw/commands.rs           |  473 ++++-----
 drivers/gpu/nova-core/gsp/fw/r000_00/bindings.rs   |  385 +++++++
 drivers/gpu/nova-core/gsp/fw/r570_144.rs           |   31 -
 drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs  | 1060 --------------------
 drivers/gpu/nova-core/gsp/hal.rs                   |   13 -
 drivers/gpu/nova-core/gsp/hal/tu102.rs             |   12 -
 drivers/gpu/nova-core/gsp/load_exec.rs             |    1 -
 drivers/gpu/nova-core/gsp/nvkv.rs                  |    9 +-
 drivers/gpu/nova-core/gsp/sequencer.rs             |  353 -------
 drivers/gpu/nova-core/sbuffer.rs                   |    1 +
 27 files changed, 1266 insertions(+), 2721 deletions(-)
---
base-commit: d9da44362d77bcbf1f5bfd2ba1c514e776fdb07c
change-id: 20261202-b4-r000-switch-c9c3cd685b09

Best regards,
--  
Alexandre Courbot <acourbot@nvidia.com>


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 01/15] gpu: nova-core: gsp: nvkv: add const constructor for Key
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 02/15] gpu: nova-core: gsp: add the GSP_INIT command and its reply Alexandre Courbot
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

It is useful to be able to build keys as constants, which the `From`
implementation does not allow. Add a const `new` constructor and use it
where relevant.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/nvkv.rs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/nvkv.rs b/drivers/gpu/nova-core/gsp/nvkv.rs
index f81a9e60d89c..20015b5b0509 100644
--- a/drivers/gpu/nova-core/gsp/nvkv.rs
+++ b/drivers/gpu/nova-core/gsp/nvkv.rs
@@ -50,17 +50,22 @@ impl<T, const KEY_ID: KeyId, As> Key<T, KEY_ID, As> {
     /// The maximum size in bytes we allow to materialize on the stack while
     /// encoding or decoding a [`Key`]. This is checked at compile time.
     const MAX_STACK_SIZE: usize = 32;
+
+    /// Create a new [`Key`] from `value`.
+    pub(crate) const fn new(value: T) -> Self {
+        Self(value, PhantomData)
+    }
 }
 
 impl<T, const KEY_ID: KeyId, As> From<T> for Key<T, KEY_ID, As> {
     fn from(value: T) -> Self {
-        Self(value, PhantomData)
+        Self::new(value)
     }
 }
 
 impl<'a, T, const KEY_ID: KeyId, As, const N: usize> From<&'a [T; N]> for Key<&'a [T], KEY_ID, As> {
     fn from(value: &'a [T; N]) -> Self {
-        Self(&value[..], PhantomData)
+        Self::new(&value[..])
     }
 }
 

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 02/15] gpu: nova-core: gsp: add the GSP_INIT command and its reply
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 01/15] gpu: nova-core: gsp: nvkv: add const constructor for Key Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 03/15] gpu: nova-core: gsp: populate VF information in GSP_INIT Alexandre Courbot
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

The r000 boot protocol replaces the system-info, registry and
static-info RPC commands with one GMC command, GSP_INIT, whose payload
is an NVKV stream of key-value pairs. GSP-RM answers it once it has
finished starting, with the static GPU configuration.

Nova-core has the NVKV codec and the GSP_INIT schemas. It has no code
that fills the request schema in from the PCI device, and no code that
decodes the reply into the static configuration type that the boot
sequence returns.

Add the GSP_INIT command, whose variable payload is the encoded request,
and decode its reply into the static configuration type, so that the
rest of the driver reads the same configuration whichever firmware
reported it.

The request carries the registry keys that the r570 registry command
sends, and it reports the architecture that the kernel is built for.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
[acourbot: declare `REGISTRY_ENTRIES` as const `Key`s.]
[acourbot: avoid double-copy in `read`.]
[acourbot: use `CStr` in `RegKey::new`.]
[acourbot: return fixed-size arrays from `GspInitResponse`.]
Co-developed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/commands.rs     |   3 +
 drivers/gpu/nova-core/gsp/commands/gmc.rs | 133 +++++++++++++++++++++++++
 drivers/gpu/nova-core/gsp/fw/commands.rs  | 155 +++++++++++++++++++++++++++---
 3 files changed, 279 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index 91f63f704e55..b48cf30978cf 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -1,6 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
+// The r570 firmware does not use GMC.
+#[expect(dead_code)]
+pub(crate) mod gmc;
 pub(crate) mod rpc;
 
 use core::{
diff --git a/drivers/gpu/nova-core/gsp/commands/gmc.rs b/drivers/gpu/nova-core/gsp/commands/gmc.rs
new file mode 100644
index 000000000000..f74ada78f7ac
--- /dev/null
+++ b/drivers/gpu/nova-core/gsp/commands/gmc.rs
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: GPL-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+//! GMC (GPU Management Controller) API commands.
+
+use core::convert::Infallible;
+
+use kernel::{
+    device,
+    pci,
+    prelude::*,
+    time::Delta,
+    transmute::AsBytes, //
+};
+
+use crate::{
+    gpu::Chipset,
+    gsp::{
+        cmdq::gmc::{
+            CommandToGsp,
+            MessageFromGsp, //
+        },
+        commands::GspStaticInfo,
+        fw::{
+            commands::{
+                GspInitRequest,
+                GspInitResponseSchema, //
+            },
+            GmcCommandId, //
+        },
+        nvkv::{
+            Decoder,
+            Encodable,
+            Encoder,
+            Schema,
+            UnknownKeyPolicy, //
+        },
+    },
+    sbuffer::SBufferIter,
+};
+
+/// The `GSP_INIT` command, which carries the system information and registry keys to GSP-RM.
+///
+/// GSP-RM answers it with the static GPU configuration once it has finished starting.
+pub(crate) struct GspInit {
+    /// The NVKV-encoded request.
+    payload: KVVec<u64>,
+}
+
+impl GspInit {
+    /// Builds the request for `pdev`.
+    ///
+    /// # Errors
+    ///
+    /// - `ENOMEM` if the request or the encoder buffer cannot be allocated.
+    pub(crate) fn new(pdev: &pci::Device<device::Bound>, chipset: Chipset) -> Result<Self> {
+        let mut encoder = Encoder::new();
+        GspInitRequest::new(pdev, chipset)?.encode(&mut encoder)?;
+
+        Ok(Self {
+            payload: encoder.finish(),
+        })
+    }
+
+    /// Returns the request as the bytes that the GSP reads.
+    fn payload_bytes(&self) -> &[u8] {
+        AsBytes::as_bytes(self.payload.as_slice())
+    }
+}
+
+impl CommandToGsp for GspInit {
+    const COMMAND: GmcCommandId = GmcCommandId::GspInit;
+    /// Largest reply that the driver accepts, in bytes.
+    const MAX_REPLY_SIZE: u32 = 48 * 1024;
+    /// `GspInit` can take longer than 5 seconds to complete on some SKUs.
+    const COMPLETION_TIMEOUT: Delta = Delta::from_secs(15);
+    type Command = ();
+    type Reply = GspStaticInfo;
+    type InitError = Infallible;
+
+    fn init(&self) -> impl Init<Self::Command, Self::InitError> {
+        pin_init::init_zeroed()
+    }
+
+    fn variable_payload_len(&self) -> usize {
+        self.payload_bytes().len()
+    }
+
+    fn init_variable_payload(
+        &self,
+        dst: &mut SBufferIter<core::array::IntoIter<&mut [u8], 2>>,
+    ) -> Result {
+        dst.write_all(self.payload_bytes())
+    }
+}
+
+impl MessageFromGsp for GspStaticInfo {
+    type InitError = Error;
+
+    /// Decodes the `GSP_INIT` reply, an NVKV stream, into the static configuration.
+    ///
+    /// # Errors
+    ///
+    /// - `EINVAL` if the payload is not a whole number of NVKV words, if the stream is malformed
+    ///   or omits a required key, or if GSP-RM reported no framebuffer region.
+    /// - `ENOMEM` if the words or the decoded regions cannot be allocated.
+    fn read(payload: &mut SBufferIter<core::array::IntoIter<&[u8], 2>>) -> Result<Self> {
+        let mut words = KVVec::new();
+        while !payload.is_empty() {
+            let mut word = [0u8; size_of::<u64>()];
+            payload.read_exact(&mut word)?;
+            words.push(u64::from_le_bytes(word), GFP_KERNEL)?;
+        }
+
+        let decoder = Decoder::new(&words, UnknownKeyPolicy::Ignore);
+        let mut schema = KBox::init(GspInitResponseSchema::init(), GFP_KERNEL)?;
+        let reply = KBox::try_init(decoder.decode(&mut *schema)?, GFP_KERNEL)?;
+
+        let mut usable_fb_regions = KVec::new();
+        for region in reply.usable_fb_regions() {
+            usable_fb_regions.push(region, GFP_KERNEL)?;
+        }
+
+        Ok(GspStaticInfo {
+            gpu_name: reply.gpu_name(),
+            gpu_short_name: reply.gpu_short_name(),
+            gpu_gid: reply.gpu_gid(),
+            bar1_pde_base: reply.bar1_pde_base(),
+            usable_fb_regions,
+            total_fb_end: reply.total_fb_end().ok_or(EINVAL)?,
+        })
+    }
+}
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 76f8d4a75562..c7f544775ce9 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -331,6 +331,25 @@ fn from(value: HostArch) -> Self {
     }
 }
 
+impl HostArch {
+    /// Returns the variant that names the architecture for which this kernel is built.
+    fn host() -> Self {
+        if cfg!(target_arch = "x86_64") {
+            Self::X86_64
+        } else if cfg!(target_arch = "aarch64") {
+            Self::Aarch64
+        } else if cfg!(all(target_arch = "powerpc64", target_endian = "little")) {
+            Self::Ppc64le
+        } else if cfg!(target_arch = "arm") {
+            Self::Arm
+        } else if cfg!(target_arch = "riscv64") {
+            Self::Riscv64
+        } else {
+            Self::None
+        }
+    }
+}
+
 nvkv_encode! {
     /// A GSP registry entry.
     struct RegKey {
@@ -339,6 +358,18 @@ struct RegKey {
     }
 }
 
+impl RegKey {
+    /// Creates a registry entry.
+    ///
+    /// GSP-RM counts the NUL terminator in the encoded name length.
+    const fn new(key_name: &'static CStr, key_value: u32) -> Self {
+        Self {
+            key_name: Key::new(key_name.to_bytes_with_nul()),
+            key_value: Key::new(key_value),
+        }
+    }
+}
+
 impl Encodable for KVVec<RegKey> {
     fn encode(&self, encoder: &mut Encoder) -> Result {
         for regkey in self {
@@ -362,10 +393,7 @@ struct VfInfo {
 
 nvkv_encode! {
     /// Payload of the `GSP_INIT` command.
-    // TODO: expect() doesn't work here before rustc 1.97.0
-    // https://github.com/rust-lang/rust/pull/154377
-    #[allow(dead_code)]
-    struct GspInitRequest {
+    pub(crate) struct GspInitRequest {
         pci_device_id: Key<u32, 0x0001>,
         pci_sub_device_id: Key<u32, 0x0002>,
         pci_revision_id: Key<u32, 0x0003>,
@@ -406,15 +434,55 @@ fn new(dev: &pci::Device<device::Bound>) -> Self {
     }
 }
 
+/// Registry entries that the driver sends to GSP-RM on every boot.
+const REGISTRY_ENTRIES: [RegKey; 3] = [
+    // Enables PCI secondary bus reset.
+    RegKey::new(c"RMSecBusResetEnable", 1),
+    // Makes GSP-RM preserve PCI configuration registers across any PCI reset.
+    RegKey::new(c"RMForcePcieConfigSave", 1),
+    // Lets GSP-RM boot when the PCI device id is absent from its product name database.
+    RegKey::new(c"RMDevidCheckIgnore", 1),
+];
+
+impl GspInitRequest {
+    /// Creates the request for `dev`.
+    ///
+    /// The registry keys are [`REGISTRY_ENTRIES`].
+    ///
+    /// # Errors
+    ///
+    /// - `ENOMEM` if the registry list cannot be allocated.
+    pub(crate) fn new(dev: &pci::Device<device::Bound>, chipset: Chipset) -> Result<Self> {
+        let mut regkeys = KVVec::new();
+        for entry in REGISTRY_ENTRIES {
+            regkeys.push(entry, GFP_KERNEL)?;
+        }
+
+        let mirror = chipset.pci_config_mirror_range();
+        let device_id = (u32::from(dev.device_id()) << 16) | u32::from(dev.vendor_id().as_raw());
+        let sub_device_id =
+            (u32::from(dev.subsystem_device_id()) << 16) | u32::from(dev.subsystem_vendor_id());
+
+        Ok(Self {
+            pci_device_id: device_id.into(),
+            pci_sub_device_id: sub_device_id.into(),
+            pci_revision_id: u32::from(dev.revision_id()).into(),
+            pci_config_mirror_base: mirror.start.into(),
+            pci_config_mirror_size: (mirror.end - mirror.start).into(),
+            host_arch: HostArch::host().into(),
+            bus_device_func: u64::from(DomainBusDevice::new(dev)).into(),
+            regkeys,
+            vf_info: None,
+        })
+    }
+}
+
 // Decode:
 
 // Should decode with UnknownKeyPolicy::Ignore.
 nvkv_decode! {
     /// Schema for the `GSP_INIT` response.
-    // TODO: expect() doesn't work here before rustc 1.97.0
-    // https://github.com/rust-lang/rust/pull/154377
-    #[allow(dead_code)]
-    struct GspInitResponseSchema => GspInitResponse {
+    pub(crate) struct GspInitResponseSchema => GspInitResponse {
         gpu_name: TruncatingArray<u8, { GspStaticInfo::MAX_GPU_NAME_LEN }, 0x2000>,
         gpu_short_name: TruncatingArray<u8, { GspStaticInfo::MAX_GPU_NAME_LEN }, 0x2001>,
         gpu_gid: TruncatingArray<u8, { GspStaticInfo::GID_LEN }, 0x2002>,
@@ -425,10 +493,7 @@ struct GspInitResponseSchema => GspInitResponse {
 }
 
 /// Payload of the `GSP_INIT` response.
-// TODO: expect() doesn't work here before rustc 1.97.0
-// https://github.com/rust-lang/rust/pull/154377
-#[allow(dead_code)]
-struct GspInitResponse {
+pub(crate) struct GspInitResponse {
     gpu_name: ArrayVec<u8, { GspStaticInfo::MAX_GPU_NAME_LEN }>,
     gpu_short_name: ArrayVec<u8, { GspStaticInfo::MAX_GPU_NAME_LEN }>,
     gpu_gid: ArrayVec<u8, { GspStaticInfo::GID_LEN }>,
@@ -437,6 +502,72 @@ struct GspInitResponse {
     vmmu_segment_size: u64,
 }
 
+/// Copies `src` to the start of a zero-initialized array.
+fn zero_padded_array<const N: usize>(src: &ArrayVec<u8, N>) -> [u8; N] {
+    let mut dst = [0u8; N];
+    // PANIC: `src.len()` never exceeds `N` per the invariant of `ArrayVec`.
+    dst[..src.len()].copy_from_slice(src);
+    dst
+}
+
+impl GspInitResponse {
+    /// Tag of a general-purpose region. Any other tag marks a region that GSP-RM reserves for the
+    /// use that the tag names.
+    const FB_REGION_TAG_NONE: u32 = 0;
+
+    /// Returns the GPU name, zero-padded to [`GspStaticInfo::MAX_GPU_NAME_LEN`] bytes.
+    pub(crate) fn gpu_name(&self) -> [u8; GspStaticInfo::MAX_GPU_NAME_LEN] {
+        zero_padded_array(&self.gpu_name)
+    }
+
+    /// Returns the short GPU name, zero-padded to [`GspStaticInfo::MAX_GPU_NAME_LEN`] bytes.
+    pub(crate) fn gpu_short_name(&self) -> [u8; GspStaticInfo::MAX_GPU_NAME_LEN] {
+        zero_padded_array(&self.gpu_short_name)
+    }
+
+    /// Returns the SHA-1 based GPU identifier (GID), zero-padded to [`GspStaticInfo::GID_LEN`]
+    /// bytes.
+    pub(crate) fn gpu_gid(&self) -> [u8; GspStaticInfo::GID_LEN] {
+        zero_padded_array(&self.gpu_gid)
+    }
+
+    /// Returns an iterator over the FB regions from which the driver may allocate: the
+    /// general-purpose regions that are not protected and that support both compression and
+    /// isochronous access.
+    pub(crate) fn usable_fb_regions(&self) -> impl Iterator<Item = Range<u64>> + '_ {
+        self.fb_regions.iter().filter_map(|region| {
+            if region.limit >= region.base
+                && region.tag == Self::FB_REGION_TAG_NONE
+                && !region.flags.protected()
+                && region.flags.support_compressed()
+                && region.flags.support_iso()
+            {
+                region.limit.checked_add(1).map(|end| region.base..end)
+            } else {
+                None
+            }
+        })
+    }
+
+    /// Returns the exclusive end of the FB physical address space, which spans every region
+    /// including the ones that [`Self::usable_fb_regions`] leaves out.
+    ///
+    /// Returns `None` if no region that GSP-RM reported has a limit at or above its base.
+    pub(crate) fn total_fb_end(&self) -> Option<u64> {
+        self.fb_regions
+            .iter()
+            .filter(|region| region.limit >= region.base)
+            .map(|region| region.limit)
+            .max()?
+            .checked_add(1)
+    }
+
+    /// Returns the BAR1 page directory entry base address.
+    pub(crate) fn bar1_pde_base(&self) -> u64 {
+        self.bar1_pde_base
+    }
+}
+
 nvkv_decode! {
     /// Schema for one FB region of the `GSP_INIT` response.
     struct FbRegionSchema => FbRegion {

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 03/15] gpu: nova-core: gsp: populate VF information in GSP_INIT
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 01/15] gpu: nova-core: gsp: nvkv: add const constructor for Key Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 02/15] gpu: nova-core: gsp: add the GSP_INIT command and its reply Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 14:03   ` Maxime Ripard
  2026-12-03 12:09 ` [PATCH 04/15] gpu: nova-core: gsp: re-export PowerStateLevel from gsp::commands Alexandre Courbot
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: Zhi Wang <zhiw@nvidia.com>

GSP firmware requires the VF BAR layout to route interrupts and doorbell
events to individual virtual functions.

When vGPU mode is enabled, read the VF topology from the typed PCI
SR-IOV extended capability and populate the existing NVKV VF information
schema in GSP_INIT.

Signed-off-by: Zhi Wang <zhiw@nvidia.com>
Signed-off-by: Alok Kumar <alkumar@nvidia.com>
[acourbot: also add `RMSetSriovMode` regkey here.]
[acourbot: avoid double-match of `VgpuState`.]
[acourbot: use `bitfield!` for `VfInfo::flags`.]
[acourbot: document more returned errors.]
Co-developed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/commands/gmc.rs | 13 +++++--
 drivers/gpu/nova-core/gsp/fw/commands.rs  | 65 ++++++++++++++++++++++++++++---
 2 files changed, 70 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/commands/gmc.rs b/drivers/gpu/nova-core/gsp/commands/gmc.rs
index f74ada78f7ac..f0a0a6798d6b 100644
--- a/drivers/gpu/nova-core/gsp/commands/gmc.rs
+++ b/drivers/gpu/nova-core/gsp/commands/gmc.rs
@@ -37,6 +37,7 @@
         },
     },
     sbuffer::SBufferIter,
+    vgpu::VgpuState, //
 };
 
 /// The `GSP_INIT` command, which carries the system information and registry keys to GSP-RM.
@@ -52,10 +53,16 @@ impl GspInit {
     ///
     /// # Errors
     ///
-    /// - `ENOMEM` if the request or the encoder buffer cannot be allocated.
-    pub(crate) fn new(pdev: &pci::Device<device::Bound>, chipset: Chipset) -> Result<Self> {
+    /// - `ENOMEM` if the encoder buffer cannot be allocated.
+    ///
+    /// Errors from [`GspInitRequest::new`] are propagated as-is.
+    pub(crate) fn new(
+        pdev: &pci::Device<device::Bound>,
+        chipset: Chipset,
+        vgpu_state: VgpuState,
+    ) -> Result<Self> {
         let mut encoder = Encoder::new();
-        GspInitRequest::new(pdev, chipset)?.encode(&mut encoder)?;
+        GspInitRequest::new(pdev, chipset, vgpu_state)?.encode(&mut encoder)?;
 
         Ok(Self {
             payload: encoder.finish(),
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index c7f544775ce9..791a336bce16 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -1,7 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
 // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
-use core::ops::Range;
+use core::{
+    num::NonZero,
+    ops::Range, //
+};
 
 use kernel::{
     alloc::ArrayVec,
@@ -379,12 +382,24 @@ fn encode(&self, encoder: &mut Encoder) -> Result {
     }
 }
 
+bitfield! {
+    /// SR-IOV virtual function BAR capability flags.
+    struct VfFlags(u64) {
+        /// VF BAR0 uses 64-bit addressing.
+        0:0 bar0_is_64bit => bool;
+        /// VF BAR1 uses 64-bit addressing.
+        1:1 bar1_is_64bit => bool;
+        /// VF BAR2 uses 64-bit addressing.
+        2:2 bar2_is_64bit => bool;
+    }
+}
+
 nvkv_encode! {
     /// SR-IOV virtual function information.
     struct VfInfo {
         total_vfs: Key<u32, 0x0080>,
         first_vf_offset: Key<u32, 0x0081>,
-        flags: Key<u64, 0x1003>,
+        flags: Key<VfFlags, 0x1003, u64>,
         first_bar0_address: Key<u64, 0x1050>,
         first_bar1_address: Key<u64, 0x1051>,
         first_bar2_address: Key<u64, 0x1052>,
@@ -445,18 +460,58 @@ fn new(dev: &pci::Device<device::Bound>) -> Self {
 ];
 
 impl GspInitRequest {
+    fn build_vf_info(dev: &pci::Device<device::Bound>, total_vfs: NonZero<u16>) -> Result<VfInfo> {
+        let sriov = dev
+            .config_space_extended()?
+            .find_ext_capability::<pci::ExtSriovRegs>()?
+            .ok_or(ENODEV)?;
+
+        let mut vf_bars = sriov.vf_bars()?;
+        let bar0 = vf_bars.next().ok_or(EINVAL)?;
+        let bar1 = vf_bars.next().ok_or(EINVAL)?;
+        let bar2 = vf_bars.next().ok_or(EINVAL)?;
+        let flags = VfFlags::zeroed()
+            .with_bar0_is_64bit(bar0.is_64bit)
+            .with_bar1_is_64bit(bar1.is_64bit)
+            .with_bar2_is_64bit(bar2.is_64bit);
+
+        Ok(VfInfo {
+            total_vfs: u32::from(total_vfs.get()).into(),
+            first_vf_offset: u32::from(sriov.first_vf_offset()).into(),
+            flags: flags.into(),
+            first_bar0_address: bar0.address.into(),
+            first_bar1_address: bar1.address.into(),
+            first_bar2_address: bar2.address.into(),
+        })
+    }
+
     /// Creates the request for `dev`.
     ///
-    /// The registry keys are [`REGISTRY_ENTRIES`].
+    /// The registry keys are [`REGISTRY_ENTRIES`], plus `RMSetSriovMode` when `vgpu_state` reports
+    /// that vGPU is enabled.
     ///
     /// # Errors
     ///
     /// - `ENOMEM` if the registry list cannot be allocated.
-    pub(crate) fn new(dev: &pci::Device<device::Bound>, chipset: Chipset) -> Result<Self> {
+    /// - `ENODEV` if vGPU is enabled and the PCI SR-IOV capability is missing.
+    /// - `EINVAL` if vGPU is enabled and the extended configuration space, SR-IOV capability, or
+    ///   VF BAR layout is invalid.
+    pub(crate) fn new(
+        dev: &pci::Device<device::Bound>,
+        chipset: Chipset,
+        vgpu_state: VgpuState,
+    ) -> Result<Self> {
         let mut regkeys = KVVec::new();
         for entry in REGISTRY_ENTRIES {
             regkeys.push(entry, GFP_KERNEL)?;
         }
+        let vf_info = match vgpu_state {
+            VgpuState::Enabled { total_vfs } => {
+                regkeys.push(RegKey::new(c"RMSetSriovMode", 1), GFP_KERNEL)?;
+                Some(Self::build_vf_info(dev, total_vfs)?)
+            }
+            VgpuState::Disabled => None,
+        };
 
         let mirror = chipset.pci_config_mirror_range();
         let device_id = (u32::from(dev.device_id()) << 16) | u32::from(dev.vendor_id().as_raw());
@@ -472,7 +527,7 @@ pub(crate) fn new(dev: &pci::Device<device::Bound>, chipset: Chipset) -> Result<
             host_arch: HostArch::host().into(),
             bus_device_func: u64::from(DomainBusDevice::new(dev)).into(),
             regkeys,
-            vf_info: None,
+            vf_info,
         })
     }
 }

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 04/15] gpu: nova-core: gsp: re-export PowerStateLevel from gsp::commands
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (2 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 03/15] gpu: nova-core: gsp: populate VF information in GSP_INIT Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 05/15] gpu: nova-core: gsp: add the GSP_SUSPEND request Alexandre Courbot
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

PowerStateLevel is currently re-exported from gsp::commands::rpc, while
the upcoming GSP_SUSPEND GMC command will take it as well.

Re-export PowerStateLevel from gsp::commands alongside GspStaticInfo so
both command protocols and their callers can share it.

No functional change.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/boot.rs         | 15 +++++++--------
 drivers/gpu/nova-core/gsp/commands.rs     |  2 ++
 drivers/gpu/nova-core/gsp/commands/rpc.rs |  7 ++++---
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index 09ad11ac74cb..2904f1ac7459 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -16,7 +16,10 @@
     firmware::gsp::GspFirmware,
     gsp::{
         cmdq::Cmdq,
-        commands, //
+        commands::{
+            self,
+            PowerStateLevel, //
+        },
     },
 };
 
@@ -98,7 +101,7 @@ pub(crate) fn boot(
     fn shutdown_gsp(
         cmdq: &Cmdq<'_>,
         gsp_falcon: &Falcon<'_, Gsp>,
-        mode: commands::rpc::PowerStateLevel,
+        mode: PowerStateLevel,
     ) -> Result {
         // Command to shut the GSP down.
         cmdq.send_rpc_command(commands::rpc::UnloadingGuestDriver::new(mode))?;
@@ -118,12 +121,8 @@ pub(crate) fn unload(
         let dev = ctx.dev();
 
         // Shut down the GSP. Keep going even in case of error.
-        let mut res = Self::shutdown_gsp(
-            &self.cmdq,
-            ctx.gsp_falcon,
-            commands::rpc::PowerStateLevel::Level0,
-        )
-        .inspect_err(|e| dev_err!(dev, "GSP shutdown failed: {:?}\n", e));
+        let mut res = Self::shutdown_gsp(&self.cmdq, ctx.gsp_falcon, PowerStateLevel::Level0)
+            .inspect_err(|e| dev_err!(dev, "GSP shutdown failed: {:?}\n", e));
 
         // Run the unload bundle to reset the GSP so it can be booted again.
         if let Some(unload_bundle) = unload_bundle {
diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index b48cf30978cf..4ffcb4133e02 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -14,6 +14,8 @@
 
 use kernel::prelude::*;
 
+pub(crate) use crate::gsp::fw::commands::PowerStateLevel;
+
 /// The static GPU configuration, which GSP-RM reports in reply to
 /// [`GetGspStaticInfo`](rpc::GetGspStaticInfo).
 pub struct GspStaticInfo {
diff --git a/drivers/gpu/nova-core/gsp/commands/rpc.rs b/drivers/gpu/nova-core/gsp/commands/rpc.rs
index ab6d1114cead..084214d69f1f 100644
--- a/drivers/gpu/nova-core/gsp/commands/rpc.rs
+++ b/drivers/gpu/nova-core/gsp/commands/rpc.rs
@@ -27,7 +27,10 @@
             Cmdq,
             NoReply, //
         },
-        commands::GspStaticInfo,
+        commands::{
+            GspStaticInfo,
+            PowerStateLevel, //
+        },
         fw::{
             self,
             MsgFunction, //
@@ -240,8 +243,6 @@ fn read(
     }
 }
 
-pub(crate) use fw::commands::PowerStateLevel;
-
 /// The `UnloadingGuestDriver` command, used to shut down the GSP.
 ///
 /// Only used within the `gsp` module.

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 05/15] gpu: nova-core: gsp: add the GSP_SUSPEND request
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (3 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 04/15] gpu: nova-core: gsp: re-export PowerStateLevel from gsp::commands Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 06/15] gpu: nova-core: firmware: add the ucodes firmware loader Alexandre Courbot
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

The r000 firmware suspends GSP-RM on a GSP_SUSPEND request, a GMC
command whose payload is one word of flags. GSP-RM sends no response on
the message queue, and reports the completed suspend in the GSP falcon's
MAILBOX0 register instead.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
[acourbot: set GMCAPI_GSP_SUSPEND_FLAGS_HIBERNATE for Level7.]
[acourbot: use bitfield and drop the FromBytes/AsBytes impls.]
Co-developed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/commands/gmc.rs | 42 ++++++++++++++++++++++++++++---
 drivers/gpu/nova-core/gsp/fw/commands.rs  | 19 ++++++++++++++
 2 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/commands/gmc.rs b/drivers/gpu/nova-core/gsp/commands/gmc.rs
index f0a0a6798d6b..cec66b80c489 100644
--- a/drivers/gpu/nova-core/gsp/commands/gmc.rs
+++ b/drivers/gpu/nova-core/gsp/commands/gmc.rs
@@ -16,12 +16,19 @@
 use crate::{
     gpu::Chipset,
     gsp::{
-        cmdq::gmc::{
-            CommandToGsp,
-            MessageFromGsp, //
+        cmdq::{
+            gmc::{
+                CommandToGsp,
+                MessageFromGsp, //
+            },
+            NoReply, //
+        },
+        commands::{
+            GspStaticInfo,
+            PowerStateLevel, //
         },
-        commands::GspStaticInfo,
         fw::{
+            self,
             commands::{
                 GspInitRequest,
                 GspInitResponseSchema, //
@@ -101,6 +108,33 @@ fn init_variable_payload(
     }
 }
 
+/// The `GSP_SUSPEND` command, which suspends GSP-RM.
+///
+/// GSP-RM sends no reply on the message queue. It reports the completed suspend in the GSP
+/// falcon's `MAILBOX0` register instead.
+pub(crate) struct GspSuspend {
+    level: PowerStateLevel,
+}
+
+impl GspSuspend {
+    /// Creates a `GSP_SUSPEND` command for the given [`PowerStateLevel`].
+    pub(crate) fn new(level: PowerStateLevel) -> Self {
+        Self { level }
+    }
+}
+
+impl CommandToGsp for GspSuspend {
+    const COMMAND: GmcCommandId = GmcCommandId::GspSuspend;
+    type Command = u64;
+    type Reply = NoReply;
+    const MAX_REPLY_SIZE: u32 = 0;
+    type InitError = Infallible;
+
+    fn init(&self) -> impl Init<Self::Command, Self::InitError> {
+        u64::from(fw::commands::GspSuspendFlags::from(self.level))
+    }
+}
+
 impl MessageFromGsp for GspStaticInfo {
     type InitError = Error;
 
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 791a336bce16..2dae9f19b6c6 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -276,6 +276,25 @@ pub(crate) fn is_power_transition(self) -> bool {
     }
 }
 
+bitfield! {
+    /// Flags of the `GSP_SUSPEND` GMC command.
+    pub(crate) struct GspSuspendFlags(u64) {
+        /// GSP is being suspended as part of a power management transition (S3, hibernate, etc.)
+        /// rather than a full unload.
+        0:0 pm_transition => bool;
+        /// Hibernate (suspend to disk).
+        2:2 hibernate => bool;
+    }
+}
+
+impl From<PowerStateLevel> for GspSuspendFlags {
+    fn from(level: PowerStateLevel) -> Self {
+        Self::zeroed()
+            .with_pm_transition(level.is_power_transition())
+            .with_hibernate(level == PowerStateLevel::Level7)
+    }
+}
+
 /// Payload of the `UnloadingGuestDriver` command and message.
 #[repr(transparent)]
 #[derive(Clone, Copy, Debug, Zeroable)]

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 06/15] gpu: nova-core: firmware: add the ucodes firmware loader
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (4 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 05/15] gpu: nova-core: gsp: add the GSP_SUSPEND request Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 07/15] gpu: nova-core: gsp: define GSP_MSG_QUEUE_ELEMENT_SIZE_MAX without bindings Alexandre Courbot
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

The r000 GSP firmware includes a ucodes image, microcode that GSP-RM
loads at init time from a buffer that the driver maps for it. The image
is described by a TLV whose FILE tag names a separate file and whose
SIZE tag gives that file's length, which is the convention that the GSP
firmware image already uses.

Add the ucodes loader on top of the TLV parser. The loader maps the
image through a radix3 page table, as the GSP firmware image is mapped,
and the image is required on every chipset that nova-core supports.

This is part of the r000 support, and dead code until the switch.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Timur Tabi <ttabi@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/firmware.rs        |  1 +
 drivers/gpu/nova-core/firmware/ucodes.rs | 66 ++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)

diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova-core/firmware.rs
index 97d6b1d83967..7b216dff1d30 100644
--- a/drivers/gpu/nova-core/firmware.rs
+++ b/drivers/gpu/nova-core/firmware.rs
@@ -27,6 +27,7 @@
 pub(crate) mod radix3;
 pub(crate) mod riscv;
 pub(crate) mod tlv;
+pub(crate) mod ucodes;
 
 /// Structure used to describe some firmwares, notably FWSEC-FRTS.
 #[repr(C)]
diff --git a/drivers/gpu/nova-core/firmware/ucodes.rs b/drivers/gpu/nova-core/firmware/ucodes.rs
new file mode 100644
index 000000000000..153bb5172903
--- /dev/null
+++ b/drivers/gpu/nova-core/firmware/ucodes.rs
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+//! Loading of the ucodes image, the bindata blob of microcode that GSP-RM loads during
+//! initialization.
+
+use kernel::{
+    device,
+    dma::DmaAddress,
+    prelude::*, //
+};
+
+use crate::{
+    firmware::{
+        radix3::Radix3,
+        tlv::{
+            request_tlv,
+            Tlv, //
+        },
+    },
+    gpu::Chipset,
+};
+
+/// The ucodes image, mapped for GSP-RM through a radix3 page table.
+pub(crate) struct UcodesImage<'a> {
+    /// The image and the page table that maps it.
+    radix3: Pin<KBox<Radix3<'a>>>,
+}
+
+#[expect(dead_code)]
+impl<'a> UcodesImage<'a> {
+    /// Loads the ucodes image that the `ucodes` metadata file names, and maps it for `dev`.
+    ///
+    /// # Errors
+    ///
+    /// - `ENOENT` if the metadata file is not installed.
+    /// - `EINVAL` if the metadata is malformed.
+    /// - `ENOMEM` if the page table cannot be allocated.
+    ///
+    /// Errors from [`Tlv::load_file`] are propagated as-is.
+    pub(crate) fn new(dev: &'a device::Device<device::Bound>, chipset: Chipset) -> Result<Self> {
+        let firmware = request_tlv(dev, chipset, "ucodes")?;
+        let tlv = Tlv::new(firmware.data())?;
+        let image = tlv.load_file(dev, chipset)?;
+
+        dev_dbg!(
+            dev,
+            "loaded ucodes firmware v{}\n",
+            tlv.get_string(b"VERS")?
+        );
+
+        Ok(Self {
+            radix3: KBox::pin_init(Radix3::new(dev, image), GFP_KERNEL)?,
+        })
+    }
+
+    /// Returns the DMA address of the level 0 page of the page table that maps the image.
+    pub(crate) fn radix3_dma_address(&self) -> DmaAddress {
+        self.radix3.dma_address()
+    }
+
+    /// Returns the size of the image in bytes.
+    pub(crate) fn size(&self) -> usize {
+        self.radix3.size()
+    }
+}

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 07/15] gpu: nova-core: gsp: define GSP_MSG_QUEUE_ELEMENT_SIZE_MAX without bindings
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (5 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 06/15] gpu: nova-core: firmware: add the ucodes firmware loader Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 08/15] gpu: nova-core: fb: increase Blackwell reserved memory sizes for r000 Alexandre Courbot
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

The r570 bindings define GSP_MSG_QUEUE_ELEMENT_SIZE_MAX as 64 KiB (16
GSP pages). Starting with r000, GSP-RM no longer hardcodes this limit in
its headers and instead expects the driver to configure it at boot via
MESSAGE_QUEUE_INIT_ARGUMENTS.queueElementSizeMax, which both sides then
enforce on sent and received queue elements.

Define GSP_MSG_QUEUE_ELEMENT_SIZE_MAX directly as GSP_PAGE_SIZE * 16 so
we don't depend on the r570 bindings.

No functional change.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/fw.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 927c6548fbdd..b08f0834ca91 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -68,8 +68,9 @@
 };
 
 /// Maximum size of a single GSP message queue element in bytes.
-pub(crate) const GSP_MSG_QUEUE_ELEMENT_SIZE_MAX: usize =
-    cv!(bindings::GSP_MSG_QUEUE_ELEMENT_SIZE_MAX);
+///
+/// GSP-RM receives this value at boot and allocates a heap staging buffer of that size.
+pub(crate) const GSP_MSG_QUEUE_ELEMENT_SIZE_MAX: usize = GSP_PAGE_SIZE * 16;
 
 /// Empty type to group methods related to heap parameters for running the GSP firmware.
 enum GspFwHeapParams {}

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 08/15] gpu: nova-core: fb: increase Blackwell reserved memory sizes for r000
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (6 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 07/15] gpu: nova-core: gsp: define GSP_MSG_QUEUE_ELEMENT_SIZE_MAX without bindings Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 09/15] gpu: nova-core: gsp: drain the message queue while waiting for GSP suspend Alexandre Courbot
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

The r000 GSP firmware requires larger framebuffer reservations on
Blackwell than r570:

* On GB10x and GB20x, the PMU backing store grows from 8 MiB to
  0x950000 bytes and the PMU surfaces grow by 256 KiB.
* On GB20x, the non-WPR heap grows from 2 MiB + 128 KiB to 3 MiB.

Reserve the larger regions ahead of the r000 switch, as the r570
firmware also accepts larger carveouts.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/fb/hal/gb100.rs | 23 +++++++++++++++++++++--
 drivers/gpu/nova-core/fb/hal/gb202.rs |  4 ++--
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/nova-core/fb/hal/gb100.rs b/drivers/gpu/nova-core/fb/hal/gb100.rs
index 37b2ae762df4..34e9f08581fc 100644
--- a/drivers/gpu/nova-core/fb/hal/gb100.rs
+++ b/drivers/gpu/nova-core/fb/hal/gb100.rs
@@ -78,9 +78,28 @@ fn write_sysmem_flush_page_gb100(hshub0: Mmio<'_, regs::Hshub0Registers>, addr:
     hshub0.write_reg(regs::NV_PFB_HSHUB_EG_PCIE_FLUSH_SYSMEM_ADDR_LO::zeroed().with_adr(addr_lo));
 }
 
-// This PMU reservation size is r570-specific.
+/// Size of the PMU backing store (9 MiB + 320 KiB).
+const PMU_BACKING_STORE_SIZE: usize = (SZ_1M * 9) + SZ_64K * 5;
+
+/// Size of the PMU surfaces.
+const PMU_SURFACES_SIZE: usize = SZ_16M + SZ_256K;
+
+/// Miscellaneous PMU memory.
+const PMU_MISC_SIZE: usize = SZ_4K;
+
+/// Alignment of the PMU reserved region.
+const PMU_RESERVED_MEMORY_ALIGNMENT: Alignment = Alignment::SZ_128K;
+
+/// PMU region above FRTS: the backing store, the surfaces and the miscellaneous memory, aligned to
+/// [`PMU_RESERVED_MEMORY_ALIGNMENT`].
+const PMU_RESERVED_SIZE: usize = const_align_up(
+    PMU_BACKING_STORE_SIZE + PMU_SURFACES_SIZE + PMU_MISC_SIZE,
+    PMU_RESERVED_MEMORY_ALIGNMENT,
+)
+.unwrap();
+
 pub(super) const fn pmu_reserved_size_gb100() -> u32 {
-    cv!(const_align_up(SZ_8M + SZ_16M + SZ_4K, Alignment::SZ_128K).unwrap())
+    cv!(PMU_RESERVED_SIZE)
 }
 
 impl FbHal for Gb100 {
diff --git a/drivers/gpu/nova-core/fb/hal/gb202.rs b/drivers/gpu/nova-core/fb/hal/gb202.rs
index 4341ecf36188..40ea8e6b8a7d 100644
--- a/drivers/gpu/nova-core/fb/hal/gb202.rs
+++ b/drivers/gpu/nova-core/fb/hal/gb202.rs
@@ -73,8 +73,8 @@ fn pmu_reserved_size(&self) -> u32 {
 
     fn non_wpr_heap_size(&self) -> u64 {
         // Non-WPR heap for GB20x (see Open RM: kgspGetNonWprHeapSize, GB202+).
-        // This size is r570-specific.
-        u64::SZ_2M + u64::SZ_128K
+        // This size is r000-specific.
+        3 * u64::SZ_1M
     }
 
     fn frts_size(&self) -> u64 {

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 09/15] gpu: nova-core: gsp: drain the message queue while waiting for GSP suspend
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (7 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 08/15] gpu: nova-core: fb: increase Blackwell reserved memory sizes for r000 Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 10/15] gpu: nova-core: gsp: zero-initialize FMC boot parameter structs Alexandre Courbot
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

Unlike r570's UnloadingGuestDriver RPC, which GSP-RM answers only once
it is ready to suspend, r000's GSP_SUSPEND command has no reply, and
GSP-RM posts messages while tearing down. Because the GSP event
interrupt is already unregistered before unload(), nothing drains the
queue during the wait for the RISC-V core to suspend.

Drain the message queue on each poll iteration of shutdown_gsp(). On
r570, drain() returns immediately when no message is pending and
consumes any trailing events posted after the UnloadingGuestDriver
reply.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/boot.rs | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index 2904f1ac7459..fb474e5984a8 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -106,8 +106,19 @@ fn shutdown_gsp(
         // Command to shut the GSP down.
         cmdq.send_rpc_command(commands::rpc::UnloadingGuestDriver::new(mode))?;
 
-        // Wait until GSP signals it is suspended.
-        gsp_falcon.wait_for_processor_suspend()
+        // Wait until GSP signals it is suspended. GSP-RM posts messages while it suspends, and the
+        // GSP event interrupt is already freed, so this poll drains them.
+        read_poll_timeout(
+            || {
+                cmdq.drain()?;
+
+                Ok(gsp_falcon.is_processor_suspended())
+            },
+            |suspended| *suspended,
+            Delta::from_millis(10),
+            Delta::from_secs(5),
+        )
+        .map(|_| ())
     }
 
     /// Attempts to unload the GSP firmware.

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 10/15] gpu: nova-core: gsp: zero-initialize FMC boot parameter structs
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (8 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 09/15] gpu: nova-core: gsp: drain the message queue while waiting for GSP suspend Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 11/15] gpu: nova-core: firmware: add r000 GSP bindings Alexandre Courbot
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

Use Zeroable::init_zeroed() for the remaining fields of
GspAcrBootGspRmParams and GspRmParams instead of naming bindgen padding
fields, as the r000 bindings replace those padding fields with reserved
and zero-defaulted fields.

No functional change.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/fw.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index b08f0834ca91..74e642e11afc 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -1263,7 +1263,7 @@ fn new(target: GspDmaTarget, wpr_meta_addr: u64) -> impl Init<Self> {
             bIsGspRmBoot: 1,
             wprCarveoutOffset: 0,
             wprCarveoutSize: 0,
-            __bindgen_padding_0: Default::default(),
+            ..Zeroable::init_zeroed()
         });
 
         params
@@ -1277,7 +1277,7 @@ fn new(target: GspDmaTarget, libos_addr: u64) -> impl Init<Self> {
         let params = init!(Self {
             target: target as u32,
             bootArgsOffset: libos_addr,
-            __bindgen_padding_0: Default::default(),
+            ..Zeroable::init_zeroed()
         });
 
         params

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 11/15] gpu: nova-core: firmware: add r000 GSP bindings
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (9 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 10/15] gpu: nova-core: gsp: zero-initialize FMC boot parameter structs Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 12/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

Add the generated r000 GSP firmware bindings required to switch the
driver from r570 to r000: heap parameters, RPC header and function/event
codes, WPR metadata, LibOS memory region arguments, msgq TX header, GSP
startup arguments and FMC boot parameters.

Nothing uses these definitions until the switch to r000.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/fw/r000_00/bindings.rs | 385 +++++++++++++++++++++++
 1 file changed, 385 insertions(+)

diff --git a/drivers/gpu/nova-core/gsp/fw/r000_00/bindings.rs b/drivers/gpu/nova-core/gsp/fw/r000_00/bindings.rs
index 959e397c26aa..2d25cc39b323 100644
--- a/drivers/gpu/nova-core/gsp/fw/r000_00/bindings.rs
+++ b/drivers/gpu/nova-core/gsp/fw/r000_00/bindings.rs
@@ -73,6 +73,23 @@ fn eq(&self, _other: &__BindgenUnionField<T>) -> bool {
     }
 }
 impl<T> ::core::cmp::Eq for __BindgenUnionField<T> {}
+pub const NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_0: u32 = 0;
+pub const NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3: u32 = 3;
+pub const NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_7: u32 = 7;
+pub const NV_VGPU_MSG_SIGNATURE_VALID: u32 = 1129337430;
+pub const GSP_FW_HEAP_PARAM_OS_SIZE_LIBOS2: u32 = 0;
+pub const GSP_FW_HEAP_PARAM_OS_SIZE_LIBOS3_BAREMETAL: u32 = 23068672;
+pub const GSP_FW_HEAP_PARAM_BASE_RM_SIZE_TU10X: u32 = 8388608;
+pub const GSP_FW_HEAP_PARAM_BASE_RM_SIZE_GH100: u32 = 18874368;
+pub const GSP_FW_HEAP_PARAM_SIZE_PER_GB: u32 = 98304;
+pub const GSP_FW_HEAP_PARAM_CLIENT_ALLOC_SIZE: u32 = 100663296;
+pub const GSP_FW_HEAP_SIZE_VGPU_DEFAULT: u32 = 609222656;
+pub const GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS2_MIN_MB: u32 = 64;
+pub const GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS2_MAX_MB: u32 = 256;
+pub const GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS3_BAREMETAL_MIN_MB: u32 = 88;
+pub const GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS3_BAREMETAL_MAX_MB: u32 = 280;
+pub const GSP_FW_WPR_META_REVISION: u32 = 1;
+pub const GSP_FW_WPR_META_MAGIC: i64 = -2577556379034558285;
 pub type __u8 = ffi::c_uchar;
 pub type __u16 = ffi::c_ushort;
 pub type __u32 = ffi::c_uint;
@@ -81,6 +98,277 @@ impl<T> ::core::cmp::Eq for __BindgenUnionField<T> {}
 pub type u16_ = __u16;
 pub type u32_ = __u32;
 pub type u64_ = __u64;
+pub const NV_VGPU_MSG_FUNCTION_NOP: _bindgen_ty_2 = 0;
+pub const NV_VGPU_MSG_FUNCTION_SET_GUEST_SYSTEM_INFO: _bindgen_ty_2 = 1;
+pub const NV_VGPU_MSG_FUNCTION_ALLOC_ROOT: _bindgen_ty_2 = 2;
+pub const NV_VGPU_MSG_FUNCTION_ALLOC_DEVICE: _bindgen_ty_2 = 3;
+pub const NV_VGPU_MSG_FUNCTION_ALLOC_MEMORY: _bindgen_ty_2 = 4;
+pub const NV_VGPU_MSG_FUNCTION_ALLOC_CTX_DMA: _bindgen_ty_2 = 5;
+pub const NV_VGPU_MSG_FUNCTION_ALLOC_CHANNEL_DMA: _bindgen_ty_2 = 6;
+pub const NV_VGPU_MSG_FUNCTION_MAP_MEMORY: _bindgen_ty_2 = 7;
+pub const NV_VGPU_MSG_FUNCTION_BIND_CTX_DMA: _bindgen_ty_2 = 8;
+pub const NV_VGPU_MSG_FUNCTION_ALLOC_OBJECT: _bindgen_ty_2 = 9;
+pub const NV_VGPU_MSG_FUNCTION_FREE: _bindgen_ty_2 = 10;
+pub const NV_VGPU_MSG_FUNCTION_LOG: _bindgen_ty_2 = 11;
+pub const NV_VGPU_MSG_FUNCTION_UNLOADING_GUEST_DRIVER: _bindgen_ty_2 = 47;
+pub const NV_VGPU_MSG_FUNCTION_GET_STATIC_INFO: _bindgen_ty_2 = 51;
+pub const NV_VGPU_MSG_FUNCTION_GET_GSP_STATIC_INFO: _bindgen_ty_2 = 65;
+pub const NV_VGPU_MSG_FUNCTION_CONTINUATION_RECORD: _bindgen_ty_2 = 71;
+pub const NV_VGPU_MSG_FUNCTION_GSP_SET_SYSTEM_INFO: _bindgen_ty_2 = 72;
+pub const NV_VGPU_MSG_FUNCTION_SET_REGISTRY: _bindgen_ty_2 = 73;
+pub const NV_VGPU_MSG_FUNCTION_GSP_INIT_POST_OBJGPU: _bindgen_ty_2 = 74;
+pub const NV_VGPU_MSG_FUNCTION_GSP_RM_CONTROL: _bindgen_ty_2 = 76;
+pub type _bindgen_ty_2 = ffi::c_uint;
+pub const NV_VGPU_MSG_EVENT_GSP_INIT_DONE: _bindgen_ty_3 = 4097;
+pub const NV_VGPU_MSG_EVENT_POST_EVENT: _bindgen_ty_3 = 4099;
+pub const NV_VGPU_MSG_EVENT_RC_TRIGGERED: _bindgen_ty_3 = 4100;
+pub const NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED: _bindgen_ty_3 = 4101;
+pub const NV_VGPU_MSG_EVENT_OS_ERROR_LOG: _bindgen_ty_3 = 4102;
+pub const NV_VGPU_MSG_EVENT_UCODE_LIBOS_PRINT: _bindgen_ty_3 = 4108;
+pub const NV_VGPU_MSG_EVENT_GSP_LOCKDOWN_NOTICE: _bindgen_ty_3 = 4124;
+pub const NV_VGPU_MSG_EVENT_GSP_POST_NOCAT_RECORD: _bindgen_ty_3 = 4128;
+pub type _bindgen_ty_3 = ffi::c_uint;
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct MESSAGE_QUEUE_INIT_ARGUMENTS {
+    pub flags: u64_,
+    pub sharedMemPhysAddr: u64_,
+    pub cmdQueueOffset: u64_,
+    pub statQueueOffset: u64_,
+    pub queueElementHdrSize: u32_,
+    pub queueElementSizeMin: u32_,
+    pub queueElementSizeMax: u32_,
+    pub queueHeaderAlign: u32_,
+    pub queueElementAlign: u32_,
+    pub pageTableEntryCount: u32_,
+    pub reserved: [u8_; 8usize],
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GSP_SR_INIT_ARGUMENTS {
+    pub oldLevel: u32_,
+    pub flags: u32_,
+    pub reserved: [u8_; 8usize],
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GSP_ARGUMENTS_CACHED {
+    pub magic: u32_,
+    pub size: u16_,
+    pub reserved: [u8_; 2usize],
+    pub flags: u64_,
+    pub messageQueueInitArguments: MESSAGE_QUEUE_INIT_ARGUMENTS,
+    pub srInitArguments: GSP_SR_INIT_ARGUMENTS,
+    pub reserved2: [u8_; 4usize],
+    pub gpuInstance: u32_,
+    pub profilerArgs: GSP_ARGUMENTS_CACHED__bindgen_ty_1,
+    pub sysmemHeapArgs: GSP_ARGUMENTS_CACHED__bindgen_ty_2,
+    pub rmStateMonitorBufferArgs: GSP_ARGUMENTS_CACHED__bindgen_ty_3,
+    pub bindataArgs: GSP_ARGUMENTS_CACHED__bindgen_ty_4,
+    pub vbiosOverrideArgs: GSP_ARGUMENTS_CACHED__bindgen_ty_5,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GSP_ARGUMENTS_CACHED__bindgen_ty_1 {
+    pub pa: u64_,
+    pub size: u64_,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GSP_ARGUMENTS_CACHED__bindgen_ty_2 {
+    pub pa: u64_,
+    pub size: u64_,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GSP_ARGUMENTS_CACHED__bindgen_ty_3 {
+    pub pa: u64_,
+    pub size: u64_,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GSP_ARGUMENTS_CACHED__bindgen_ty_4 {
+    pub radix3: u64_,
+    pub size: u64_,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GSP_ARGUMENTS_CACHED__bindgen_ty_5 {
+    pub pa: u64_,
+    pub size: u64_,
+}
+#[repr(C)]
+#[derive(Copy, Clone, MaybeZeroable)]
+pub union rpc_message_rpc_union_field_v03_00 {
+    pub spare: u32_,
+    pub cpuRmGfid: u32_,
+}
+impl Default for rpc_message_rpc_union_field_v03_00 {
+    fn default() -> Self {
+        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+pub type rpc_message_rpc_union_field_v = rpc_message_rpc_union_field_v03_00;
+#[repr(C)]
+#[derive(MaybeZeroable)]
+pub struct rpc_message_header_v03_00 {
+    pub header_version: u32_,
+    pub signature: u32_,
+    pub length: u32_,
+    pub function: u32_,
+    pub rpc_result: u32_,
+    pub rpc_result_private: u32_,
+    pub sequence: u32_,
+    pub u: rpc_message_rpc_union_field_v,
+    pub rpc_message_data: __IncompleteArrayField<u8_>,
+}
+impl Default for rpc_message_header_v03_00 {
+    fn default() -> Self {
+        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+pub type rpc_message_header_v = rpc_message_header_v03_00;
+#[repr(C)]
+#[derive(Copy, Clone, MaybeZeroable)]
+pub struct GspFwWprMeta {
+    pub magic: u64_,
+    pub revision: u64_,
+    pub sysmemAddrOfRadix3Elf: u64_,
+    pub sizeOfRadix3Elf: u64_,
+    pub sysmemAddrOfBootloader: u64_,
+    pub sizeOfBootloader: u64_,
+    pub bootloaderCodeOffset: u64_,
+    pub bootloaderDataOffset: u64_,
+    pub bootloaderManifestOffset: u64_,
+    pub __bindgen_anon_1: GspFwWprMeta__bindgen_ty_1,
+    pub gspFwRsvdStart: u64_,
+    pub nonWprHeapOffset: u64_,
+    pub nonWprHeapSize: u64_,
+    pub gspFwWprStart: u64_,
+    pub gspFwHeapOffset: u64_,
+    pub gspFwHeapSize: u64_,
+    pub gspFwOffset: u64_,
+    pub bootBinOffset: u64_,
+    pub frtsOffset: u64_,
+    pub frtsSize: u64_,
+    pub gspFwWprEnd: u64_,
+    pub fbSize: u64_,
+    pub vgaWorkspaceOffset: u64_,
+    pub vgaWorkspaceSize: u64_,
+    pub bootCount: u64_,
+    pub __bindgen_anon_2: GspFwWprMeta__bindgen_ty_2,
+    pub gspFwHeapVfPartitionCount: u8_,
+    pub flags: u8_,
+    pub pagingConfig: u16_,
+    pub pmuReservedSize: u32_,
+    pub verified: u64_,
+}
+#[repr(C)]
+#[derive(Copy, Clone, MaybeZeroable)]
+pub union GspFwWprMeta__bindgen_ty_1 {
+    pub __bindgen_anon_1: GspFwWprMeta__bindgen_ty_1__bindgen_ty_1,
+    pub __bindgen_anon_2: GspFwWprMeta__bindgen_ty_1__bindgen_ty_2,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GspFwWprMeta__bindgen_ty_1__bindgen_ty_1 {
+    pub sysmemAddrOfSignature: u64_,
+    pub sizeOfSignature: u64_,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GspFwWprMeta__bindgen_ty_1__bindgen_ty_2 {
+    pub gspFwHeapFreeListWprOffset: u32_,
+    pub unused0: u32_,
+    pub unused1: u64_,
+}
+impl Default for GspFwWprMeta__bindgen_ty_1 {
+    fn default() -> Self {
+        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+#[repr(C)]
+#[derive(Copy, Clone, MaybeZeroable)]
+pub union GspFwWprMeta__bindgen_ty_2 {
+    pub __bindgen_anon_1: GspFwWprMeta__bindgen_ty_2__bindgen_ty_1,
+    pub __bindgen_anon_2: GspFwWprMeta__bindgen_ty_2__bindgen_ty_2,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GspFwWprMeta__bindgen_ty_2__bindgen_ty_1 {
+    pub partitionRpcAddr: u64_,
+    pub partitionRpcRequestOffset: u16_,
+    pub partitionRpcReplyOffset: u16_,
+    pub elfCodeOffset: u32_,
+    pub elfDataOffset: u32_,
+    pub elfCodeSize: u32_,
+    pub elfDataSize: u32_,
+    pub lsUcodeVersion: u32_,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GspFwWprMeta__bindgen_ty_2__bindgen_ty_2 {
+    pub partitionRpcPadding: [u32_; 4usize],
+    pub sysmemAddrOfCrashReportQueue: u64_,
+    pub sizeOfCrashReportQueue: u32_,
+    pub lsUcodeVersionPadding: [u32_; 1usize],
+}
+impl Default for GspFwWprMeta__bindgen_ty_2 {
+    fn default() -> Self {
+        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+impl Default for GspFwWprMeta {
+    fn default() -> Self {
+        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+pub type LibosAddress = u64_;
+pub const LibosMemoryRegionKind_LIBOS_MEMORY_REGION_CONTIGUOUS: LibosMemoryRegionKind = 1;
+pub type LibosMemoryRegionKind = ffi::c_uint;
+pub const LibosMemoryRegionLoc_LIBOS_MEMORY_REGION_LOC_SYSMEM: LibosMemoryRegionLoc = 1;
+pub type LibosMemoryRegionLoc = ffi::c_uint;
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct LibosMemoryRegionInitArgument {
+    pub id8: LibosAddress,
+    pub pa: LibosAddress,
+    pub size: LibosAddress,
+    pub kind: u8_,
+    pub loc: u8_,
+    pub __bindgen_padding_0: [u8; 6usize],
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct msgqTxHeader {
+    pub versionMajor: u16_,
+    pub versionMinor: u16_,
+    pub size: u32_,
+    pub msgSize: u32_,
+    pub msgCount: u32_,
+    pub entryOff: u32_,
+    pub reserved: [u32_; 3usize],
+}
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
 pub struct GSP_MSG_QUEUE_ENCRYPTION_TAG {
@@ -205,3 +493,100 @@ fn default() -> Self {
 pub const GMCAPI_COMMANDS_GMCAPI_CMD_MMU_FAULT_QUEUED: GMCAPI_COMMANDS = 262145;
 pub const GMCAPI_COMMANDS_GMCAPI_CMD_INVALID: GMCAPI_COMMANDS = 4294967295;
 pub type GMCAPI_COMMANDS = ffi::c_uint;
+pub const GSP_DMA_TARGET_GSP_DMA_TARGET_LOCAL_FB: GSP_DMA_TARGET = 0;
+pub const GSP_DMA_TARGET_GSP_DMA_TARGET_COHERENT_SYSTEM: GSP_DMA_TARGET = 1;
+pub const GSP_DMA_TARGET_GSP_DMA_TARGET_NONCOHERENT_SYSTEM: GSP_DMA_TARGET = 2;
+pub type GSP_DMA_TARGET = ffi::c_uint;
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GSP_FMC_INIT_PARAMS {
+    pub regkeys: u32_,
+    pub reserved: u32_,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone, MaybeZeroable)]
+pub struct GSP_ACR_BOOT_GSP_RM_PARAMS {
+    pub target: GSP_DMA_TARGET,
+    pub gspRmDescSize: u32_,
+    pub gspRmDescOffset: u64_,
+    pub wprCarveoutOffset: u64_,
+    pub wprCarveoutSize: u32_,
+    pub bIsGspRmBoot: u8_,
+    pub bInstInSysMode: u8_,
+    pub bIcuEnabled: u8_,
+    pub bScrubCbcSr: u8_,
+}
+impl Default for GSP_ACR_BOOT_GSP_RM_PARAMS {
+    fn default() -> Self {
+        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone, MaybeZeroable)]
+pub struct GSP_RM_PARAMS {
+    pub target: GSP_DMA_TARGET,
+    pub reserved: u32_,
+    pub bootArgsOffset: u64_,
+}
+impl Default for GSP_RM_PARAMS {
+    fn default() -> Self {
+        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone, MaybeZeroable)]
+pub struct GSP_SPDM_PARAMS {
+    pub target: GSP_DMA_TARGET,
+    pub payloadBufferSize: u32_,
+    pub payloadBufferOffset: u64_,
+}
+impl Default for GSP_SPDM_PARAMS {
+    fn default() -> Self {
+        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
+pub struct GSP_RM_MEM_PARAMS {
+    pub flushSysmemAddrValLo: u32_,
+    pub flushSysmemAddrValHi: u32_,
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone, MaybeZeroable)]
+pub struct GSP_FMC_BOOT_PARAMS {
+    pub magic: u32_,
+    pub size: u16_,
+    pub reserved0: u16_,
+    pub reserved1: [u64_; 3usize],
+    pub initParams: GSP_FMC_INIT_PARAMS,
+    pub reserved2: [u64_; 3usize],
+    pub bootGspRmParams: GSP_ACR_BOOT_GSP_RM_PARAMS,
+    pub reserved3: [u64_; 4usize],
+    pub gspRmParams: GSP_RM_PARAMS,
+    pub reserved4: [u64_; 2usize],
+    pub gspSpdmParams: GSP_SPDM_PARAMS,
+    pub reserved5: [u64_; 2usize],
+    pub gspRmMemParams: GSP_RM_MEM_PARAMS,
+    pub reserved6: [u64_; 7usize],
+}
+impl Default for GSP_FMC_BOOT_PARAMS {
+    fn default() -> Self {
+        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
+        unsafe {
+            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
+            s.assume_init()
+        }
+    }
+}

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 12/15] gpu: nova-core: switch to the r000 GSP firmware
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (10 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 11/15] gpu: nova-core: firmware: add r000 GSP bindings Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 13/15] gpu: nova-core: gsp: delete the GSP sequencer Alexandre Courbot
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

The r000 GSP firmware is not compatible with the r570 firmware that
nova-core boots:

* Every queue element opens with the r000 queue element header, and the
  queue pointers are in BAR0 registers, where r570 keeps them in shared
  memory.

* The GSP_INIT and GSP_SUSPEND commands replace the four RPC commands
  that the r570 boot and shutdown paths send, and the reply to GSP_INIT
  replaces the init-done event.

* Load-and-execute GMC events replace the command sequences that the
  r570 GSP-RM sends for the GSP sequencer to run.

* GSP-RM requires two more buffers at boot: the ucodes image and the
  state monitor buffer.

The driver loads one firmware, so a driver that handles some of these
differences and not the others boots neither firmware.

Switch the bindings, the message queue, the boot sequence and the
shutdown path to r000 together. Mark the post-boot HAL hook and r570 RPC
commands module as dead code until follow-up patches delete them.

Keep the RPC send and reply paths, and mark them as dead code. The
driver sends no RPC command, but the r000 GSP-RM still accepts RPC
commands once it is up.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
[acourbot: deslop and split.]
[acourbot: zero the driver's queue pointer registers on cmdq construction.]
[acourbot: do not drop unread GSP messages when the ring is full.]
Co-developed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 Documentation/gpu/nova/core/falcon.rst             |   2 +-
 Documentation/gpu/nova/core/interrupts.rst         |  30 +-
 drivers/gpu/nova-core/firmware.rs                  |   6 +-
 drivers/gpu/nova-core/firmware/ucodes.rs           |   1 -
 drivers/gpu/nova-core/gsp.rs                       |   8 +-
 drivers/gpu/nova-core/gsp/boot.rs                  |  44 ++-
 drivers/gpu/nova-core/gsp/cmdq.rs                  | 366 ++++++++++-----------
 drivers/gpu/nova-core/gsp/cmdq/gmc.rs              |  21 +-
 drivers/gpu/nova-core/gsp/cmdq/rpc.rs              |  42 +--
 drivers/gpu/nova-core/gsp/cmdq/rpc/continuation.rs |  10 +-
 drivers/gpu/nova-core/gsp/commands.rs              |   6 +-
 drivers/gpu/nova-core/gsp/fw.rs                    | 299 +++++++----------
 drivers/gpu/nova-core/gsp/fw/commands.rs           |   2 +-
 drivers/gpu/nova-core/gsp/hal.rs                   |   1 +
 drivers/gpu/nova-core/gsp/load_exec.rs             |   1 -
 15 files changed, 394 insertions(+), 445 deletions(-)

diff --git a/Documentation/gpu/nova/core/falcon.rst b/Documentation/gpu/nova/core/falcon.rst
index 33137082eb6c..c48984dcc482 100644
--- a/Documentation/gpu/nova/core/falcon.rst
+++ b/Documentation/gpu/nova/core/falcon.rst
@@ -85,7 +85,7 @@ On an Ampere GPU, for example, the boot verification flow is:
      component to load the SEC2-RTOS ucode onto the SEC2. The CPU cannot load
      LS code, and GSP-RM must run in LS mode. To overcome this, the GSP is
      temporarily made to run HS ucode (which is itself loaded by the CPU via
-     the nova-core driver using a "GSP-provided sequencer") which then loads
+     the nova-core driver on a "load-and-execute" event) which then loads
      the SEC2-RTOS ucode onto the SEC2 in LS mode. The GSP then resumes
      running its own GSP-RM LS ucode.
 
diff --git a/Documentation/gpu/nova/core/interrupts.rst b/Documentation/gpu/nova/core/interrupts.rst
index 13a087b960c0..27fa21f4b10f 100644
--- a/Documentation/gpu/nova/core/interrupts.rst
+++ b/Documentation/gpu/nova/core/interrupts.rst
@@ -448,10 +448,10 @@ thread to drain the queue::
 A halt and a posted message can be pending together, so the top half services
 every cause that the status reports.
 
-A drain fails when a message's framing or checksum is bad (see "Draining the
-GSP-to-CPU queue"). The message stays at the queue head, so every later drain
-would fail the same way, and the IRQ thread disables vector 155 and logs the
-failure, which leaves the queue unserviced until the device is reset.
+A drain fails when a message's framing is bad (see "Draining the GSP-to-CPU
+queue"). The message stays at the queue head, so every later drain would fail
+the same way, and the IRQ thread disables vector 155 and logs the failure,
+which leaves the queue unserviced until the device is reset.
 
 The handler, the self-test, and the rest of the driver read BAR0 through one
 shared mapping. nova-core unregisters an interrupt handler when the device
@@ -566,8 +566,9 @@ unloads the GSP.
 Draining the GSP-to-CPU queue
 -----------------------------
 
-The queue carries command replies and unsolicited events, and a message's
-function code says which it is.
+The queue carries RPC and GMC messages, selected by the element header's NVDM
+type. For RPC messages, a message's function code says whether it is a command
+reply or an unsolicited event:
 
 * A function code that matches the awaited reply: the message is decoded and
   returned to the caller that sent the command.
@@ -578,17 +579,16 @@ function code says which it is.
   receive trace at debug level already records every message's arrival with
   its sequence number, function code, and length.
 
-The sequence number takes no part in the match, because the GSP does not echo
-the command's sequence number on every reply. On r570 the reply to
-``UnloadingGuestDriver`` carries sequence 0.
+GMC replies match on command ID and sequence number, and GMC events arriving
+during a wait go to the caller's handler; unclaimed replies and unknown command
+IDs are logged at warning level, and other GMC events are dropped.
 
-The read pointer advances past every message that passes framing and checksum
-validation, whether it matched or was an event.
+The RPC sequence number takes no part in the match.
 
-A message's length is inside the region that the checksum covers, so once the
-framing or the checksum fails there is no trustworthy length with which to skip
-the message. Such a message stays at the queue head, and every later receive
-fails on it with ``EIO`` until the device is reset.
+The read pointer advances past every valid element, whether it matched or was
+an event. An element that fails framing or message-header validation, or
+carries an unsupported NVDM type, stays at the queue head and every later
+receive fails with ``EIO`` until the device is reset.
 
 The polling path and the IRQ thread both read the queue under the command-queue
 mutex. Replies and events share one queue and one read pointer, so one lock is
diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova-core/firmware.rs
index 7b216dff1d30..cea56411a3e2 100644
--- a/drivers/gpu/nova-core/firmware.rs
+++ b/drivers/gpu/nova-core/firmware.rs
@@ -300,7 +300,11 @@ const fn make_entry_chipset(self, chipset: gpu::Chipset) -> Self {
         let mut this = self
             .make_entry_file(name, "gsp_bootloader.tlv")
             .make_entry_file(name, "gsp.tlv")
-            .make_entry_file(name, "gsp.bin");
+            .make_entry_file(name, "gsp.bin")
+            .make_entry_file(name, "ucodes.tlv")
+            // The metadata's FILE tag gives the image's real file name at run time. This static
+            // entry names the usual one.
+            .make_entry_file(name, "ucodes.bin");
 
         // Add the firmware files specific to the GSP boot method of `chipset`.
         let boot_files = boot_firmware_files(chipset);
diff --git a/drivers/gpu/nova-core/firmware/ucodes.rs b/drivers/gpu/nova-core/firmware/ucodes.rs
index 153bb5172903..283a5e4fc1fc 100644
--- a/drivers/gpu/nova-core/firmware/ucodes.rs
+++ b/drivers/gpu/nova-core/firmware/ucodes.rs
@@ -27,7 +27,6 @@ pub(crate) struct UcodesImage<'a> {
     radix3: Pin<KBox<Radix3<'a>>>,
 }
 
-#[expect(dead_code)]
 impl<'a> UcodesImage<'a> {
     /// Loads the ucodes image that the `ucodes` metadata file names, and maps it for `dev`.
     ///
diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
index d36dd6e9cd2c..05c1aa9d2159 100644
--- a/drivers/gpu/nova-core/gsp.rs
+++ b/drivers/gpu/nova-core/gsp.rs
@@ -164,8 +164,12 @@ pub(crate) fn new(
             // kgspSetupLibosInitArgs_IMPL (creates pLibosInitArgs[] array)
             Ok(try_pin_init!(Self {
                 cmdq <- Cmdq::new(dev, bar),
-                rmargs: Coherent::init(dev, GFP_KERNEL, GspArgumentsPadded::new(&cmdq))?,
                 rm_state_monitor: Coherent::zeroed(dev, GFP_KERNEL)?,
+                rmargs: Coherent::init(
+                    dev,
+                    GFP_KERNEL,
+                    GspArgumentsPadded::new(&cmdq, rm_state_monitor),
+                )?,
                 libos: {
                     let mut libos = LibosWriter::new(dev)?;
                     log_buffers.init_arguments(&mut libos)?;
@@ -185,6 +189,6 @@ pub(crate) fn new(
 pub(crate) struct BootResult<'a> {
     /// The unload bundle for [`Gsp::unload`], if one could be built.
     pub(crate) unload_bundle: Option<UnloadBundle<'a>>,
-    /// The static GPU configuration as reported by GSP-RM.
+    /// The static GPU configuration, as decoded from the `GSP_INIT` reply.
     pub(crate) static_info: commands::GspStaticInfo,
 }
diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index fb474e5984a8..763dbe1f8fdb 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -13,13 +13,20 @@
         gsp::Gsp,
         Falcon, //
     },
-    firmware::gsp::GspFirmware,
+    firmware::{
+        gsp::GspFirmware,
+        ucodes::UcodesImage, //
+    },
     gsp::{
         cmdq::Cmdq,
         commands::{
-            self,
+            gmc::{
+                GspInit,
+                GspSuspend, //
+            },
             PowerStateLevel, //
         },
+        fw::GspArgumentsPadded, //
     },
 };
 
@@ -44,14 +51,10 @@ pub(crate) fn boot(
 
         let gsp_fw = KBox::pin_init(GspFirmware::new(dev, chipset), GFP_KERNEL)?;
 
-        self.cmdq
-            .send_rpc_command_no_wait(commands::rpc::SetSystemInfo::new(
-                pdev,
-                chipset,
-                ctx.vgpu.state(),
-            ))?;
-        self.cmdq
-            .send_rpc_command_no_wait(commands::rpc::SetRegistry::new(ctx.vgpu.state())?)?;
+        // GSP-RM only needs the ucodes image while it starts up, so the image can be freed when the
+        // boot sequence returns.
+        let ucodes = UcodesImage::new(dev, chipset)?;
+        GspArgumentsPadded::set_ucodes(&self.rmargs, &ucodes);
 
         // Perform the chipset-specific boot sequence, and retrieve the unload bundle.
         let unload_bundle = hal.boot(&self, &mut ctx, &gsp_fw)?.or_else(|| {
@@ -82,14 +85,19 @@ pub(crate) fn boot(
 
         dev_dbg!(pdev, "RISC-V active? {}\n", gsp_falcon.is_riscv_active(),);
 
-        hal.post_boot(&self, ctx, &gsp_fw)?;
-
-        // Wait until GSP is fully initialized.
-        commands::rpc::wait_gsp_init_done(&self.cmdq)?;
-
+        // GSP-RM answers `GSP_INIT` once it has finished starting, which includes the
+        // load-and-execute events that it raises along the way.
+        let libos_dma_address = self.libos.dma_address();
+        let bootloader_app_version = gsp_fw.bootloader.app_version;
         let static_info = self
             .cmdq
-            .send_rpc_command(commands::rpc::GetGspStaticInfo)?;
+            .send_gmc_command(GspInit::new(pdev, chipset, ctx.vgpu.state())?, |event| {
+                ctx.handle_load_exec_event(libos_dma_address, bootloader_app_version, event)
+            })?
+            .map_err(|status| {
+                dev_err!(dev, "GSP_INIT failed with status {:#x}\n", status);
+                EIO
+            })?;
 
         Ok(super::BootResult {
             unload_bundle: unload_guard.dismiss().1,
@@ -103,8 +111,8 @@ fn shutdown_gsp(
         gsp_falcon: &Falcon<'_, Gsp>,
         mode: PowerStateLevel,
     ) -> Result {
-        // Command to shut the GSP down.
-        cmdq.send_rpc_command(commands::rpc::UnloadingGuestDriver::new(mode))?;
+        // Command to shut the GSP down. GSP-RM does not answer it.
+        cmdq.send_gmc_command_no_wait(GspSuspend::new(mode))?;
 
         // Wait until GSP signals it is suspended. GSP-RM posts messages while it suspends, and the
         // GSP event interrupt is already freed, so this poll drains them.
diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
index 10f6ddcf3eb5..f6bede6a77e7 100644
--- a/drivers/gpu/nova-core/gsp/cmdq.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq.rs
@@ -1,12 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
 // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
-// The transport header of the r570 firmware carries no message type, so nothing can produce or
-// consume a GMC message before the switch to r000. Until then the module is built as dead code.
-#[expect(dead_code)]
 pub(super) mod gmc;
+#[expect(dead_code)]
 pub(super) mod rpc;
 
+use core::cell::Cell;
+
 use kernel::{
     device,
     dma::{
@@ -26,9 +26,7 @@
     sync::{
         barrier::{
             dma_mb,
-            Full,
-            Read,
-            Write, //
+            Full, //
         },
         Mutex, //
     },
@@ -45,21 +43,22 @@
 
 use pin_init::pin_init_scope;
 
+use zerocopy::FromBytes as _;
+
 use crate::{
     driver::Bar0,
     gsp::{
         fw::{
-            GspMsgElement,
-            MsgqRxHeader,
             MsgqTxHeader,
+            QueueElementHeader,
             GSP_MSG_QUEUE_ELEMENT_SIZE_MAX, //
         },
         PteArray,
         GSP_PAGE_SHIFT,
         GSP_PAGE_SIZE, //
     },
-    num,
-    sbuffer::SBufferIter, //
+    mctp::NvdmType,
+    num, //
 };
 
 use super::regs;
@@ -70,14 +69,17 @@
 
 /// Trait implemented by types that can be sent as a single command queue element.
 ///
-/// The command queue allocates `size()` bytes after the `GspMsgElement` header and calls `write()`
-/// to fill them.
+/// The command queue allocates `size()` bytes after the [`QueueElementHeader`] and calls `write()`
+/// to fill them with the message header and the message.
 trait CommandElement {
-    /// Size in bytes of the element, not including the `GspMsgElement` header.
+    /// NVDM type that the queue element header announces for this kind of message.
+    const NVDM_TYPE: NvdmType;
+
+    /// Size in bytes of the element, not including the [`QueueElementHeader`].
     fn size(&self) -> usize;
 
-    /// Writes the contents of the command into `dst`. `dev` is the queue's device (to be used for
-    /// logging), `seq` is the sequence number of the element.
+    /// Writes the message header and the contents of the command into `dst`. `dev` is the queue's
+    /// device (to be used for logging), `seq` is the sequence number of the element.
     fn write(&self, dev: &device::Device, seq: u32, dst: &mut GspCommand<'_>) -> Result;
 }
 
@@ -107,17 +109,13 @@ struct MsgqData {
 ///
 /// Contains the data for a message queue, that either the driver or GSP writes to.
 ///
-/// Note that while the write pointer of `tx` corresponds to the `msgq` of the same instance, the
-/// read pointer of `rx` actually refers to the `Msgq` owned by the other side.
-/// This design ensures that only the driver or GSP ever writes to a given instance of this struct.
+/// The queue pointers are in BAR0 registers, so `tx` carries the queue's geometry alone.
 #[repr(C)]
 // There is no struct defined for this in the open-gpu-kernel-source headers.
 // Instead it is defined by code in `GspMsgQueuesInit()`.
 struct Msgq {
-    /// Header for sending messages, including the write pointer.
+    /// The msgq TX header, which describes the queue to the GSP.
     tx: MsgqTxHeader,
-    /// Header for receiving messages, including the read pointer.
-    rx: MsgqRxHeader,
     /// The message queue proper.
     msgq: MsgqData,
 }
@@ -127,15 +125,11 @@ struct Msgq {
 struct GspMem {
     /// Self-mapping page table entries.
     ptes: PteArray<{ Self::PTE_ARRAY_SIZE }>,
-    /// CPU queue: the driver writes commands here, and the GSP reads them. It also contains the
-    /// write and read pointers that the CPU updates. This means that the read pointer here is an
-    /// index into the GSP queue.
+    /// CPU queue: the driver writes commands here, and the GSP reads them.
     ///
     /// This member is read-only for the GSP.
     cpuq: Msgq,
-    /// GSP queue: the GSP writes messages here, and the driver reads them. It also contains the
-    /// write and read pointers that the GSP updates. This means that the read pointer here is an
-    /// index into the CPU queue.
+    /// GSP queue: the GSP writes messages here, and the driver reads them.
     ///
     /// This member is read-only for the driver.
     gspq: Msgq,
@@ -153,22 +147,33 @@ unsafe impl AsBytes for GspMem {}
 // that is not a problem because they are not used outside the kernel.
 unsafe impl FromBytes for GspMem {}
 
-/// Wrapper around [`GspMem`] to share it with the GPU using a [`Coherent`].
+/// Shared GSP queue memory and BAR0 pointer state.
 ///
-/// This provides the low-level functionality to communicate with the GSP, including allocation of
-/// queue space to write messages to and management of read/write pointers.
+/// Queue pointers are monotonic `u32` element counters (empty when equal, full when differing by
+/// [`MSGQ_NUM_PAGES`]):
 ///
-/// This is shared with the GSP, with clear ownership rules regarding the command queues:
+/// * The driver is allowed to write the slots of `cpuq` between [`Self::cpu_write_ptr`] and
+///   [`Self::gsp_read_ptr`] (i.e. the slice returned by [`Self::driver_write_area`]).
+/// * The driver is allowed to read the slots of `gspq` between [`Self::cpu_read_ptr`] and
+///   [`Self::gsp_write_ptr`] (i.e. the slice returned by [`Self::driver_read_area`]).
 ///
-/// * The driver owns (i.e. can write to) the part of the CPU message queue between the CPU write
-///   pointer and the GSP read pointer. This region is returned by [`Self::driver_write_area`].
-/// * The driver owns (i.e. can read from) the part of the GSP message queue between the CPU read
-///   pointer and the GSP write pointer. This region is returned by [`Self::driver_read_area`].
+/// Resetting the GSP falcon while GSP-RM is suspended (e.g. during a load-and-execute event)
+/// zeroes the BAR0 pointer registers without resetting GSP-RM's counters in memory: once resumed,
+/// GSP-RM continues from its pre-reset counts. The driver therefore tracks its own counters
+/// locally and caches the last valid GSP counts to fall back to while the registers read zero.
 struct DmaGspMem<'a> {
     /// The queues, mapped for the GSP.
     mem: Coherent<'a, GspMem>,
-    /// MMIO mapping of PCI BAR0, for the doorbell register.
+    /// MMIO mapping of PCI BAR0, for the queue pointer registers.
     bar: Bar0<'a>,
+    /// Number of elements written to `cpuq`, published via [`regs::NV_PGSP_QUEUE_HEAD`].
+    cpu_write_ptr: u32,
+    /// Number of elements consumed from `gspq`, published via [`regs::NV_PGSP_MSGQ_TAIL`].
+    cpu_read_ptr: u32,
+    /// Last valid [`regs::NV_PGSP_QUEUE_TAIL`] read.
+    last_gsp_read_ptr: Cell<u32>,
+    /// Last valid [`regs::NV_PGSP_MSGQ_HEAD`] read.
+    last_gsp_write_ptr: Cell<u32>,
 }
 
 impl<'a> DmaGspMem<'a> {
@@ -176,12 +181,22 @@ impl<'a> DmaGspMem<'a> {
     fn new(dev: &'a device::Device<device::Bound>, bar: Bar0<'a>) -> Result<Self> {
         let mut gsp_mem = CoherentBox::<'_, GspMem>::zeroed(dev, GFP_KERNEL)?;
         gsp_mem.cpuq.tx = MsgqTxHeader::new();
-        gsp_mem.cpuq.rx = MsgqRxHeader::new();
 
         let gsp_mem: Coherent<'_, _> = gsp_mem.into();
         PteArray::init(io_project!(gsp_mem, .ptes), gsp_mem.dma_address())?;
 
-        Ok(Self { mem: gsp_mem, bar })
+        // Zero the driver's queue pointer registers to match `cpu_write_ptr` and `cpu_read_ptr`.
+        bar.write(Array::at(0), regs::NV_PGSP_QUEUE_HEAD::zeroed());
+        bar.write(Array::at(0), regs::NV_PGSP_MSGQ_TAIL::zeroed());
+
+        Ok(Self {
+            mem: gsp_mem,
+            bar,
+            cpu_write_ptr: 0,
+            cpu_read_ptr: 0,
+            last_gsp_read_ptr: Cell::new(0),
+            last_gsp_write_ptr: Cell::new(0),
+        })
     }
 
     /// Returns the region of the CPU message queue that the driver is currently allowed to write
@@ -191,12 +206,11 @@ fn new(dev: &'a device::Device<device::Bound>, bar: Bar0<'a>) -> Result<Self> {
     /// that case the second slice will have a non-zero length.
     fn driver_write_area(&mut self) -> (&mut [[u8; GSP_PAGE_SIZE]], &mut [[u8; GSP_PAGE_SIZE]]) {
         let avail = usize::from_safe_cast(self.cpuq_free_slots());
-        let w_slot = usize::from_safe_cast(self.cpu_write_ptr());
+        let w_slot = usize::from_safe_cast(self.cpu_write_ptr % MSGQ_NUM_PAGES);
 
         // Number of slots from `w_slot` to the end of the ring, capped by `avail`.
         //
-        // `w_slot` is below `MSGQ_NUM_PAGES` per the invariant of `cpu_write_ptr`, so the
-        // subtraction cannot underflow.
+        // `w_slot` is below `MSGQ_NUM_PAGES` so the subtraction cannot underflow.
         let after_len = avail.min(cv!(MSGQ_NUM_PAGES => usize) - w_slot);
         // Remaining slots from the beginning of the ring (0 unless we wrap).
         //
@@ -207,28 +221,24 @@ fn new(dev: &'a device::Device<device::Bound>, bar: Bar0<'a>) -> Result<Self> {
         // PANIC: `w_slot + after_len` is at most `MSGQ_NUM_PAGES` by construction of
         // `after_len`.
         let after = io_project!(self.mem, .cpuq.msgq.data[panic: w_slot..w_slot + after_len]);
-        // PANIC: `before_len` is at most `avail`, which is below `MSGQ_NUM_PAGES`.
+        // PANIC: `before_len` is at most `avail`, which is at most `MSGQ_NUM_PAGES`.
         let before = io_project!(self.mem, .cpuq.msgq.data[panic: ..before_len]);
 
         // SAFETY:
         // - Both regions are within the `avail` entries starting at `w_slot` that the driver owns,
         //   meaning the GSP won't touch them until the write pointer is advanced.
         // - There are no other references possible as `self` is mutably borrowed.
-        // - The regions do not overlap: `avail` is at most `MSGQ_NUM_PAGES - 1`, so `before_len` is
-        //   strictly less than `w_slot` whenever it is non-zero.
+        // - The regions do not overlap: `avail` is at most `MSGQ_NUM_PAGES`, so `before_len` is
+        //   at most `w_slot`.
         unsafe { (after.as_mut(), before.as_mut()) }
     }
 
     /// Returns the number of slots of the CPU message queue that the driver is currently allowed
-    /// to write to.
+    /// to write to: the ring size minus the elements that the GSP has not consumed yet.
     fn cpuq_free_slots(&self) -> u32 {
-        let tx = self.cpu_write_ptr();
-        let rx = self.gsp_read_ptr();
+        let used = self.cpu_write_ptr.wrapping_sub(self.gsp_read_ptr());
 
-        // `rx` and `tx` are both in `0..MSGQ_NUM_PAGES` per the invariants of `gsp_read_ptr` and
-        // `cpu_write_ptr`. The minimum value case is where `rx == 0` and `tx == MSGQ_NUM_PAGES -
-        // 1`, which gives `0 + MSGQ_NUM_PAGES - (MSGQ_NUM_PAGES - 1) - 1 == 0`.
-        (rx + MSGQ_NUM_PAGES - tx - 1) % MSGQ_NUM_PAGES
+        MSGQ_NUM_PAGES.saturating_sub(used)
     }
 
     /// Returns the size of the region of the CPU message queue that the driver is currently allowed
@@ -238,14 +248,9 @@ fn driver_write_area_size(&self) -> usize {
     }
 
     /// Returns the number of slots of the GSP message queue that the driver is currently allowed
-    /// to read from.
+    /// to read from: the elements that the GSP has posted and the driver has not consumed yet.
     fn gspq_readable_slots(&self) -> u32 {
-        let tx = self.gsp_write_ptr();
-        let rx = self.cpu_read_ptr();
-
-        // `rx` and `tx` are both in `0..MSGQ_NUM_PAGES` per the invariants of `gsp_write_ptr` and
-        // `cpu_read_ptr`, so the subtraction cannot underflow.
-        (tx + MSGQ_NUM_PAGES - rx) % MSGQ_NUM_PAGES
+        self.gsp_write_ptr().wrapping_sub(self.cpu_read_ptr)
     }
 
     /// Returns the region of the GSP message queue that the driver is currently allowed to read
@@ -255,12 +260,11 @@ fn gspq_readable_slots(&self) -> u32 {
     /// that case the second slice will have a non-zero length.
     fn driver_read_area(&self) -> (&[[u8; GSP_PAGE_SIZE]], &[[u8; GSP_PAGE_SIZE]]) {
         let avail = usize::from_safe_cast(self.gspq_readable_slots());
-        let r_slot = usize::from_safe_cast(self.cpu_read_ptr());
+        let r_slot = usize::from_safe_cast(self.cpu_read_ptr % MSGQ_NUM_PAGES);
 
         // Number of slots from `r_slot` to the end of the ring, capped by `avail`.
         //
-        // `r_slot` is below `MSGQ_NUM_PAGES` per the invariant of `cpu_read_ptr`, so the
-        // subtraction cannot underflow.
+        // `r_slot` is below `MSGQ_NUM_PAGES` so the subtraction cannot underflow.
         let after_len = avail.min(cv!(MSGQ_NUM_PAGES => usize) - r_slot);
         // Remaining slots from the beginning of the ring (0 unless we wrap).
         //
@@ -271,7 +275,7 @@ fn gspq_readable_slots(&self) -> u32 {
         // PANIC: `r_slot + after_len` is at most `MSGQ_NUM_PAGES` by construction of
         // `after_len`.
         let after = io_project!(self.mem, .gspq.msgq.data[panic: r_slot..r_slot + after_len]);
-        // PANIC: `before_len` is at most `avail`, which is below `MSGQ_NUM_PAGES`.
+        // PANIC: `before_len` is at most `avail`, which is at most `MSGQ_NUM_PAGES`.
         let before = io_project!(self.mem, .gspq.msgq.data[panic: ..before_len]);
 
         // SAFETY:
@@ -292,12 +296,12 @@ fn gspq_readable_slots(&self) -> u32 {
     /// - `ETIMEDOUT` if space does not become available within the timeout.
     /// - `EIO` if the command header is not properly aligned.
     fn allocate_command(&mut self, size: usize, timeout: Delta) -> Result<GspCommand<'_>> {
-        if size_of::<GspMsgElement>() + size > GSP_MSG_QUEUE_ELEMENT_SIZE_MAX {
+        if size_of::<QueueElementHeader>() + size > GSP_MSG_QUEUE_ELEMENT_SIZE_MAX {
             return Err(EMSGSIZE);
         }
         read_poll_timeout(
             || Ok(self.driver_write_area_size()),
-            |available_bytes| *available_bytes >= size_of::<GspMsgElement>() + size,
+            |available_bytes| *available_bytes >= size_of::<QueueElementHeader>() + size,
             Delta::from_micros(1),
             timeout,
         )?;
@@ -309,8 +313,8 @@ fn allocate_command(&mut self, size: usize, timeout: Delta) -> Result<GspCommand
             (slice_1.as_flattened_mut(), slice_2.as_flattened_mut())
         };
 
-        // Extract area for the `GspMsgElement`.
-        let (header, slice_1) = GspMsgElement::from_bytes_mut_prefix(slice_1).ok_or(EIO)?;
+        // Extract area for the `QueueElementHeader`.
+        let (header, slice_1) = QueueElementHeader::mut_from_prefix(slice_1).map_err(|_| EIO)?;
 
         // Create the contents area.
         let (slice_1, slice_2) = if slice_1.len() > size {
@@ -328,76 +332,73 @@ fn allocate_command(&mut self, size: usize, timeout: Delta) -> Result<GspCommand
         })
     }
 
-    // Returns the index of the memory page the GSP will write the next message to.
-    //
-    // # Invariants
-    //
-    // - The returned value is within `0..MSGQ_NUM_PAGES`.
+    /// Returns the GSP's count of posted messages.
     fn gsp_write_ptr(&self) -> u32 {
-        let ptr = MsgqTxHeader::write_ptr(io_project!(self.mem, .gspq.tx)) % MSGQ_NUM_PAGES;
+        // ORDERING: `readl` ends in a read barrier, which orders this read before the data reads
+        // that follow it.
+        let ptr = u32::from(self.bar.read(regs::NV_PGSP_MSGQ_HEAD::at(0)).val());
 
-        // ORDERING: LOAD->LOAD ordering needed to order `gsp_write_ptr` read before data read.
-        dma_mb(Read);
+        // Ignore out-of-range reads (e.g. a register zeroed while GSP-RM is suspended).
+        if ptr.wrapping_sub(self.cpu_read_ptr) > MSGQ_NUM_PAGES {
+            return self.last_gsp_write_ptr.get();
+        }
 
+        self.last_gsp_write_ptr.set(ptr);
         ptr
     }
 
-    // Returns the index of the memory page the GSP will read the next command from.
-    //
-    // # Invariants
-    //
-    // - The returned value is within `0..MSGQ_NUM_PAGES`.
+    /// Returns the GSP's count of consumed commands.
     fn gsp_read_ptr(&self) -> u32 {
-        let ptr = MsgqRxHeader::read_ptr(io_project!(self.mem, .gspq.rx)) % MSGQ_NUM_PAGES;
+        let ptr = u32::from(self.bar.read(regs::NV_PGSP_QUEUE_TAIL::at(0)).address());
 
-        // ORDERING: LOAD->STORE ordering needed to order `gsp_read_ptr` read before data write.
+        // ORDERING: the data writes that follow must not pass this read. `readl` orders only the
+        // reads that follow it, so the writes need a full barrier.
         dma_mb(Full);
 
+        // Ignore out-of-range reads (e.g. a register zeroed while GSP-RM is suspended). If `last`
+        // made `cpuq` look full when the register reset to 0, GSP-RM has already drained `cpuq`
+        // before suspending, so advance to `cpu_write_ptr` to avoid deadlocking the next send.
+        if self.cpu_write_ptr.wrapping_sub(ptr) > MSGQ_NUM_PAGES {
+            let last = self.last_gsp_read_ptr.get();
+            let ptr = if ptr == 0 && self.cpu_write_ptr.wrapping_sub(last) == MSGQ_NUM_PAGES {
+                self.cpu_write_ptr
+            } else {
+                last
+            };
+            self.last_gsp_read_ptr.set(ptr);
+
+            return ptr;
+        }
+
+        self.last_gsp_read_ptr.set(ptr);
         ptr
     }
 
-    // Returns the index of the memory page the CPU can read the next message from.
-    //
-    // # Invariants
-    //
-    // - The returned value is within `0..MSGQ_NUM_PAGES`.
-    fn cpu_read_ptr(&self) -> u32 {
-        MsgqRxHeader::read_ptr(io_project!(self.mem, .cpuq.rx)) % MSGQ_NUM_PAGES
-    }
-
-    // Informs the GSP that it can send `elem_count` new pages into the message queue.
+    /// Releases `elem_count` more elements of the message queue to the GSP.
     fn advance_cpu_read_ptr(&mut self, elem_count: u32) {
-        // ORDERING: LOAD->STORE ordering needed to order `cpu_read_ptr` write after data read.
+        self.cpu_read_ptr = self.cpu_read_ptr.wrapping_add(elem_count);
+
+        // ORDERING: the data reads must complete before this write releases the slots to the GSP.
+        // `writel` orders only the writes before it, so the reads need a full barrier.
         dma_mb(Full);
 
-        let rx = io_project!(self.mem, .cpuq.rx);
-        let rptr = MsgqRxHeader::read_ptr(rx).wrapping_add(elem_count) % MSGQ_NUM_PAGES;
-        MsgqRxHeader::set_read_ptr(rx, rptr)
-    }
-
-    // Returns the index of the memory page the CPU can write the next command to.
-    //
-    // # Invariants
-    //
-    // - The returned value is within `0..MSGQ_NUM_PAGES`.
-    fn cpu_write_ptr(&self) -> u32 {
-        MsgqTxHeader::write_ptr(io_project!(self.mem, .cpuq.tx)) % MSGQ_NUM_PAGES
-    }
-
-    // Publishes `elem_count` more pages of the command queue to the GSP and rings the doorbell.
-    fn advance_cpu_write_ptr(&mut self, elem_count: u32) {
-        // ORDERING: STORE->STORE ordering needed to order `cpu_write_ptr` write after data write.
-        dma_mb(Write);
-
-        let tx = io_project!(self.mem, .cpuq.tx);
-        let wptr = MsgqTxHeader::write_ptr(tx).wrapping_add(elem_count) % MSGQ_NUM_PAGES;
-        MsgqTxHeader::set_write_ptr(tx, wptr);
-
-        // A write to the head register interrupts the GSP. The pointer itself is in the
-        // shared-memory header, so the value written does not matter.
         self.bar.write(
             Array::at(0),
-            regs::NV_PGSP_QUEUE_HEAD::zeroed().with_address(0u32),
+            regs::NV_PGSP_MSGQ_TAIL::zeroed().with_val(self.cpu_read_ptr),
+        );
+    }
+
+    /// Publishes `elem_count` more elements of the command queue to the GSP.
+    ///
+    /// The write to [`regs::NV_PGSP_QUEUE_HEAD`] that publishes them also interrupts the GSP.
+    fn advance_cpu_write_ptr(&mut self, elem_count: u32) {
+        self.cpu_write_ptr = self.cpu_write_ptr.wrapping_add(elem_count);
+
+        // ORDERING: `writel` begins with a write barrier, which orders the data writes before this
+        // register write.
+        self.bar.write(
+            Array::at(0),
+            regs::NV_PGSP_QUEUE_HEAD::zeroed().with_address(self.cpu_write_ptr),
         );
     }
 }
@@ -406,10 +407,10 @@ fn advance_cpu_write_ptr(&mut self, elem_count: u32) {
 ///
 /// This is the type returned by [`DmaGspMem::allocate_command`].
 struct GspCommand<'a> {
-    // Writable reference to the header of the command.
-    header: &'a mut GspMsgElement,
-    // Writable slices to the contents of the command. The second slice is zero unless the command
-    // loops over the command queue.
+    // Writable reference to the queue element header of the command.
+    header: &'a mut QueueElementHeader,
+    // Writable slices to the contents of the command: the message header and the message. The
+    // second slice is zero unless the command loops over the command queue.
     contents: (&'a mut [u8], &'a mut [u8]),
 }
 
@@ -417,10 +418,11 @@ struct GspCommand<'a> {
 ///
 /// This is the type returned by [`CmdqInner::wait_for_msg`].
 struct GspMessage<'a> {
-    // Reference to the header of the message.
-    header: &'a GspMsgElement,
-    // Slices to the contents of the message. The second slice is empty unless the message loops
-    // over the message queue.
+    // Reference to the queue element header of the message.
+    header: &'a QueueElementHeader,
+    // Slices to the contents of the message: the message header and the message, trimmed to the
+    // length that the queue element header declares. The second slice is empty unless the message
+    // loops over the message queue.
     contents: (&'a [u8], &'a [u8]),
 }
 
@@ -429,10 +431,6 @@ enum GspParsedMessage<'a> {
     /// A [RPC message](rpc::RpcMessage).
     Rpc(rpc::RpcMessage<'a>),
     /// A [GMC message](gmc::GmcMessage).
-    //
-    // The transport header of the r570 firmware carries no message type, so this variant cannot
-    // be constructed before the switch to r000.
-    #[expect(dead_code)]
     Gmc(gmc::GmcMessage<'a>),
 }
 
@@ -474,9 +472,6 @@ impl<'cmdq> Cmdq<'cmdq> {
     /// Total size of a queue, headers included.
     pub(super) const MSGQ_SIZE: usize = size_of::<Msgq>();
 
-    /// Offset of the RX header of a queue from its TX header.
-    pub(super) const MSGQ_RX_HDR_OFFSET: usize = core::mem::offset_of!(Msgq, rx);
-
     /// Offset of the ring buffer of a queue from its TX header.
     pub(super) const MSGQ_ENTRY_OFFSET: usize = core::mem::offset_of!(Msgq, msgq);
 
@@ -520,19 +515,6 @@ fn with_inner_locked<R>(&self, f: impl FnOnce(&mut CmdqInner<'_>) -> R) -> R {
         self.with_inner(|inner| f(&mut inner.lock()))
     }
 
-    /// Computes the checksum for the message pointed to by `it`.
-    ///
-    /// A message is made of several parts, so `it` is an iterator over byte slices representing
-    /// these parts.
-    fn calculate_checksum<T: Iterator<Item = u8>>(it: T) -> u32 {
-        let sum64 = it
-            .enumerate()
-            .map(|(idx, byte)| (((idx % 8) * 8) as u32, byte))
-            .fold(0, |acc, (rol, byte)| acc ^ u64::from(byte).rotate_left(rol));
-
-        ((sum64 >> 32) as u32) ^ (sum64 as u32)
-    }
-
     /// Logs and consumes every message the GSP has already posted, and returns without waiting for
     /// more.
     ///
@@ -542,7 +524,7 @@ fn calculate_checksum<T: Iterator<Item = u8>>(it: T) -> u32 {
     ///
     /// # Errors
     ///
-    /// `EIO` if a message fails framing or checksum validation.
+    /// `EIO` if a message fails framing validation.
     pub(crate) fn drain(&self) -> Result {
         self.with_inner_locked(|inner| inner.drain())
     }
@@ -580,24 +562,16 @@ fn send_command_element<E: CommandElement>(&mut self, command: E) -> Result<u32>
             .gsp_mem
             .allocate_command(size_in_bytes, Self::ALLOCATE_TIMEOUT)?;
 
-        // Fill the header.
-        let msg_element_init = GspMsgElement::init(seq, size_in_bytes);
+        // Fill the queue element header.
+        let header_init = QueueElementHeader::init(E::NVDM_TYPE, size_in_bytes);
         // SAFETY: `dst.header` is a valid reference, and is not touched if the initializer fails.
         unsafe {
-            pin_init::raw_try_init(core::ptr::from_mut(dst.header), msg_element_init)?;
+            pin_init::raw_try_init(core::ptr::from_mut(dst.header), header_init)?;
         }
 
-        // Write the message payload.
+        // Write the message header and payload.
         command.write(self.dev, seq, &mut dst)?;
 
-        // Compute checksum now that the whole message is ready.
-        dst.header
-            .set_checksum(Cmdq::calculate_checksum(SBufferIter::new_reader([
-                dst.header.as_bytes(),
-                dst.contents.0,
-                dst.contents.1,
-            ])));
-
         // All set - update the write pointer and inform the GSP of the new command.
         let elem_count = dst.header.element_count();
         self.seq = self.seq.wrapping_add(1);
@@ -608,19 +582,20 @@ fn send_command_element<E: CommandElement>(&mut self, command: E) -> Result<u32>
 
     /// Wait for a message to become available on the message queue.
     ///
-    /// This works purely at the transport layer and does not interpret or validate the message
-    /// beyond the advertised length in its [`GspMsgElement`].
+    /// This works purely at the transport layer: it validates the [`QueueElementHeader`] of the
+    /// message and trims the contents to the length that it declares, and does not interpret the
+    /// message header that follows.
     ///
     /// This method returns:
     ///
-    /// - A reference to the [`GspMsgElement`] of the message,
+    /// - A reference to the [`QueueElementHeader`] of the message,
     /// - Two byte slices with the contents of the message. The second slice is empty unless the
     ///   message loops across the message queue.
     ///
     /// # Errors
     ///
     /// - `ETIMEDOUT` if `timeout` has elapsed before any message becomes available.
-    /// - `EIO` if a message fails framing or checksum validation.
+    /// - `EIO` if a message fails framing validation.
     fn wait_for_msg(&self, timeout: Delta) -> Result<GspMessage<'_>> {
         // Wait for a message to arrive from the GSP.
         let (slice_1, slice_2) = if timeout == Delta::ZERO {
@@ -643,23 +618,23 @@ fn wait_for_msg(&self, timeout: Delta) -> Result<GspMessage<'_>> {
         }
         .map(|(slice_1, slice_2)| (slice_1.as_flattened(), slice_2.as_flattened()))?;
 
-        // Extract the `GspMsgElement`.
-        let (header, slice_1) = GspMsgElement::from_bytes_prefix(slice_1).ok_or(EIO)?;
+        // Extract the `QueueElementHeader`.
+        let (header, slice_1) = QueueElementHeader::ref_from_prefix(slice_1).map_err(|_| EIO)?;
 
-        // Validate checksum after truncating the message to its exact length.
-        if Cmdq::calculate_checksum(
-            SBufferIter::new_reader([header.as_bytes(), slice_1, slice_2])
-                .take(header.msg_length()),
-        ) != 0
-        {
-            dev_err!(&self.dev, "GSP receive: bad checksum\n");
-            return Err(EIO);
-        }
+        header.validate().inspect_err(|_| {
+            dev_err!(&self.dev, "GSP receive: bad queue element header\n");
+        })?;
 
-        Ok(GspMessage {
-            header,
-            contents: (slice_1, slice_2),
-        })
+        // Cut the message slices down to the length that the queue element header declares.
+        let contents =
+            trim_message_slice((slice_1, slice_2), header.message_len()).inspect_err(|_| {
+                dev_err!(
+                    &self.dev,
+                    "GSP receive: read area shorter than the message\n"
+                );
+            })?;
+
+        Ok(GspMessage { header, contents })
     }
 
     /// Wait for the next element on the message queue, pass it to `f`, advance the read pointer
@@ -670,8 +645,9 @@ fn wait_for_msg(&self, timeout: Delta) -> Result<GspMessage<'_>> {
     /// # Errors
     ///
     /// - `ETIMEDOUT` if `timeout` has elapsed before any message becomes available.
-    /// - `EIO` if a message fails framing or checksum validation. In this case, the read pointer
-    ///   does not advance and the queue is stalled. This is a fatal error.
+    /// - `EIO` if a message fails framing validation, or carries an NVDM type that the queue does
+    ///   not use. In this case, the read pointer does not advance and the queue is stalled. This
+    ///   is a fatal error.
     ///
     /// If an error is returned, then `f` has not been called.
     ///
@@ -683,14 +659,25 @@ fn consume_element<R>(
         f: impl FnOnce(GspParsedMessage<'_>) -> R,
     ) -> Result<R> {
         let message = self.wait_for_msg(timeout)?;
-        let elem_count = u32::try_from(message.header.msg_length().div_ceil(GSP_PAGE_SIZE))
-            .map_err(|_| {
-                dev_err!(&self.dev, "GSP receive: message length overflow\n");
-                EIO
-            })?;
+        let elem_count = message.header.element_count();
 
-        // RPC is the only type of message supported for now.
-        let message = GspParsedMessage::Rpc(rpc::RpcMessage::parse(self.dev, message)?);
+        // The NVDM type of the queue element header selects the message header that follows.
+        let message = match message.header.nvdm_type() {
+            Ok(NvdmType::RmRpc) => {
+                GspParsedMessage::Rpc(rpc::RpcMessage::parse(self.dev, message)?)
+            }
+            Ok(NvdmType::GmcApi) => {
+                GspParsedMessage::Gmc(gmc::GmcMessage::parse(self.dev, message)?)
+            }
+            nvdm_type => {
+                dev_err!(
+                    &self.dev,
+                    "GSP receive: unexpected NVDM type {:?}\n",
+                    nvdm_type
+                );
+                return Err(EIO);
+            }
+        };
 
         let res = f(message);
 
@@ -713,7 +700,7 @@ fn consume_element<R>(
     ///
     /// - `ETIMEDOUT` if no message satisfying `f` arrives before the deadline, however many other
     ///   messages arrive while waiting.
-    /// - `EIO` if a message fails framing or checksum validation.
+    /// - `EIO` if a message fails framing validation.
     /// - Any error returned by `f`.
     fn await_msg_with<R>(
         &mut self,
@@ -736,8 +723,7 @@ fn await_msg_with<R>(
     ///
     /// # Errors
     ///
-    /// `EIO` if a message fails framing or checksum validation, or if a message's page count
-    /// overflows a `u32`.
+    /// `EIO` if a message fails framing validation.
     fn drain(&mut self) -> Result {
         loop {
             match self.consume_element(Delta::ZERO, |message| message.log(self.dev)) {
diff --git a/drivers/gpu/nova-core/gsp/cmdq/gmc.rs b/drivers/gpu/nova-core/gsp/cmdq/gmc.rs
index 8de8e93ddd7f..0ddd319e15b7 100644
--- a/drivers/gpu/nova-core/gsp/cmdq/gmc.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq/gmc.rs
@@ -29,11 +29,12 @@
         fw::{
             GmcApiHeader,
             GmcCommandId,
-            GspMsgElement, //
+            QueueElementHeader, //
         },
         GSP_PAGE_SIZE,
     },
-    sbuffer::SBufferIter,
+    mctp::NvdmType,
+    sbuffer::SBufferIter, //
 };
 
 /// Trait implemented by types representing a GMC command to send to the GSP.
@@ -115,6 +116,8 @@ impl<C> CommandElement for GmcCommandElement<C>
     C: CommandToGsp,
     Error: From<C::InitError>,
 {
+    const NVDM_TYPE: NvdmType = NvdmType::GmcApi;
+
     fn size(&self) -> usize {
         size_of::<GmcApiHeader>() + self.0.size()
     }
@@ -123,14 +126,14 @@ fn write(&self, dev: &device::Device, seq: u32, dst: &mut GspCommand<'_>) -> Res
         // Ensure that the command and its headers are not larger than one page, which is part of
         // the GMC API contract.
         const_assert!(
-            size_of::<GspMsgElement>() + size_of::<GmcApiHeader>() + size_of::<C::Command>()
+            size_of::<QueueElementHeader>() + size_of::<GmcApiHeader>() + size_of::<C::Command>()
                 <= GSP_PAGE_SIZE
         );
 
         let command = &self.0;
         let payload_size = command.size();
         // Extract the areas for the GMC API header and the command itself. Per the `const_assert!`
-        // above, the GSP message header, the GMC API header and the command header together are
+        // above, the queue element header, the GMC API header and the command header together are
         // guaranteed to fit entirely into a single page, so it's ok to only look at
         // `dst.contents.0` here.
         let (header, contents) = GmcApiHeader::from_bytes_mut_prefix(dst.contents.0).ok_or(EIO)?;
@@ -209,14 +212,16 @@ impl<'a> GmcMessage<'a> {
     /// - `EIO` if the element is shorter than the GMC API header, or than the payload length
     ///   advertised by the GMC API header.
     pub(super) fn parse(dev: &device::Device, element: GspMessage<'a>) -> Result<GmcMessage<'a>> {
-        static_assert!(size_of::<GspMsgElement>() + size_of::<GmcApiHeader>() <= GSP_PAGE_SIZE);
+        static_assert!(
+            size_of::<QueueElementHeader>() + size_of::<GmcApiHeader>() <= GSP_PAGE_SIZE
+        );
 
         let GspMessage {
             contents: (slice_1, slice_2),
             ..
         } = element;
 
-        // Per the `static_assert!` above, the GSP message header and the GMC API header together
+        // Per the `static_assert!` above, the queue element header and the GMC API header together
         // are guaranteed to fit entirely into a single page, so it's ok to only look at `slice_1`
         // here.
         let (gmc_header, slice_1) = GmcApiHeader::from_bytes_prefix(slice_1).ok_or(EIO)?;
@@ -304,7 +309,7 @@ impl Cmdq<'_> {
     ///   arrive while waiting.
     /// - `EIO` if the variable payload requested by the command has not been entirely
     ///   written to by its [`CommandToGsp::init_variable_payload`] method, or if a message fails
-    ///   framing or checksum validation.
+    ///   framing validation.
     ///
     /// Error codes returned by the command and reply initializers, and by `on_event`, are
     /// propagated as-is.
@@ -379,7 +384,7 @@ fn send_gmc_command<C>(&mut self, command: C) -> Result<u32>
     ///
     /// - `ETIMEDOUT` if the reply does not arrive before the deadline, however many other messages
     ///   arrive while waiting.
-    /// - `EIO` if a message fails framing or checksum validation.
+    /// - `EIO` if a message fails framing validation.
     ///
     /// Error codes returned by [`MessageFromGsp::read`] and by `on_event` are propagated as-is.
     fn await_gmc_reply<C: CommandToGsp>(
diff --git a/drivers/gpu/nova-core/gsp/cmdq/rpc.rs b/drivers/gpu/nova-core/gsp/cmdq/rpc.rs
index 9ce3be7c4c03..ffe8b950c1d9 100644
--- a/drivers/gpu/nova-core/gsp/cmdq/rpc.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq/rpc.rs
@@ -27,7 +27,8 @@
             RpcMessageHeader, //
         },
     },
-    sbuffer::SBufferIter,
+    mctp::NvdmType,
+    sbuffer::SBufferIter, //
 };
 
 use super::{
@@ -93,8 +94,8 @@ fn init_variable_payload(
         Ok(())
     }
 
-    /// Total size of the command (including its variable-length payload) without the
-    /// [`GspMsgElement`] header.
+    /// Total size of the command (including its variable-length payload) without the queue element
+    /// and RPC headers.
     fn size(&self) -> usize {
         size_of::<Self::Command>() + self.variable_payload_len()
     }
@@ -111,25 +112,25 @@ impl<M> CommandElement for RpcCommandElement<M>
     M: CommandToGsp,
     Error: From<M::InitError>,
 {
+    const NVDM_TYPE: NvdmType = NvdmType::RmRpc;
+
     fn size(&self) -> usize {
-        self.0.size()
+        size_of::<RpcMessageHeader>() + self.0.size()
     }
 
     fn write(&self, dev: &device::Device, seq: u32, dst: &mut GspCommand<'_>) -> Result {
         let command = &self.0;
         let size_in_bytes = command.size();
-        // Extract area for the command itself. The GSP message header and the command header
-        // together are guaranteed to fit entirely into a single page, so it's ok to only look
-        // at `dst.contents.0` here.
-        let (cmd, payload_1) = M::Command::from_bytes_mut_prefix(dst.contents.0).ok_or(EIO)?;
+        // Extract the areas for the RPC header and the command itself. The queue element header,
+        // the RPC header and the command header together are guaranteed to fit entirely into a
+        // single page, so it's ok to only look at `dst.contents.0` here.
+        let (rpc_header, contents) =
+            RpcMessageHeader::from_bytes_mut_prefix(dst.contents.0).ok_or(EIO)?;
+        let (cmd, payload_1) = M::Command::from_bytes_mut_prefix(contents).ok_or(EIO)?;
         let rpc_header_init = RpcMessageHeader::init(size_in_bytes, M::FUNCTION);
-        // SAFETY: `dst.header.rpc_header_mut()` is a valid reference, and is not touched if the
-        // initializer fails.
+        // SAFETY: `rpc_header` is a valid reference, and is not touched if the initializer fails.
         unsafe {
-            pin_init::raw_try_init(
-                core::ptr::from_mut(dst.header.rpc_header_mut()),
-                rpc_header_init,
-            )?;
+            pin_init::raw_try_init(core::ptr::from_mut(rpc_header), rpc_header_init)?;
         }
         // SAFETY: `cmd` is a valid reference, and is not touched if the initializer fails.
         unsafe {
@@ -196,14 +197,17 @@ impl<'a> RpcMessage<'a> {
     ///
     /// # Errors
     ///
-    /// - `EIO` if the element is shorter than the payload length advertised by the RPC header.
+    /// - `EIO` if the element is shorter than the RPC header, or than the payload length
+    ///   advertised by the RPC header.
     pub(super) fn parse(dev: &device::Device, element: GspMessage<'a>) -> Result<RpcMessage<'a>> {
         let GspMessage {
-            header,
             contents: (slice_1, slice_2),
+            ..
         } = element;
 
-        let rpc_header = header.rpc_header();
+        // The queue element header and the RPC header together are guaranteed to fit entirely
+        // into a single page, so it's ok to only look at `slice_1` here.
+        let (rpc_header, slice_1) = RpcMessageHeader::from_bytes_prefix(slice_1).ok_or(EIO)?;
         let payload_length = rpc_header.rpc_length();
 
         dev_dbg!(
@@ -307,7 +311,7 @@ pub(crate) fn send_rpc_command_no_wait<M>(&self, command: M) -> Result
     ///
     /// - `ETIMEDOUT` if the event does not arrive within [`Self::RECEIVE_TIMEOUT`] of the call,
     ///   however many other events arrive while waiting.
-    /// - `EIO` if a message fails framing or checksum validation.
+    /// - `EIO` if a message fails framing validation.
     ///
     /// Error codes returned by [`MessageFromGsp::read`] are propagated as-is.
     pub(crate) fn await_rpc_msg<M: MessageFromGsp>(&self) -> Result<M>
@@ -361,7 +365,7 @@ fn send_rpc_command<M>(&mut self, command: M) -> Result
     ///
     /// - `ETIMEDOUT` if no message of type `M` arrives before the deadline, however many other
     ///   messages arrive while waiting.
-    /// - `EIO` if a message fails framing or checksum validation.
+    /// - `EIO` if a message fails framing validation.
     ///
     /// Error codes returned by [`MessageFromGsp::read`] are propagated as-is.
     fn await_rpc_msg<M: MessageFromGsp>(&mut self) -> Result<M>
diff --git a/drivers/gpu/nova-core/gsp/cmdq/rpc/continuation.rs b/drivers/gpu/nova-core/gsp/cmdq/rpc/continuation.rs
index 9ef19f28de97..c4e169429969 100644
--- a/drivers/gpu/nova-core/gsp/cmdq/rpc/continuation.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq/rpc/continuation.rs
@@ -13,15 +13,19 @@
 
 use crate::{
     gsp::fw::{
-        GspMsgElement,
         MsgFunction,
+        QueueElementHeader,
+        RpcMessageHeader,
         GSP_MSG_QUEUE_ELEMENT_SIZE_MAX, //
     },
     sbuffer::SBufferIter,
 };
 
-/// Maximum command size that fits in a single queue element.
-const MAX_CMD_SIZE: usize = GSP_MSG_QUEUE_ELEMENT_SIZE_MAX - size_of::<GspMsgElement>();
+/// Maximum command size that fits in a single queue element, after the queue element header and
+/// the RPC header.
+const MAX_CMD_SIZE: usize = GSP_MSG_QUEUE_ELEMENT_SIZE_MAX
+    - size_of::<QueueElementHeader>()
+    - size_of::<RpcMessageHeader>();
 
 /// Acts as an iterator over the continuation records for a split command.
 pub(super) struct ContinuationRecords {
diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index 4ffcb4133e02..df920e3d8322 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -1,9 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
-// The r570 firmware does not use GMC.
-#[expect(dead_code)]
 pub(crate) mod gmc;
+#[expect(dead_code)]
 pub(crate) mod rpc;
 
 use core::{
@@ -16,8 +15,7 @@
 
 pub(crate) use crate::gsp::fw::commands::PowerStateLevel;
 
-/// The static GPU configuration, which GSP-RM reports in reply to
-/// [`GetGspStaticInfo`](rpc::GetGspStaticInfo).
+/// The static GPU configuration, which GSP-RM reports in reply to [`GspInit`](gmc::GspInit).
 pub struct GspStaticInfo {
     gpu_name: [u8; Self::MAX_GPU_NAME_LEN],
     gpu_short_name: [u8; Self::MAX_GPU_NAME_LEN],
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 74e642e11afc..c51f0c6913df 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -6,20 +6,14 @@
 mod r570_144;
 
 // Alias to avoid repeating the version number with every use.
-use r570_144 as bindings;
+use r000_00 as bindings;
 
 use core::ops::Range;
 
 use kernel::{
     bitfield,
-    dma::{
-        Coherent,
-        CoherentView, //
-    },
-    io::{
-        io_read,
-        io_write, //
-    },
+    dma::Coherent,
+    io::io_write,
     prelude::*,
     ptr::{
         Alignable,
@@ -44,7 +38,10 @@
         FbRanges,
         FbSizes, //
     },
-    firmware::gsp::GspFirmware,
+    firmware::{
+        gsp::GspFirmware,
+        ucodes::UcodesImage, //
+    },
     gpu::{
         Architecture,
         Chipset, //
@@ -54,7 +51,8 @@
             Cmdq,
             MSGQ_NUM_PAGES, //
         },
-        GSP_PAGE_SIZE,
+        GSP_PAGE_SHIFT,
+        GSP_PAGE_SIZE, //
     },
     mctp::{
         MctpHeader,
@@ -104,7 +102,7 @@ fn client_alloc_size() -> u64 {
     fn management_overhead(fb_size: u64) -> Result<u64> {
         let fb_size_gb = fb_size.div_ceil(u64::SZ_1G);
 
-        u64::from(bindings::GSP_FW_HEAP_PARAM_SIZE_PER_GB_FB)
+        u64::from(bindings::GSP_FW_HEAP_PARAM_SIZE_PER_GB)
             .checked_mul(fb_size_gb)
             .ok_or(EINVAL)?
             .align_up(GSP_HEAP_ALIGNMENT)
@@ -306,7 +304,7 @@ pub(crate) enum MsgFunction {
     GspInitDone = bindings::NV_VGPU_MSG_EVENT_GSP_INIT_DONE,
     GspLockdownNotice = bindings::NV_VGPU_MSG_EVENT_GSP_LOCKDOWN_NOTICE,
     GspPostNoCat = bindings::NV_VGPU_MSG_EVENT_GSP_POST_NOCAT_RECORD,
-    GspRunCpuSequencer = bindings::NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER,
+    GspRunCpuSequencer = r570_144::NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER,
     MmuFaultQueued = bindings::NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED,
     OsErrorLog = bindings::NV_VGPU_MSG_EVENT_OS_ERROR_LOG,
     PostEvent = bindings::NV_VGPU_MSG_EVENT_POST_EVENT,
@@ -353,7 +351,7 @@ fn try_from(value: u32) -> Result<MsgFunction> {
             bindings::NV_VGPU_MSG_EVENT_GSP_INIT_DONE => Ok(MsgFunction::GspInitDone),
             bindings::NV_VGPU_MSG_EVENT_GSP_LOCKDOWN_NOTICE => Ok(MsgFunction::GspLockdownNotice),
             bindings::NV_VGPU_MSG_EVENT_GSP_POST_NOCAT_RECORD => Ok(MsgFunction::GspPostNoCat),
-            bindings::NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER => {
+            r570_144::NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER => {
                 Ok(MsgFunction::GspRunCpuSequencer)
             }
             bindings::NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED => Ok(MsgFunction::MmuFaultQueued),
@@ -378,19 +376,19 @@ fn from(value: MsgFunction) -> Self {
 #[repr(u32)]
 pub(crate) enum SeqBufOpcode {
     // Core operation opcodes
-    CoreReset = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET,
-    CoreResume = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME,
-    CoreStart = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START,
-    CoreWaitForHalt = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT,
+    CoreReset = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET,
+    CoreResume = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME,
+    CoreStart = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START,
+    CoreWaitForHalt = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT,
 
     // Delay opcode
-    DelayUs = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US,
+    DelayUs = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US,
 
     // Register operation opcodes
-    RegModify = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY,
-    RegPoll = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL,
-    RegStore = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE,
-    RegWrite = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE,
+    RegModify = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY,
+    RegPoll = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL,
+    RegStore = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE,
+    RegWrite = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE,
 }
 
 impl TryFrom<u32> for SeqBufOpcode {
@@ -398,25 +396,25 @@ impl TryFrom<u32> for SeqBufOpcode {
 
     fn try_from(value: u32) -> Result<SeqBufOpcode> {
         match value {
-            bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET => {
+            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET => {
                 Ok(SeqBufOpcode::CoreReset)
             }
-            bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME => {
+            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME => {
                 Ok(SeqBufOpcode::CoreResume)
             }
-            bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START => {
+            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START => {
                 Ok(SeqBufOpcode::CoreStart)
             }
-            bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT => {
+            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT => {
                 Ok(SeqBufOpcode::CoreWaitForHalt)
             }
-            bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US => Ok(SeqBufOpcode::DelayUs),
-            bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY => {
+            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US => Ok(SeqBufOpcode::DelayUs),
+            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY => {
                 Ok(SeqBufOpcode::RegModify)
             }
-            bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL => Ok(SeqBufOpcode::RegPoll),
-            bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE => Ok(SeqBufOpcode::RegStore),
-            bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE => Ok(SeqBufOpcode::RegWrite),
+            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL => Ok(SeqBufOpcode::RegPoll),
+            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE => Ok(SeqBufOpcode::RegStore),
+            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE => Ok(SeqBufOpcode::RegWrite),
             _ => Err(EINVAL),
         }
     }
@@ -432,7 +430,7 @@ fn from(value: SeqBufOpcode) -> Self {
 /// Wrapper for GSP sequencer register write payload.
 #[repr(transparent)]
 #[derive(Copy, Clone, Debug)]
-pub(crate) struct RegWritePayload(bindings::GSP_SEQ_BUF_PAYLOAD_REG_WRITE);
+pub(crate) struct RegWritePayload(r570_144::GSP_SEQ_BUF_PAYLOAD_REG_WRITE);
 
 impl RegWritePayload {
     /// Returns the register address.
@@ -455,7 +453,7 @@ unsafe impl AsBytes for RegWritePayload {}
 /// Wrapper for GSP sequencer register modify payload.
 #[repr(transparent)]
 #[derive(Copy, Clone, Debug)]
-pub(crate) struct RegModifyPayload(bindings::GSP_SEQ_BUF_PAYLOAD_REG_MODIFY);
+pub(crate) struct RegModifyPayload(r570_144::GSP_SEQ_BUF_PAYLOAD_REG_MODIFY);
 
 impl RegModifyPayload {
     /// Returns the register address.
@@ -483,7 +481,7 @@ unsafe impl AsBytes for RegModifyPayload {}
 /// Wrapper for GSP sequencer register poll payload.
 #[repr(transparent)]
 #[derive(Copy, Clone, Debug)]
-pub(crate) struct RegPollPayload(bindings::GSP_SEQ_BUF_PAYLOAD_REG_POLL);
+pub(crate) struct RegPollPayload(r570_144::GSP_SEQ_BUF_PAYLOAD_REG_POLL);
 
 impl RegPollPayload {
     /// Returns the register address.
@@ -516,7 +514,7 @@ unsafe impl AsBytes for RegPollPayload {}
 /// Wrapper for GSP sequencer delay payload.
 #[repr(transparent)]
 #[derive(Copy, Clone, Debug)]
-pub(crate) struct DelayUsPayload(bindings::GSP_SEQ_BUF_PAYLOAD_DELAY_US);
+pub(crate) struct DelayUsPayload(r570_144::GSP_SEQ_BUF_PAYLOAD_DELAY_US);
 
 impl DelayUsPayload {
     /// Returns the delay value in microseconds.
@@ -534,7 +532,7 @@ unsafe impl AsBytes for DelayUsPayload {}
 /// Wrapper for GSP sequencer register store payload.
 #[repr(transparent)]
 #[derive(Copy, Clone, Debug)]
-pub(crate) struct RegStorePayload(bindings::GSP_SEQ_BUF_PAYLOAD_REG_STORE);
+pub(crate) struct RegStorePayload(r570_144::GSP_SEQ_BUF_PAYLOAD_REG_STORE);
 
 impl RegStorePayload {
     /// Returns the register address.
@@ -557,7 +555,7 @@ unsafe impl AsBytes for RegStorePayload {}
 
 /// Wrapper for GSP sequencer buffer command.
 #[repr(transparent)]
-pub(crate) struct SequencerBufferCmd(bindings::GSP_SEQUENCER_BUFFER_CMD);
+pub(crate) struct SequencerBufferCmd(r570_144::GSP_SEQUENCER_BUFFER_CMD);
 
 impl SequencerBufferCmd {
     /// Returns the opcode as a `SeqBufOpcode` enum, or error if invalid.
@@ -629,7 +627,7 @@ unsafe impl AsBytes for SequencerBufferCmd {}
 
 /// Wrapper for GSP run CPU sequencer RPC.
 #[repr(transparent)]
-pub(crate) struct RunCpuSequencer(bindings::rpc_run_cpu_sequencer_v17_00);
+pub(crate) struct RunCpuSequencer(r570_144::rpc_run_cpu_sequencer_v17_00);
 
 impl RunCpuSequencer {
     /// Returns the command index.
@@ -701,7 +699,14 @@ fn id8(name: &str) -> u64 {
     }
 }
 
-/// TX header for setting up a message queue with the GSP.
+/// Major msgq version that the driver uses.
+const MSGQ_VERSION_MAJOR: u16 = 2;
+/// Minor msgq version that the driver uses.
+const MSGQ_VERSION_MINOR: u16 = 0;
+
+/// The msgq TX header, which describes a queue to the GSP: the msgq version that the driver uses,
+/// and the queue's geometry. The queue pointers are in BAR0 registers rather than in the msgq TX
+/// header.
 #[repr(transparent)]
 pub(crate) struct MsgqTxHeader(bindings::msgqTxHeader);
 
@@ -709,56 +714,20 @@ impl MsgqTxHeader {
     /// Create a new TX queue header, describing the queue layout defined by [`Cmdq`].
     pub(crate) fn new() -> Self {
         Self(bindings::msgqTxHeader {
-            version: 0,
+            versionMajor: MSGQ_VERSION_MAJOR,
+            versionMinor: MSGQ_VERSION_MINOR,
             size: cv!(Cmdq::MSGQ_SIZE),
             msgSize: cv!(Cmdq::MSG_SIZE),
             msgCount: MSGQ_NUM_PAGES,
-            writePtr: 0,
-            flags: 1,
-            rxHdrOff: cv!(Cmdq::MSGQ_RX_HDR_OFFSET),
             entryOff: cv!(Cmdq::MSGQ_ENTRY_OFFSET),
+            reserved: [0; 3],
         })
     }
-
-    /// Returns the value of the write pointer for this queue.
-    pub(crate) fn write_ptr(this: CoherentView<'_, Self>) -> u32 {
-        io_read!(this, .0.writePtr)
-    }
-
-    /// Sets the value of the write pointer for this queue.
-    pub(crate) fn set_write_ptr(this: CoherentView<'_, Self>, val: u32) {
-        io_write!(this, .0.writePtr, val)
-    }
 }
 
 // SAFETY: Padding is explicit and does not contain uninitialized data.
 unsafe impl AsBytes for MsgqTxHeader {}
 
-/// RX header for setting up a message queue with the GSP.
-#[repr(transparent)]
-pub(crate) struct MsgqRxHeader(bindings::msgqRxHeader);
-
-/// Header for the message RX queue.
-impl MsgqRxHeader {
-    /// Creates a new RX queue header.
-    pub(crate) fn new() -> Self {
-        Self(Default::default())
-    }
-
-    /// Returns the value of the read pointer for this queue.
-    pub(crate) fn read_ptr(this: CoherentView<'_, Self>) -> u32 {
-        io_read!(this, .0.readPtr)
-    }
-
-    /// Sets the value of the read pointer for this queue.
-    pub(crate) fn set_read_ptr(this: CoherentView<'_, Self>, val: u32) {
-        io_write!(this, .0.readPtr, val)
-    }
-}
-
-// SAFETY: Padding is explicit and does not contain uninitialized data.
-unsafe impl AsBytes for MsgqRxHeader {}
-
 bitfield! {
     struct MsgHeaderVersion(u32) {
         31:24 major;
@@ -777,86 +746,9 @@ fn new() -> Self {
     }
 }
 
-/// GSP Message Element.
-///
-/// This is essentially a message header expected to be followed by the message data.
-#[repr(transparent)]
-pub(crate) struct GspMsgElement {
-    inner: bindings::GSP_MSG_QUEUE_ELEMENT,
-}
-
-impl GspMsgElement {
-    /// Creates a new message element.
-    ///
-    /// The RPC header is left initialized to zero and must be initialized separately using e.g.
-    /// [`Self::rpc_header_mut`].
-    ///
-    /// # Arguments
-    ///
-    /// * `sequence` - Sequence number of the message.
-    /// * `cmd_size` - Size of the command (not including the message element), in bytes.
-    pub(crate) fn init(sequence: u32, cmd_size: usize) -> impl Init<Self, Error> {
-        type InnerGspMsgElement = bindings::GSP_MSG_QUEUE_ELEMENT;
-        let init_inner = try_init!(InnerGspMsgElement {
-            seqNum: sequence,
-            elemCount: size_of::<Self>()
-                .checked_add(cmd_size)
-                .ok_or(EOVERFLOW)?
-                .div_ceil(GSP_PAGE_SIZE)
-                .try_into()
-                .map_err(|_| EOVERFLOW)?,
-            ..Zeroable::init_zeroed()
-        });
-
-        try_init!(GspMsgElement {
-            inner <- init_inner,
-        })
-    }
-
-    /// Sets the checksum of this message.
-    ///
-    /// Since the header is also part of the checksum, this is usually called after the whole
-    /// message has been written to the shared memory area.
-    pub(crate) fn set_checksum(&mut self, checksum: u32) {
-        self.inner.checkSum = checksum;
-    }
-
-    /// Returns a reference to the RPC header within the message element.
-    pub(crate) fn rpc_header(&self) -> &RpcMessageHeader {
-        // SAFETY: `RpcMessageHeader` is a transparent wrapper for the type of `inner.rpc`.
-        unsafe { core::mem::transmute(&self.inner.rpc) }
-    }
-
-    /// Returns a mutable reference to the RPC header within the message element.
-    pub(crate) fn rpc_header_mut(&mut self) -> &mut RpcMessageHeader {
-        // SAFETY: `RpcMessageHeader` is a transparent wrapper for the type of `inner.rpc`.
-        unsafe { core::mem::transmute(&mut self.inner.rpc) }
-    }
-
-    /// Returns the total length of the message, message and RPC headers included.
-    pub(crate) fn msg_length(&self) -> usize {
-        // Note: this is transport-layer code accessing message-layer data, which is only ok here
-        // because RPC is the only kind of message we handle, and its header can (with a stretch) be
-        // considered part of the transport header.
-        size_of::<Self>() + self.rpc_header().rpc_length()
-    }
-
-    /// Returns the number of slots (i.e. memory pages) used by this message.
-    pub(crate) fn element_count(&self) -> u32 {
-        self.inner.elemCount
-    }
-}
-
-// SAFETY: Padding is explicit and does not contain uninitialized data.
-unsafe impl AsBytes for GspMsgElement {}
-
-// SAFETY: This struct only contains integer types for which all bit patterns
-// are valid.
-unsafe impl FromBytes for GspMsgElement {}
-
 /// RPC Message Header.
 ///
-/// The header of a RPC message, wrapped inside a [`GspMsgElement`].
+/// The header of a RPC message, which follows the [`QueueElementHeader`] in an RPC message.
 #[repr(transparent)]
 pub(crate) struct RpcMessageHeader {
     inner: bindings::rpc_message_header_v,
@@ -907,6 +799,13 @@ pub(crate) fn function(&self) -> Result<MsgFunction, u32> {
     }
 }
 
+// SAFETY: This struct only contains integer types, including inside its union, and a zero-sized
+// array. It has no padding.
+unsafe impl AsBytes for RpcMessageHeader {}
+
+// SAFETY: This struct only contains integer types for which all bit patterns are valid.
+unsafe impl FromBytes for RpcMessageHeader {}
+
 /// Header opening every element of the r000 GSP queues.
 ///
 /// A queue element is laid out as follows:
@@ -956,30 +855,30 @@ pub(crate) struct QueueElementHeader {
 
     assert!(
         offset_of!(QueueElementHeader, mctp_magic)
-            == offset_of!(r000_00::GSP_MSG_QUEUE_ELEMENT, mctpMagic)
+            == offset_of!(bindings::GSP_MSG_QUEUE_ELEMENT, mctpMagic)
     );
     assert!(
         offset_of!(QueueElementHeader, mctp_payload_size)
-            == offset_of!(r000_00::GSP_MSG_QUEUE_ELEMENT, mctpPayloadSize)
+            == offset_of!(bindings::GSP_MSG_QUEUE_ELEMENT, mctpPayloadSize)
     );
     assert!(
         offset_of!(QueueElementHeader, mctp_header)
-            == offset_of!(r000_00::GSP_MSG_QUEUE_ELEMENT, mctpHeader)
+            == offset_of!(bindings::GSP_MSG_QUEUE_ELEMENT, mctpHeader)
     );
     assert!(
         offset_of!(QueueElementHeader, nvdm_header)
-            == offset_of!(r000_00::GSP_MSG_QUEUE_ELEMENT, nvdmHeader)
+            == offset_of!(bindings::GSP_MSG_QUEUE_ELEMENT, nvdmHeader)
     );
 
     /// The `noEncryption` member of the union of `GSP_MSG_QUEUE_ELEMENT`, which holds the two
     /// trailing fields of [`QueueElementHeader`].
-    type QueueElementNoEncryption = r000_00::GSP_MSG_QUEUE_ELEMENT__bindgen_ty_1__bindgen_ty_2;
+    type QueueElementNoEncryption = bindings::GSP_MSG_QUEUE_ELEMENT__bindgen_ty_1__bindgen_ty_2;
 
     // Offsets of fields under [`QueueElementNoEncryption`] within `GSP_MSG_QUEUE_ELEMENT`.
 
     const QUEUE_ELEMENT_NO_ENCRYPTION_OFFSET: usize =
-        offset_of!(r000_00::GSP_MSG_QUEUE_ELEMENT, __bindgen_anon_1)
-            + offset_of!(r000_00::GSP_MSG_QUEUE_ELEMENT__bindgen_ty_1, noEncryption);
+        offset_of!(bindings::GSP_MSG_QUEUE_ELEMENT, __bindgen_anon_1)
+            + offset_of!(bindings::GSP_MSG_QUEUE_ELEMENT__bindgen_ty_1, noEncryption);
 
     assert!(
         offset_of!(QueueElementHeader, nvdm_payload_size)
@@ -999,7 +898,6 @@ pub(crate) struct QueueElementHeader {
     );
 };
 
-#[expect(dead_code)]
 impl QueueElementHeader {
     /// First word of every r000 queue element: `"MCTP"` in ASCII.
     const MCTP_MAGIC: u32 = 0x4D43_5450;
@@ -1077,11 +975,11 @@ pub(crate) fn validate(&self) -> Result {
     #[derive(Debug, Clone, Copy, PartialEq, Eq)]
     #[repr(u32)]
     pub(crate) enum GmcCommandId with TryFrom<Bounded<u32, 24>> {
-        GspInit = r000_00::GMCAPI_COMMANDS_GMCAPI_CMD_GSP_INIT,
-        ExecGenericBootloader = r000_00::GMCAPI_COMMANDS_GMCAPI_CMD_EXEC_GENERIC_BOOTLOADER,
-        ExecHsBinary = r000_00::GMCAPI_COMMANDS_GMCAPI_CMD_EXEC_HS_BINARY,
-        GspSuspend = r000_00::GMCAPI_COMMANDS_GMCAPI_CMD_GSP_SUSPEND,
-        MmuFaultQueued = r000_00::GMCAPI_COMMANDS_GMCAPI_CMD_MMU_FAULT_QUEUED,
+        GspInit = bindings::GMCAPI_COMMANDS_GMCAPI_CMD_GSP_INIT,
+        ExecGenericBootloader = bindings::GMCAPI_COMMANDS_GMCAPI_CMD_EXEC_GENERIC_BOOTLOADER,
+        ExecHsBinary = bindings::GMCAPI_COMMANDS_GMCAPI_CMD_EXEC_HS_BINARY,
+        GspSuspend = bindings::GMCAPI_COMMANDS_GMCAPI_CMD_GSP_SUSPEND,
+        MmuFaultQueued = bindings::GMCAPI_COMMANDS_GMCAPI_CMD_MMU_FAULT_QUEUED,
     }
 }
 
@@ -1101,11 +999,9 @@ pub(crate) struct GmcCommandWord(u32) {
 /// command.
 #[repr(transparent)]
 pub(crate) struct GmcApiHeader {
-    inner: r000_00::GMCAPI_HEADER,
+    inner: bindings::GMCAPI_HEADER,
 }
 
-// Using `allow` instead of `expect` here due to rust-lang/rust#154377.
-#[allow(dead_code)]
 impl GmcApiHeader {
     /// Creates the header of a request for `command`, sent with sequence number `sequence` and
     /// followed by `payload_size` bytes of payload.
@@ -1122,12 +1018,12 @@ pub(crate) fn init(
         payload_size: usize,
         max_reply_size: u32,
     ) -> impl Init<Self, Error> {
-        let init_inner = try_init!(r000_00::GMCAPI_HEADER {
+        let init_inner = try_init!(bindings::GMCAPI_HEADER {
             command: GmcCommandWord::zeroed().with_id(command).into(),
             size: payload_size.try_into().map_err(|_| EOVERFLOW)?,
             sequence,
-            __bindgen_anon_1: r000_00::GMCAPI_HEADER__bindgen_ty_1 {
-                request: r000_00::GMCAPI_HEADER__bindgen_ty_1__bindgen_ty_1 {
+            __bindgen_anon_1: bindings::GMCAPI_HEADER__bindgen_ty_1 {
+                request: bindings::GMCAPI_HEADER__bindgen_ty_1__bindgen_ty_1 {
                     max_response_size: max_reply_size,
                 },
             },
@@ -1177,6 +1073,12 @@ unsafe impl AsBytes for GmcApiHeader {}
 // SAFETY: This struct only contains integer types for which all bit patterns are valid.
 unsafe impl FromBytes for GmcApiHeader {}
 
+/// First word of `GSP_ARGUMENTS_CACHED`: `"GSP "` in ASCII.
+const GSP_ARGUMENTS_MAGIC_VALUE: u32 = 0x2050_5347;
+
+/// Flag that requests GSP-RM to place its stack in DMEM.
+const GSP_ARGUMENTS_FLAG_STACK_IN_DMEM: u64 = 0x02;
+
 /// Arguments for GSP startup.
 #[repr(transparent)]
 #[derive(Zeroable)]
@@ -1185,11 +1087,21 @@ pub(crate) struct GspArgumentsCached {
 }
 
 impl GspArgumentsCached {
-    /// Creates the arguments for starting the GSP up using `cmdq` as its command queue.
-    pub(crate) fn new<'a, 'b>(cmdq: &'a Cmdq<'b>) -> impl Init<Self> + use<'a, 'b> {
+    /// Creates the arguments for starting the GSP, with `cmdq` as its command queue and
+    /// `state_monitor` as the buffer in which GSP-RM reports its own state.
+    pub(crate) fn new<'a, 'b>(
+        cmdq: &'a Cmdq<'b>,
+        state_monitor: &'a Coherent<'b, [u8; GSP_PAGE_SIZE]>,
+    ) -> impl Init<Self> + use<'a, 'b> {
         let init_inner = init!(bindings::GSP_ARGUMENTS_CACHED {
+            magic: GSP_ARGUMENTS_MAGIC_VALUE,
+            size: cv!(size_of::<bindings::GSP_ARGUMENTS_CACHED>()),
+            flags: GSP_ARGUMENTS_FLAG_STACK_IN_DMEM,
             messageQueueInitArguments <- MessageQueueInitArguments::new(cmdq),
-            bDmemStack: 1,
+            rmStateMonitorBufferArgs: bindings::GSP_ARGUMENTS_CACHED__bindgen_ty_3 {
+                pa: state_monitor.dma_address(),
+                size: num::usize_as_u64(state_monitor.size()),
+            },
             ..Zeroable::init_zeroed()
         });
 
@@ -1213,12 +1125,23 @@ pub(crate) struct GspArgumentsPadded {
 }
 
 impl GspArgumentsPadded {
-    pub(crate) fn new<'a, 'b>(cmdq: &'a Cmdq<'b>) -> impl Init<Self> + use<'a, 'b> {
+    pub(crate) fn new<'a, 'b>(
+        cmdq: &'a Cmdq<'b>,
+        state_monitor: &'a Coherent<'b, [u8; GSP_PAGE_SIZE]>,
+    ) -> impl Init<Self> + use<'a, 'b> {
         init!(GspArgumentsPadded {
-            inner <- GspArgumentsCached::new(cmdq),
+            inner <- GspArgumentsCached::new(cmdq, state_monitor),
             ..Zeroable::init_zeroed()
         })
     }
+
+    /// Records where `ucodes` is mapped.
+    ///
+    /// GSP-RM reads the arguments once, when it starts, so a write after that point has no effect.
+    pub(crate) fn set_ucodes(this: &Coherent<'_, Self>, ucodes: &UcodesImage<'_>) {
+        io_write!(this, .inner.inner.bindataArgs.radix3, ucodes.radix3_dma_address());
+        io_write!(this, .inner.inner.bindataArgs.size, num::usize_as_u64(ucodes.size()));
+    }
 }
 
 // SAFETY: Padding is explicit and will not contain uninitialized data.
@@ -1239,6 +1162,15 @@ fn new<'a, 'b>(cmdq: &'a Cmdq<'b>) -> impl Init<Self> + use<'a, 'b> {
             pageTableEntryCount: cv!(Cmdq::NUM_PTES),
             cmdQueueOffset: u64::from_safe_cast(Cmdq::CMDQ_OFFSET),
             statQueueOffset: u64::from_safe_cast(Cmdq::STATQ_OFFSET),
+
+            queueElementHdrSize: cv!(size_of::<QueueElementHeader>()),
+            queueElementSizeMin: cv!(GSP_PAGE_SIZE),
+            queueElementSizeMax: cv!(GSP_MSG_QUEUE_ELEMENT_SIZE_MAX),
+
+            // Both alignments are log2 values, which GSP-RM applies as `1 << n`.
+            queueHeaderAlign: 4,
+            queueElementAlign: cv!(GSP_PAGE_SHIFT),
+
             ..Zeroable::init_zeroed()
         })
     }
@@ -1286,6 +1218,9 @@ fn new(target: GspDmaTarget, libos_addr: u64) -> impl Init<Self> {
 
 pub(crate) type GspFmcBootParams = bindings::GSP_FMC_BOOT_PARAMS;
 
+/// Magic value opening the ABI-stable `GSP_FMC_BOOT_PARAMS` header: `"FMC "` in ASCII.
+const GSP_FMC_BOOT_PARAMS_MAGIC: u32 = 0x2043_4d46;
+
 // SAFETY: Padding is explicit and will not contain uninitialized data.
 unsafe impl AsBytes for GspFmcBootParams {}
 // SAFETY: This struct only contains integer types for which all bit patterns are valid.
@@ -1294,6 +1229,8 @@ unsafe impl FromBytes for GspFmcBootParams {}
 impl GspFmcBootParams {
     pub(crate) fn new(wpr_meta_addr: u64, libos_addr: u64) -> impl Init<Self> {
         let init = init!(Self {
+            magic: GSP_FMC_BOOT_PARAMS_MAGIC,
+            size: cv!(size_of::<Self>()),
             // Blackwell FSP obtains WPR info from other sources, so
             // wprCarveoutOffset and wprCarveoutSize are left zero.
             bootGspRmParams <- GspAcrBootGspRmParams::new(GspDmaTarget::CoherentSystem,
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 2dae9f19b6c6..f83a04bc0816 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -38,7 +38,7 @@
     vgpu::VgpuState, //
 };
 
-use super::bindings;
+use super::r570_144 as bindings;
 
 /// Payload of the `GspSetSystemInfo` command.
 #[repr(transparent)]
diff --git a/drivers/gpu/nova-core/gsp/hal.rs b/drivers/gpu/nova-core/gsp/hal.rs
index a0117d6d16a2..caf249f37445 100644
--- a/drivers/gpu/nova-core/gsp/hal.rs
+++ b/drivers/gpu/nova-core/gsp/hal.rs
@@ -46,6 +46,7 @@ fn boot<'gpu>(
     ///
     /// This method is called by the GSP boot code after the GSP is confirmed to be running, and
     /// after the initialization commands have been pushed onto its queue.
+    #[expect(dead_code)]
     fn post_boot(
         &self,
         _gsp: &Gsp<'_>,
diff --git a/drivers/gpu/nova-core/gsp/load_exec.rs b/drivers/gpu/nova-core/gsp/load_exec.rs
index a32b13c361ad..7d379eb13e02 100644
--- a/drivers/gpu/nova-core/gsp/load_exec.rs
+++ b/drivers/gpu/nova-core/gsp/load_exec.rs
@@ -137,7 +137,6 @@ impl GspBootContext<'_, '_> {
     ///
     /// Errors from the handlers and from the resume of GSP-RM are propagated
     /// as-is.
-    #[expect(dead_code)]
     pub(super) fn handle_load_exec_event(
         &self,
         libos_dma_address: DmaAddress,

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 13/15] gpu: nova-core: gsp: delete the GSP sequencer
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (11 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 12/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 14/15] gpu: nova-core: gsp: delete the r570 RPC commands Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 15/15] gpu: nova-core: firmware: delete the r570 bindings Alexandre Courbot
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

With the switch to the r000 GSP firmware, load-and-execute GMC events
replaced the command sequences that the r570 GSP-RM sent for the GSP
sequencer to run, leaving the sequencer module unused.

Delete the GSP sequencer module along with its firmware wrapper types,
RPC event variant, and the post_boot HAL hook. Also mark
`SBufferIter::flush_into_kvec` as dead code now that its last caller is
gone.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp.rs           |   1 -
 drivers/gpu/nova-core/gsp/fw.rs        | 275 -------------------------
 drivers/gpu/nova-core/gsp/hal.rs       |  14 --
 drivers/gpu/nova-core/gsp/hal/tu102.rs |  12 --
 drivers/gpu/nova-core/gsp/sequencer.rs | 353 ---------------------------------
 drivers/gpu/nova-core/sbuffer.rs       |   1 +
 6 files changed, 1 insertion(+), 655 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
index 05c1aa9d2159..a43e76609485 100644
--- a/drivers/gpu/nova-core/gsp.rs
+++ b/drivers/gpu/nova-core/gsp.rs
@@ -24,7 +24,6 @@
 mod logbuffer;
 mod nvkv;
 mod regs;
-mod sequencer;
 
 use logbuffer::LogBuffers;
 pub(crate) use logbuffer::RetainedLogs;
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index c51f0c6913df..c5ed5d47918a 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -304,7 +304,6 @@ pub(crate) enum MsgFunction {
     GspInitDone = bindings::NV_VGPU_MSG_EVENT_GSP_INIT_DONE,
     GspLockdownNotice = bindings::NV_VGPU_MSG_EVENT_GSP_LOCKDOWN_NOTICE,
     GspPostNoCat = bindings::NV_VGPU_MSG_EVENT_GSP_POST_NOCAT_RECORD,
-    GspRunCpuSequencer = r570_144::NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER,
     MmuFaultQueued = bindings::NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED,
     OsErrorLog = bindings::NV_VGPU_MSG_EVENT_OS_ERROR_LOG,
     PostEvent = bindings::NV_VGPU_MSG_EVENT_POST_EVENT,
@@ -351,9 +350,6 @@ fn try_from(value: u32) -> Result<MsgFunction> {
             bindings::NV_VGPU_MSG_EVENT_GSP_INIT_DONE => Ok(MsgFunction::GspInitDone),
             bindings::NV_VGPU_MSG_EVENT_GSP_LOCKDOWN_NOTICE => Ok(MsgFunction::GspLockdownNotice),
             bindings::NV_VGPU_MSG_EVENT_GSP_POST_NOCAT_RECORD => Ok(MsgFunction::GspPostNoCat),
-            r570_144::NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER => {
-                Ok(MsgFunction::GspRunCpuSequencer)
-            }
             bindings::NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED => Ok(MsgFunction::MmuFaultQueued),
             bindings::NV_VGPU_MSG_EVENT_OS_ERROR_LOG => Ok(MsgFunction::OsErrorLog),
             bindings::NV_VGPU_MSG_EVENT_POST_EVENT => Ok(MsgFunction::PostEvent),
@@ -371,277 +367,6 @@ fn from(value: MsgFunction) -> Self {
     }
 }
 
-/// Sequencer buffer opcode for GSP sequencer commands.
-#[derive(Copy, Clone, Debug, PartialEq)]
-#[repr(u32)]
-pub(crate) enum SeqBufOpcode {
-    // Core operation opcodes
-    CoreReset = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET,
-    CoreResume = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME,
-    CoreStart = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START,
-    CoreWaitForHalt = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT,
-
-    // Delay opcode
-    DelayUs = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US,
-
-    // Register operation opcodes
-    RegModify = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY,
-    RegPoll = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL,
-    RegStore = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE,
-    RegWrite = r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE,
-}
-
-impl TryFrom<u32> for SeqBufOpcode {
-    type Error = kernel::error::Error;
-
-    fn try_from(value: u32) -> Result<SeqBufOpcode> {
-        match value {
-            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET => {
-                Ok(SeqBufOpcode::CoreReset)
-            }
-            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME => {
-                Ok(SeqBufOpcode::CoreResume)
-            }
-            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START => {
-                Ok(SeqBufOpcode::CoreStart)
-            }
-            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT => {
-                Ok(SeqBufOpcode::CoreWaitForHalt)
-            }
-            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US => Ok(SeqBufOpcode::DelayUs),
-            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY => {
-                Ok(SeqBufOpcode::RegModify)
-            }
-            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL => Ok(SeqBufOpcode::RegPoll),
-            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE => Ok(SeqBufOpcode::RegStore),
-            r570_144::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE => Ok(SeqBufOpcode::RegWrite),
-            _ => Err(EINVAL),
-        }
-    }
-}
-
-impl From<SeqBufOpcode> for u32 {
-    fn from(value: SeqBufOpcode) -> Self {
-        // CAST: `SeqBufOpcode` is `repr(u32)` and can thus be cast losslessly.
-        value as u32
-    }
-}
-
-/// Wrapper for GSP sequencer register write payload.
-#[repr(transparent)]
-#[derive(Copy, Clone, Debug)]
-pub(crate) struct RegWritePayload(r570_144::GSP_SEQ_BUF_PAYLOAD_REG_WRITE);
-
-impl RegWritePayload {
-    /// Returns the register address.
-    pub(crate) fn addr(&self) -> u32 {
-        self.0.addr
-    }
-
-    /// Returns the value to write.
-    pub(crate) fn val(&self) -> u32 {
-        self.0.val
-    }
-}
-
-// SAFETY: This struct only contains integer types for which all bit patterns are valid.
-unsafe impl FromBytes for RegWritePayload {}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for RegWritePayload {}
-
-/// Wrapper for GSP sequencer register modify payload.
-#[repr(transparent)]
-#[derive(Copy, Clone, Debug)]
-pub(crate) struct RegModifyPayload(r570_144::GSP_SEQ_BUF_PAYLOAD_REG_MODIFY);
-
-impl RegModifyPayload {
-    /// Returns the register address.
-    pub(crate) fn addr(&self) -> u32 {
-        self.0.addr
-    }
-
-    /// Returns the mask to apply.
-    pub(crate) fn mask(&self) -> u32 {
-        self.0.mask
-    }
-
-    /// Returns the value to write.
-    pub(crate) fn val(&self) -> u32 {
-        self.0.val
-    }
-}
-
-// SAFETY: This struct only contains integer types for which all bit patterns are valid.
-unsafe impl FromBytes for RegModifyPayload {}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for RegModifyPayload {}
-
-/// Wrapper for GSP sequencer register poll payload.
-#[repr(transparent)]
-#[derive(Copy, Clone, Debug)]
-pub(crate) struct RegPollPayload(r570_144::GSP_SEQ_BUF_PAYLOAD_REG_POLL);
-
-impl RegPollPayload {
-    /// Returns the register address.
-    pub(crate) fn addr(&self) -> u32 {
-        self.0.addr
-    }
-
-    /// Returns the mask to apply.
-    pub(crate) fn mask(&self) -> u32 {
-        self.0.mask
-    }
-
-    /// Returns the expected value.
-    pub(crate) fn val(&self) -> u32 {
-        self.0.val
-    }
-
-    /// Returns the timeout in microseconds.
-    pub(crate) fn timeout(&self) -> u32 {
-        self.0.timeout
-    }
-}
-
-// SAFETY: This struct only contains integer types for which all bit patterns are valid.
-unsafe impl FromBytes for RegPollPayload {}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for RegPollPayload {}
-
-/// Wrapper for GSP sequencer delay payload.
-#[repr(transparent)]
-#[derive(Copy, Clone, Debug)]
-pub(crate) struct DelayUsPayload(r570_144::GSP_SEQ_BUF_PAYLOAD_DELAY_US);
-
-impl DelayUsPayload {
-    /// Returns the delay value in microseconds.
-    pub(crate) fn val(&self) -> u32 {
-        self.0.val
-    }
-}
-
-// SAFETY: This struct only contains integer types for which all bit patterns are valid.
-unsafe impl FromBytes for DelayUsPayload {}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for DelayUsPayload {}
-
-/// Wrapper for GSP sequencer register store payload.
-#[repr(transparent)]
-#[derive(Copy, Clone, Debug)]
-pub(crate) struct RegStorePayload(r570_144::GSP_SEQ_BUF_PAYLOAD_REG_STORE);
-
-impl RegStorePayload {
-    /// Returns the register address.
-    pub(crate) fn addr(&self) -> u32 {
-        self.0.addr
-    }
-
-    /// Returns the storage index.
-    #[allow(unused)]
-    pub(crate) fn index(&self) -> u32 {
-        self.0.index
-    }
-}
-
-// SAFETY: This struct only contains integer types for which all bit patterns are valid.
-unsafe impl FromBytes for RegStorePayload {}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for RegStorePayload {}
-
-/// Wrapper for GSP sequencer buffer command.
-#[repr(transparent)]
-pub(crate) struct SequencerBufferCmd(r570_144::GSP_SEQUENCER_BUFFER_CMD);
-
-impl SequencerBufferCmd {
-    /// Returns the opcode as a `SeqBufOpcode` enum, or error if invalid.
-    pub(crate) fn opcode(&self) -> Result<SeqBufOpcode> {
-        self.0.opCode.try_into()
-    }
-
-    /// Returns the register write payload by value.
-    ///
-    /// Returns an error if the opcode is not `SeqBufOpcode::RegWrite`.
-    pub(crate) fn reg_write_payload(&self) -> Result<RegWritePayload> {
-        if self.opcode()? != SeqBufOpcode::RegWrite {
-            return Err(EINVAL);
-        }
-        // SAFETY: Opcode is verified to be `RegWrite`, so union contains valid `RegWritePayload`.
-        Ok(RegWritePayload(unsafe { self.0.payload.regWrite }))
-    }
-
-    /// Returns the register modify payload by value.
-    ///
-    /// Returns an error if the opcode is not `SeqBufOpcode::RegModify`.
-    pub(crate) fn reg_modify_payload(&self) -> Result<RegModifyPayload> {
-        if self.opcode()? != SeqBufOpcode::RegModify {
-            return Err(EINVAL);
-        }
-        // SAFETY: Opcode is verified to be `RegModify`, so union contains valid `RegModifyPayload`.
-        Ok(RegModifyPayload(unsafe { self.0.payload.regModify }))
-    }
-
-    /// Returns the register poll payload by value.
-    ///
-    /// Returns an error if the opcode is not `SeqBufOpcode::RegPoll`.
-    pub(crate) fn reg_poll_payload(&self) -> Result<RegPollPayload> {
-        if self.opcode()? != SeqBufOpcode::RegPoll {
-            return Err(EINVAL);
-        }
-        // SAFETY: Opcode is verified to be `RegPoll`, so union contains valid `RegPollPayload`.
-        Ok(RegPollPayload(unsafe { self.0.payload.regPoll }))
-    }
-
-    /// Returns the delay payload by value.
-    ///
-    /// Returns an error if the opcode is not `SeqBufOpcode::DelayUs`.
-    pub(crate) fn delay_us_payload(&self) -> Result<DelayUsPayload> {
-        if self.opcode()? != SeqBufOpcode::DelayUs {
-            return Err(EINVAL);
-        }
-        // SAFETY: Opcode is verified to be `DelayUs`, so union contains valid `DelayUsPayload`.
-        Ok(DelayUsPayload(unsafe { self.0.payload.delayUs }))
-    }
-
-    /// Returns the register store payload by value.
-    ///
-    /// Returns an error if the opcode is not `SeqBufOpcode::RegStore`.
-    pub(crate) fn reg_store_payload(&self) -> Result<RegStorePayload> {
-        if self.opcode()? != SeqBufOpcode::RegStore {
-            return Err(EINVAL);
-        }
-        // SAFETY: Opcode is verified to be `RegStore`, so union contains valid `RegStorePayload`.
-        Ok(RegStorePayload(unsafe { self.0.payload.regStore }))
-    }
-}
-
-// SAFETY: This struct only contains integer types for which all bit patterns are valid.
-unsafe impl FromBytes for SequencerBufferCmd {}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for SequencerBufferCmd {}
-
-/// Wrapper for GSP run CPU sequencer RPC.
-#[repr(transparent)]
-pub(crate) struct RunCpuSequencer(r570_144::rpc_run_cpu_sequencer_v17_00);
-
-impl RunCpuSequencer {
-    /// Returns the command index.
-    pub(crate) fn cmd_index(&self) -> u32 {
-        self.0.cmdIndex
-    }
-}
-
-// SAFETY: This struct only contains integer types for which all bit patterns are valid.
-unsafe impl FromBytes for RunCpuSequencer {}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for RunCpuSequencer {}
-
 /// Struct containing the arguments required to pass a memory buffer to the GSP
 /// for use during initialisation.
 ///
diff --git a/drivers/gpu/nova-core/gsp/hal.rs b/drivers/gpu/nova-core/gsp/hal.rs
index caf249f37445..49f5752cc71a 100644
--- a/drivers/gpu/nova-core/gsp/hal.rs
+++ b/drivers/gpu/nova-core/gsp/hal.rs
@@ -41,20 +41,6 @@ fn boot<'gpu>(
         ctx: &mut GspBootContext<'_, 'gpu>,
         gsp_fw: &GspFirmware<'gpu>,
     ) -> Result<Option<super::UnloadBundle<'gpu>>>;
-
-    /// Performs HAL-specific post-GSP boot tasks.
-    ///
-    /// This method is called by the GSP boot code after the GSP is confirmed to be running, and
-    /// after the initialization commands have been pushed onto its queue.
-    #[expect(dead_code)]
-    fn post_boot(
-        &self,
-        _gsp: &Gsp<'_>,
-        _ctx: &mut GspBootContext<'_, '_>,
-        _gsp_fw: &GspFirmware<'_>,
-    ) -> Result {
-        Ok(())
-    }
 }
 
 /// Returns the names of the firmware files required to boot the GSP of `chipset`, in addition to
diff --git a/drivers/gpu/nova-core/gsp/hal/tu102.rs b/drivers/gpu/nova-core/gsp/hal/tu102.rs
index 2c95d178b020..8742910aa623 100644
--- a/drivers/gpu/nova-core/gsp/hal/tu102.rs
+++ b/drivers/gpu/nova-core/gsp/hal/tu102.rs
@@ -40,7 +40,6 @@
             UnloadBundle, //
         },
         regs,
-        sequencer::GspSequencer,
         Gsp,
         GspBootContext,
         GspFwWprMeta, //
@@ -313,17 +312,6 @@ fn boot<'gpu>(
 
         Ok(unload_guard.dismiss())
     }
-
-    fn post_boot(
-        &self,
-        gsp: &Gsp<'_>,
-        ctx: &mut GspBootContext<'_, '_>,
-        gsp_fw: &GspFirmware<'_>,
-    ) -> Result {
-        GspSequencer::run(&gsp.cmdq, ctx, &gsp.libos, gsp_fw.bootloader.app_version)?;
-
-        Ok(())
-    }
 }
 
 /// The TU102 HAL requires the use of the FWSEC bootloader.
diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs
deleted file mode 100644
index bd83dd924244..000000000000
--- a/drivers/gpu/nova-core/gsp/sequencer.rs
+++ /dev/null
@@ -1,353 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-//! GSP Sequencer implementation for Pre-hopper GSP boot sequence.
-
-use core::array;
-
-use kernel::{
-    device,
-    dma::Coherent,
-    io::{
-        poll::read_poll_timeout,
-        Io, //
-    },
-    prelude::*,
-    time::{
-        delay::fsleep,
-        Delta, //
-    },
-    transmute::FromBytes, //
-};
-
-use crate::{
-    driver::Bar0,
-    falcon::{
-        gsp::Gsp,
-        sec2::Sec2,
-        Falcon, //
-    },
-    gsp::{
-        cmdq::{
-            rpc::MessageFromGsp,
-            Cmdq, //
-        },
-        fw,
-        load_exec,
-        GspBootContext,
-        LibosMemoryRegionInitArgument, //
-    },
-    num::FromSafeCast,
-    sbuffer::SBufferIter,
-};
-
-/// GSP Sequencer information containing the command sequence and data.
-struct GspSequence {
-    /// Current command index for error reporting.
-    cmd_index: u32,
-    /// Command data buffer containing the sequence of commands.
-    cmd_data: KVec<u8>,
-}
-
-impl MessageFromGsp for GspSequence {
-    const FUNCTION: fw::MsgFunction = fw::MsgFunction::GspRunCpuSequencer;
-    type InitError = Error;
-    type Message = fw::RunCpuSequencer;
-
-    fn read(
-        msg: &Self::Message,
-        sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>,
-    ) -> Result<Self, Self::InitError> {
-        let cmd_data = sbuffer.flush_into_kvec(GFP_KERNEL)?;
-        Ok(GspSequence {
-            cmd_index: msg.cmd_index(),
-            cmd_data,
-        })
-    }
-}
-
-const CMD_SIZE: usize = size_of::<fw::SequencerBufferCmd>();
-
-/// GSP Sequencer Command types with payload data.
-/// Commands have an opcode and an opcode-dependent struct.
-#[allow(clippy::enum_variant_names)]
-#[derive(Debug)]
-pub(crate) enum GspSeqCmd {
-    RegWrite(fw::RegWritePayload),
-    RegModify(fw::RegModifyPayload),
-    RegPoll(fw::RegPollPayload),
-    DelayUs(fw::DelayUsPayload),
-    RegStore(fw::RegStorePayload),
-    CoreReset,
-    CoreStart,
-    CoreWaitForHalt,
-    CoreResume,
-}
-
-impl GspSeqCmd {
-    /// Creates a new `GspSeqCmd` from raw data returning the command and its size in bytes.
-    pub(crate) fn new(data: &[u8], dev: &device::Device) -> Result<(Self, usize)> {
-        let fw_cmd = fw::SequencerBufferCmd::from_bytes(data).ok_or(EINVAL)?;
-        let opcode_size = core::mem::size_of::<u32>();
-
-        let (cmd, size) = match fw_cmd.opcode()? {
-            fw::SeqBufOpcode::RegWrite => {
-                let payload = fw_cmd.reg_write_payload()?;
-                let size = opcode_size + size_of_val(&payload);
-                (GspSeqCmd::RegWrite(payload), size)
-            }
-            fw::SeqBufOpcode::RegModify => {
-                let payload = fw_cmd.reg_modify_payload()?;
-                let size = opcode_size + size_of_val(&payload);
-                (GspSeqCmd::RegModify(payload), size)
-            }
-            fw::SeqBufOpcode::RegPoll => {
-                let payload = fw_cmd.reg_poll_payload()?;
-                let size = opcode_size + size_of_val(&payload);
-                (GspSeqCmd::RegPoll(payload), size)
-            }
-            fw::SeqBufOpcode::DelayUs => {
-                let payload = fw_cmd.delay_us_payload()?;
-                let size = opcode_size + size_of_val(&payload);
-                (GspSeqCmd::DelayUs(payload), size)
-            }
-            fw::SeqBufOpcode::RegStore => {
-                let payload = fw_cmd.reg_store_payload()?;
-                let size = opcode_size + size_of_val(&payload);
-                (GspSeqCmd::RegStore(payload), size)
-            }
-            fw::SeqBufOpcode::CoreReset => (GspSeqCmd::CoreReset, opcode_size),
-            fw::SeqBufOpcode::CoreStart => (GspSeqCmd::CoreStart, opcode_size),
-            fw::SeqBufOpcode::CoreWaitForHalt => (GspSeqCmd::CoreWaitForHalt, opcode_size),
-            fw::SeqBufOpcode::CoreResume => (GspSeqCmd::CoreResume, opcode_size),
-        };
-
-        if data.len() < size {
-            dev_err!(dev, "Data is not enough for command\n");
-            return Err(EINVAL);
-        }
-
-        Ok((cmd, size))
-    }
-}
-
-/// GSP Sequencer for executing firmware commands during boot.
-pub(crate) struct GspSequencer<'a> {
-    /// `Bar0` for register access.
-    bar: Bar0<'a>,
-    /// SEC2 falcon for core operations.
-    sec2_falcon: &'a Falcon<'a, Sec2>,
-    /// GSP falcon for core operations.
-    gsp_falcon: &'a Falcon<'a, Gsp>,
-    /// LibOS memory region init arguments.
-    libos: &'a Coherent<'a, [LibosMemoryRegionInitArgument]>,
-    /// Bootloader application version.
-    bootloader_app_version: u32,
-    /// Device for logging.
-    dev: &'a device::Device,
-}
-
-impl fw::RegWritePayload {
-    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
-        let addr = usize::from_safe_cast(self.addr());
-
-        sequencer.bar.try_write32(self.val(), addr)
-    }
-}
-
-impl fw::RegModifyPayload {
-    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
-        let addr = usize::from_safe_cast(self.addr());
-
-        sequencer.bar.try_read32(addr).and_then(|val| {
-            sequencer
-                .bar
-                .try_write32((val & !self.mask()) | self.val(), addr)
-        })
-    }
-}
-
-impl fw::RegPollPayload {
-    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
-        let addr = usize::from_safe_cast(self.addr());
-
-        // Default timeout to 4 seconds.
-        let timeout_us = if self.timeout() == 0 {
-            4_000_000
-        } else {
-            i64::from(self.timeout())
-        };
-
-        // First read.
-        sequencer.bar.try_read32(addr)?;
-
-        // Poll the requested register with requested timeout.
-        read_poll_timeout(
-            || sequencer.bar.try_read32(addr),
-            |current| (current & self.mask()) == self.val(),
-            Delta::ZERO,
-            Delta::from_micros(timeout_us),
-        )
-        .map(|_| ())
-    }
-}
-
-impl fw::DelayUsPayload {
-    fn run(&self, _sequencer: &GspSequencer<'_>) -> Result {
-        fsleep(Delta::from_micros(i64::from(self.val())));
-        Ok(())
-    }
-}
-
-impl fw::RegStorePayload {
-    fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
-        let addr = usize::from_safe_cast(self.addr());
-
-        sequencer.bar.try_read32(addr).map(|_| ())
-    }
-}
-
-impl GspSeqCmd {
-    fn run(&self, seq: &GspSequencer<'_>) -> Result {
-        match self {
-            GspSeqCmd::RegWrite(cmd) => cmd.run(seq),
-            GspSeqCmd::RegModify(cmd) => cmd.run(seq),
-            GspSeqCmd::RegPoll(cmd) => cmd.run(seq),
-            GspSeqCmd::DelayUs(cmd) => cmd.run(seq),
-            GspSeqCmd::RegStore(cmd) => cmd.run(seq),
-            GspSeqCmd::CoreReset => {
-                seq.gsp_falcon.reset()?;
-                seq.gsp_falcon.dma_reset();
-                Ok(())
-            }
-            GspSeqCmd::CoreStart => {
-                seq.gsp_falcon.start()?;
-                Ok(())
-            }
-            GspSeqCmd::CoreWaitForHalt => {
-                seq.gsp_falcon.wait_till_halted()?;
-                Ok(())
-            }
-            GspSeqCmd::CoreResume => {
-                // At this point, 'SEC2-RTOS' has been loaded into SEC2 by the sequencer
-                // but neither SEC2-RTOS nor GSP-RM is running yet. This part of the
-                // sequencer will start both.
-                load_exec::resume_gsp_rm(
-                    seq.dev,
-                    seq.gsp_falcon,
-                    seq.sec2_falcon,
-                    seq.libos.dma_address(),
-                    seq.bootloader_app_version,
-                )
-            }
-        }
-    }
-}
-
-/// Iterator over GSP sequencer commands.
-struct GspSeqIter<'a> {
-    /// Command data buffer.
-    cmd_data: &'a [u8],
-    /// Current position in the buffer.
-    current_offset: usize,
-    /// Total number of commands to process.
-    total_cmds: u32,
-    /// Number of commands processed so far.
-    cmds_processed: u32,
-    /// Device for logging.
-    dev: &'a device::Device,
-}
-
-impl<'a> GspSeqIter<'a> {
-    fn new(seq: &'a GspSequence, dev: &'a device::Device) -> Self {
-        Self {
-            cmd_data: &seq.cmd_data,
-            current_offset: 0,
-            total_cmds: seq.cmd_index,
-            cmds_processed: 0,
-            dev,
-        }
-    }
-}
-
-impl<'a> Iterator for GspSeqIter<'a> {
-    type Item = Result<GspSeqCmd>;
-
-    fn next(&mut self) -> Option<Self::Item> {
-        // Stop if we've processed all commands or reached the end of data.
-        if self.cmds_processed >= self.total_cmds || self.current_offset >= self.cmd_data.len() {
-            return None;
-        }
-
-        // Check if we have enough data for opcode.
-        if self.current_offset + core::mem::size_of::<u32>() > self.cmd_data.len() {
-            return Some(Err(EIO));
-        }
-
-        let offset = self.current_offset;
-
-        // Handle command creation based on available data,
-        // zero-pad if necessary (since last command may not be full size).
-        let mut buffer = [0u8; CMD_SIZE];
-        let copy_len = if offset + CMD_SIZE <= self.cmd_data.len() {
-            CMD_SIZE
-        } else {
-            self.cmd_data.len() - offset
-        };
-        buffer[..copy_len].copy_from_slice(&self.cmd_data[offset..offset + copy_len]);
-        let cmd_result = GspSeqCmd::new(&buffer, self.dev);
-
-        cmd_result.map_or_else(
-            |_err| {
-                dev_err!(self.dev, "Error parsing command at offset {}\n", offset);
-                None
-            },
-            |(cmd, size)| {
-                self.current_offset += size;
-                self.cmds_processed += 1;
-                Some(Ok(cmd))
-            },
-        )
-    }
-}
-
-impl<'a> GspSequencer<'a> {
-    pub(crate) fn run(
-        cmdq: &Cmdq<'_>,
-        ctx: &'a GspBootContext<'_, '_>,
-        libos: &'a Coherent<'a, [LibosMemoryRegionInitArgument]>,
-        bootloader_app_version: u32,
-    ) -> Result {
-        let seq_info = cmdq.await_rpc_msg::<GspSequence>()?;
-
-        let sequencer = GspSequencer {
-            bar: ctx.bar,
-            sec2_falcon: ctx.sec2_falcon,
-            gsp_falcon: ctx.gsp_falcon,
-            libos,
-            bootloader_app_version,
-            dev: ctx.dev(),
-        };
-
-        dev_dbg!(sequencer.dev, "Running CPU Sequencer commands\n");
-
-        for cmd_result in GspSeqIter::new(&seq_info, sequencer.dev) {
-            match cmd_result {
-                Ok(cmd) => cmd.run(&sequencer)?,
-                Err(e) => {
-                    dev_err!(
-                        sequencer.dev,
-                        "Error running command at index {}\n",
-                        seq_info.cmd_index
-                    );
-                    return Err(e);
-                }
-            }
-        }
-
-        dev_dbg!(
-            sequencer.dev,
-            "CPU Sequencer commands completed successfully\n"
-        );
-        Ok(())
-    }
-}
diff --git a/drivers/gpu/nova-core/sbuffer.rs b/drivers/gpu/nova-core/sbuffer.rs
index b8c01104c255..b6e77788c338 100644
--- a/drivers/gpu/nova-core/sbuffer.rs
+++ b/drivers/gpu/nova-core/sbuffer.rs
@@ -164,6 +164,7 @@ pub(crate) fn read_exact(&mut self, mut dst: &mut [u8]) -> Result {
     /// Read all the remaining data into a [`KVec`].
     ///
     /// `self` will be empty after this operation.
+    #[expect(dead_code)]
     pub(crate) fn flush_into_kvec(&mut self, flags: kernel::alloc::Flags) -> Result<KVec<u8>> {
         let mut buf = KVec::<u8>::new();
 

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 14/15] gpu: nova-core: gsp: delete the r570 RPC commands
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (12 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 13/15] gpu: nova-core: gsp: delete the GSP sequencer Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  2026-12-03 12:09 ` [PATCH 15/15] gpu: nova-core: firmware: delete the r570 bindings Alexandre Courbot
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

With the switch to the r000 GSP firmware, the GSP_INIT and GSP_SUSPEND
GMC commands replaced the four RPC commands that the r570 boot and
shutdown paths sent (SetSystemInfo, SetRegistry, GetGspStaticInfo and
UnloadingGuestDriver), and the reply to GSP_INIT replaced the init-done
event.

Delete the unused r570 RPC commands module and its firmware payload
wrappers.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/commands.rs     |   2 -
 drivers/gpu/nova-core/gsp/commands/rpc.rs | 285 ------------------------------
 drivers/gpu/nova-core/gsp/fw/commands.rs  | 250 +-------------------------
 3 files changed, 3 insertions(+), 534 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
index df920e3d8322..cf522a90eae4 100644
--- a/drivers/gpu/nova-core/gsp/commands.rs
+++ b/drivers/gpu/nova-core/gsp/commands.rs
@@ -2,8 +2,6 @@
 // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
 pub(crate) mod gmc;
-#[expect(dead_code)]
-pub(crate) mod rpc;
 
 use core::{
     ffi::FromBytesUntilNulError,
diff --git a/drivers/gpu/nova-core/gsp/commands/rpc.rs b/drivers/gpu/nova-core/gsp/commands/rpc.rs
deleted file mode 100644
index 084214d69f1f..000000000000
--- a/drivers/gpu/nova-core/gsp/commands/rpc.rs
+++ /dev/null
@@ -1,285 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
-
-use core::{
-    array,
-    convert::Infallible, //
-};
-
-use kernel::{
-    device,
-    pci,
-    prelude::*,
-    transmute::{
-        AsBytes,
-        FromBytes, //
-    }, //
-};
-
-use crate::{
-    gpu::Chipset,
-    gsp::{
-        cmdq::{
-            rpc::{
-                CommandToGsp,
-                MessageFromGsp, //
-            },
-            Cmdq,
-            NoReply, //
-        },
-        commands::{
-            GspStaticInfo,
-            PowerStateLevel, //
-        },
-        fw::{
-            self,
-            MsgFunction, //
-        },
-    },
-    sbuffer::SBufferIter,
-    vgpu::VgpuState, //
-};
-
-/// The `GspSetSystemInfo` command.
-pub(crate) struct SetSystemInfo<'a> {
-    pdev: &'a pci::Device<device::Bound>,
-    chipset: Chipset,
-    vgpu_state: VgpuState,
-}
-
-impl<'a> SetSystemInfo<'a> {
-    /// Creates a new `GspSetSystemInfo` command using the parameters of `pdev`.
-    pub(crate) fn new(
-        pdev: &'a pci::Device<device::Bound>,
-        chipset: Chipset,
-        vgpu_state: VgpuState,
-    ) -> Self {
-        Self {
-            pdev,
-            chipset,
-            vgpu_state,
-        }
-    }
-}
-
-impl<'a> CommandToGsp for SetSystemInfo<'a> {
-    const FUNCTION: MsgFunction = MsgFunction::GspSetSystemInfo;
-    type Command = fw::commands::GspSetSystemInfo;
-    type Reply = NoReply;
-    type InitError = Error;
-
-    fn init(&self) -> impl Init<Self::Command, Self::InitError> {
-        Self::Command::init(self.pdev, self.chipset, self.vgpu_state)
-    }
-}
-
-struct RegistryEntry {
-    key: &'static str,
-    value: u32,
-}
-
-/// The `SetRegistry` command.
-pub(crate) struct SetRegistry {
-    entries: KVec<RegistryEntry>,
-}
-
-impl SetRegistry {
-    /// Creates a new `SetRegistry` command, using a set of hardcoded entries.
-    pub(crate) fn new(vgpu_state: VgpuState) -> Result<Self> {
-        let mut entries = KVec::new();
-
-        // RMSecBusResetEnable - enables PCI secondary bus reset
-        entries.push(
-            RegistryEntry {
-                key: "RMSecBusResetEnable",
-                value: 1,
-            },
-            GFP_KERNEL,
-        )?;
-
-        // RMForcePcieConfigSave - forces GSP-RM to preserve PCI configuration registers on
-        // any PCI reset.
-        entries.push(
-            RegistryEntry {
-                key: "RMForcePcieConfigSave",
-                value: 1,
-            },
-            GFP_KERNEL,
-        )?;
-
-        // RMDevidCheckIgnore - allows GSP-RM to boot even if the PCI dev ID is not found
-        // in the internal product name database.
-        entries.push(
-            RegistryEntry {
-                key: "RMDevidCheckIgnore",
-                value: 1,
-            },
-            GFP_KERNEL,
-        )?;
-
-        if matches!(vgpu_state, VgpuState::Enabled { .. }) {
-            // RMSetSriovMode - required when vGPU is enabled.
-            entries.push(
-                RegistryEntry {
-                    key: "RMSetSriovMode",
-                    value: 1,
-                },
-                GFP_KERNEL,
-            )?;
-        }
-
-        Ok(Self { entries })
-    }
-}
-
-impl CommandToGsp for SetRegistry {
-    const FUNCTION: MsgFunction = MsgFunction::SetRegistry;
-    type Command = fw::commands::PackedRegistryTable;
-    type Reply = NoReply;
-    type InitError = Infallible;
-
-    fn init(&self) -> impl Init<Self::Command, Self::InitError> {
-        Self::Command::init(self.entries.len() as u32, self.size() as u32)
-    }
-
-    fn variable_payload_len(&self) -> usize {
-        let mut key_size = 0;
-        for entry in self.entries.iter() {
-            key_size += entry.key.len() + 1; // +1 for NULL terminator
-        }
-        self.entries.len() * size_of::<fw::commands::PackedRegistryEntry>() + key_size
-    }
-
-    fn init_variable_payload(
-        &self,
-        dst: &mut SBufferIter<core::array::IntoIter<&mut [u8], 2>>,
-    ) -> Result {
-        let string_data_start_offset = size_of::<Self::Command>()
-            + self.entries.len() * size_of::<fw::commands::PackedRegistryEntry>();
-
-        // Array for string data.
-        let mut string_data = KVec::new();
-
-        for entry in self.entries.iter() {
-            dst.write_all(
-                fw::commands::PackedRegistryEntry::new(
-                    (string_data_start_offset + string_data.len()) as u32,
-                    entry.value,
-                )
-                .as_bytes(),
-            )?;
-
-            let key_bytes = entry.key.as_bytes();
-            string_data.extend_from_slice(key_bytes, GFP_KERNEL)?;
-            string_data.push(0, GFP_KERNEL)?;
-        }
-
-        dst.write_all(string_data.as_slice())
-    }
-}
-
-/// Message type for GSP initialization done notification.
-struct GspInitDone;
-
-// SAFETY: `GspInitDone` is a zero-sized type with no bytes, therefore it
-// trivially has no uninitialized bytes.
-unsafe impl FromBytes for GspInitDone {}
-
-impl MessageFromGsp for GspInitDone {
-    const FUNCTION: MsgFunction = MsgFunction::GspInitDone;
-    type InitError = Infallible;
-    type Message = ();
-
-    fn read(
-        _msg: &Self::Message,
-        _sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>,
-    ) -> Result<Self, Self::InitError> {
-        Ok(GspInitDone)
-    }
-}
-
-/// Waits for GSP initialization to complete.
-pub(crate) fn wait_gsp_init_done(cmdq: &Cmdq<'_>) -> Result {
-    cmdq.await_rpc_msg::<GspInitDone>().map(|_| ())
-}
-
-/// The `GetGspStaticInfo` command.
-pub(crate) struct GetGspStaticInfo;
-
-impl CommandToGsp for GetGspStaticInfo {
-    const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo;
-    type Command = fw::commands::GspStaticConfigInfo;
-    type Reply = GspStaticInfo;
-    type InitError = Infallible;
-
-    fn init(&self) -> impl Init<Self::Command, Self::InitError> {
-        Self::Command::init_zeroed()
-    }
-}
-
-impl MessageFromGsp for GspStaticInfo {
-    const FUNCTION: MsgFunction = MsgFunction::GetGspStaticInfo;
-    type Message = fw::commands::GspStaticConfigInfo;
-    type InitError = Error;
-
-    fn read(
-        msg: &Self::Message,
-        _sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>,
-    ) -> Result<Self, Self::InitError> {
-        let mut usable_fb_regions = KVec::new();
-        for region in msg.usable_fb_regions() {
-            usable_fb_regions.push(region, GFP_KERNEL)?;
-        }
-        let total_fb_end = msg.total_fb_end().ok_or(EINVAL)?;
-
-        Ok(GspStaticInfo {
-            gpu_name: msg.gpu_name_str(),
-            gpu_short_name: msg.gpu_short_name_str(),
-            gpu_gid: msg.gpu_gid(),
-            bar1_pde_base: msg.bar1_pde_base(),
-            usable_fb_regions,
-            total_fb_end,
-        })
-    }
-}
-
-/// The `UnloadingGuestDriver` command, used to shut down the GSP.
-///
-/// Only used within the `gsp` module.
-pub(crate) struct UnloadingGuestDriver {
-    level: PowerStateLevel,
-}
-
-impl UnloadingGuestDriver {
-    /// Creates a new `UnloadingGuestDriver` command for the given [`PowerStateLevel`].
-    pub(crate) fn new(level: PowerStateLevel) -> Self {
-        Self { level }
-    }
-}
-
-impl CommandToGsp for UnloadingGuestDriver {
-    const FUNCTION: MsgFunction = MsgFunction::UnloadingGuestDriver;
-    type Command = fw::commands::UnloadingGuestDriver;
-    type Reply = UnloadingGuestDriverReply;
-    type InitError = Infallible;
-
-    fn init(&self) -> impl Init<Self::Command, Self::InitError> {
-        fw::commands::UnloadingGuestDriver::new(self.level)
-    }
-}
-
-/// The reply from the GSP to the [`UnloadingGuestDriver`] command.
-pub(crate) struct UnloadingGuestDriverReply;
-
-impl MessageFromGsp for UnloadingGuestDriverReply {
-    const FUNCTION: MsgFunction = MsgFunction::UnloadingGuestDriver;
-    type InitError = Infallible;
-    type Message = ();
-
-    fn read(
-        _msg: &Self::Message,
-        _sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>,
-    ) -> Result<Self, Self::InitError> {
-        Ok(UnloadingGuestDriverReply)
-    }
-}
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index f83a04bc0816..f72b4c94efe6 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -11,11 +11,7 @@
     bitfield,
     device,
     pci,
-    prelude::*,
-    transmute::{
-        AsBytes,
-        FromBytes, //
-    }, //
+    prelude::*, //
 };
 
 use crate::{
@@ -32,230 +28,13 @@
             Required,
             TruncatingArray, //
         },
-        GSP_PAGE_SIZE, //
     },
-    num::IntoSafeCast,
     vgpu::VgpuState, //
 };
 
-use super::r570_144 as bindings;
+use super::bindings;
 
-/// Payload of the `GspSetSystemInfo` command.
-#[repr(transparent)]
-pub(crate) struct GspSetSystemInfo {
-    inner: bindings::GspSystemInfo,
-}
-static_assert!(size_of::<GspSetSystemInfo>() < GSP_PAGE_SIZE);
-
-impl GspSetSystemInfo {
-    /// Builds the VF topology passed to GSP-RM as part of the system information.
-    fn build_vf_info(
-        dev: &pci::Device<device::Bound>,
-        vgpu_state: VgpuState,
-    ) -> Result<bindings::GSP_VF_INFO> {
-        let VgpuState::Enabled { total_vfs } = vgpu_state else {
-            return Ok(Zeroable::zeroed());
-        };
-
-        let sriov = dev
-            .config_space_extended()?
-            .find_ext_capability::<pci::ExtSriovRegs>()?
-            .ok_or(ENODEV)?;
-
-        let mut vf_bars = sriov.vf_bars()?;
-        let bar0 = vf_bars.next().ok_or(EINVAL)?;
-        let bar1 = vf_bars.next().ok_or(EINVAL)?;
-        let bar2 = vf_bars.next().ok_or(EINVAL)?;
-
-        Ok(bindings::GSP_VF_INFO {
-            totalVFs: u32::from(total_vfs.get()),
-            firstVFOffset: u32::from(sriov.first_vf_offset()),
-            FirstVFBar0Address: bar0.address,
-            FirstVFBar1Address: bar1.address,
-            FirstVFBar2Address: bar2.address,
-            b64bitBar0: u8::from(bar0.is_64bit),
-            b64bitBar1: u8::from(bar1.is_64bit),
-            b64bitBar2: u8::from(bar2.is_64bit),
-            ..Zeroable::zeroed()
-        })
-    }
-
-    /// Returns an in-place initializer for the `GspSetSystemInfo` command.
-    pub(crate) fn init<'a>(
-        dev: &'a pci::Device<device::Bound>,
-        chipset: Chipset,
-        vgpu_state: VgpuState,
-    ) -> impl Init<Self, Error> + 'a {
-        type InnerGspSystemInfo = bindings::GspSystemInfo;
-        let pci_config_mirror_range = chipset.pci_config_mirror_range();
-        let init_inner = try_init!(InnerGspSystemInfo {
-            gpuPhysAddr: dev.resource_start(0)?,
-            gpuPhysFbAddr: dev.resource_start(1)?,
-            gpuPhysInstAddr: dev.resource_start(3)?,
-            nvDomainBusDeviceFunc: u64::from(DomainBusDevice::new(dev)),
-
-            // Using TASK_SIZE in r535_gsp_rpc_set_system_info() seems wrong because
-            // TASK_SIZE is per-task. That's probably a design issue in GSP-RM though.
-            maxUserVa: (1 << 47) - 4096,
-            pciConfigMirrorBase: pci_config_mirror_range.start,
-            pciConfigMirrorSize: pci_config_mirror_range.end - pci_config_mirror_range.start,
-
-            PCIDeviceID: (u32::from(dev.device_id()) << 16) | u32::from(dev.vendor_id().as_raw()),
-            PCISubDeviceID: (u32::from(dev.subsystem_device_id()) << 16)
-                | u32::from(dev.subsystem_vendor_id()),
-            PCIRevisionID: u32::from(dev.revision_id()),
-            bIsPrimary: 0,
-            bPreserveVideoMemoryAllocations: 0,
-            gspVFInfo: Self::build_vf_info(dev, vgpu_state)?,
-            ..Zeroable::init_zeroed()
-        });
-
-        try_init!(GspSetSystemInfo {
-            inner <- init_inner,
-        })
-    }
-}
-
-// SAFETY: These structs don't meet the no-padding requirements of AsBytes but
-//         that is not a problem because they are not used outside the kernel.
-unsafe impl AsBytes for GspSetSystemInfo {}
-
-// SAFETY: These structs don't meet the no-padding requirements of FromBytes but
-//         that is not a problem because they are not used outside the kernel.
-unsafe impl FromBytes for GspSetSystemInfo {}
-
-#[repr(transparent)]
-pub(crate) struct PackedRegistryEntry(bindings::PACKED_REGISTRY_ENTRY);
-
-impl PackedRegistryEntry {
-    pub(crate) fn new(offset: u32, value: u32) -> Self {
-        Self({
-            bindings::PACKED_REGISTRY_ENTRY {
-                nameOffset: offset,
-
-                // We only support DWORD types for now. Support for other types
-                // will come later if required.
-                type_: cv!(bindings::REGISTRY_TABLE_ENTRY_TYPE_DWORD),
-                __bindgen_padding_0: Default::default(),
-                data: value,
-                length: 0,
-            }
-        })
-    }
-}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for PackedRegistryEntry {}
-
-/// Payload of the `SetRegistry` command.
-#[repr(transparent)]
-pub(crate) struct PackedRegistryTable {
-    inner: bindings::PACKED_REGISTRY_TABLE,
-}
-
-impl PackedRegistryTable {
-    pub(crate) fn init(num_entries: u32, size: u32) -> impl Init<Self> {
-        type InnerPackedRegistryTable = bindings::PACKED_REGISTRY_TABLE;
-        let init_inner = init!(InnerPackedRegistryTable {
-            numEntries: num_entries,
-            size,
-            entries: Default::default()
-        });
-
-        init!(PackedRegistryTable { inner <- init_inner })
-    }
-}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for PackedRegistryTable {}
-
-// SAFETY: This struct only contains integer types for which all bit patterns
-// are valid.
-unsafe impl FromBytes for PackedRegistryTable {}
-
-/// Payload of the `GetGspStaticInfo` command and message.
-#[repr(transparent)]
-#[derive(Zeroable)]
-pub(crate) struct GspStaticConfigInfo(bindings::GspStaticConfigInfo_t);
-
-impl GspStaticConfigInfo {
-    /// Returns a bytes array containing the (hopefully) zero-terminated name of this GPU.
-    pub(crate) fn gpu_name_str(&self) -> [u8; GspStaticInfo::MAX_GPU_NAME_LEN] {
-        self.0.gpuNameString
-    }
-
-    /// Returns a bytes array containing the (hopefully) zero-terminated short name of this GPU.
-    pub(crate) fn gpu_short_name_str(&self) -> [u8; GspStaticInfo::MAX_GPU_NAME_LEN] {
-        self.0.gpuShortNameString
-    }
-
-    /// Returns the 16-byte SHA-1 GPU identifier supplied by GSP-RM.
-    ///
-    /// GSP-RM reports the GID in binary SHA-1 form, which occupies the first 16 bytes of the
-    /// GID info payload.
-    pub(crate) fn gpu_gid(&self) -> [u8; GspStaticInfo::GID_LEN] {
-        let mut gid = [0u8; GspStaticInfo::GID_LEN];
-        gid.copy_from_slice(&self.0.gidInfo.data[..GspStaticInfo::GID_LEN]);
-        gid
-    }
-
-    /// Returns the BAR1 Page Directory Entry base address.
-    ///
-    /// This is the root page table address for BAR1 virtual memory,
-    /// set up by GSP-RM firmware.
-    pub(crate) fn bar1_pde_base(&self) -> u64 {
-        self.0.bar1PdeBase
-    }
-
-    /// Returns an iterator over valid FB regions from GSP firmware data.
-    fn fb_regions(
-        &self,
-    ) -> impl Iterator<Item = &bindings::NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO> {
-        let fb_info = &self.0.fbRegionInfoParams;
-        fb_info
-            .fbRegion
-            .iter()
-            .take(fb_info.numFBRegions.into_safe_cast())
-            .filter(|reg| reg.limit >= reg.base)
-    }
-
-    /// Iterates over usable FB regions from GSP firmware data.
-    ///
-    /// Each yielded region is a [`Range<u64>`] suitable for driver memory allocation.
-    /// Usable regions are those that satisfy all the following properties:
-    /// - Are not reserved for firmware internal use.
-    /// - Are not protected (hardware-enforced access restrictions).
-    /// - Support compression (can use GPU memory compression for bandwidth).
-    /// - Support ISO (isochronous memory for display requiring guaranteed bandwidth).
-    pub(crate) fn usable_fb_regions(&self) -> impl Iterator<Item = Range<u64>> + '_ {
-        self.fb_regions().filter_map(|reg| {
-            // Filter: not reserved, not protected, supports compression and ISO.
-            if reg.reserved == 0
-                && reg.bProtected == 0
-                && reg.supportCompressed != 0
-                && reg.supportISO != 0
-            {
-                reg.limit.checked_add(1).map(|end| reg.base..end)
-            } else {
-                None
-            }
-        })
-    }
-
-    /// Computes the exclusive end of the FB physical address space.
-    pub(crate) fn total_fb_end(&self) -> Option<u64> {
-        self.fb_regions().map(|reg| reg.limit).max()?.checked_add(1)
-    }
-}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for GspStaticConfigInfo {}
-
-// SAFETY: This struct only contains integer types for which all bit patterns
-// are valid.
-unsafe impl FromBytes for GspStaticConfigInfo {}
-
-/// Power level requested to the [`UnloadingGuestDriver`] command.
+/// Power level that a `GSP_SUSPEND` request names.
 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
 #[repr(u32)]
 #[expect(unused)]
@@ -295,29 +74,6 @@ fn from(level: PowerStateLevel) -> Self {
     }
 }
 
-/// Payload of the `UnloadingGuestDriver` command and message.
-#[repr(transparent)]
-#[derive(Clone, Copy, Debug, Zeroable)]
-pub(crate) struct UnloadingGuestDriver(bindings::rpc_unloading_guest_driver_v1F_07);
-
-impl UnloadingGuestDriver {
-    pub(crate) fn new(level: PowerStateLevel) -> Self {
-        Self(bindings::rpc_unloading_guest_driver_v1F_07 {
-            bInPMTransition: u8::from(level.is_power_transition()),
-            bGc6Entering: 0,
-            newLevel: level as u32,
-            ..Zeroable::zeroed()
-        })
-    }
-}
-
-// SAFETY: Padding is explicit and will not contain uninitialized data.
-unsafe impl AsBytes for UnloadingGuestDriver {}
-
-// SAFETY: This struct only contains integer types for which all bit patterns
-// are valid.
-unsafe impl FromBytes for UnloadingGuestDriver {}
-
 /// The host CPU architecture.
 #[derive(Clone, Copy)]
 enum HostArch {

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 15/15] gpu: nova-core: firmware: delete the r570 bindings
  2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
                   ` (13 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH 14/15] gpu: nova-core: gsp: delete the r570 RPC commands Alexandre Courbot
@ 2026-12-03 12:09 ` Alexandre Courbot
  14 siblings, 0 replies; 19+ messages in thread
From: Alexandre Courbot @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel, Alexandre Courbot

From: John Hubbard <jhubbard@nvidia.com>

The driver no longer refers to the r570 bindings, but their module is
still declared, and its generated definitions are still compiled.

Delete the r570 bindings module, along with the last comment that names
r570.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Timur Tabi <ttabi@nvidia.com>
Reviewed-by: Zhi Wang <zhiw@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/fsp.rs                      |    3 +-
 drivers/gpu/nova-core/gsp/fw.rs                   |    1 -
 drivers/gpu/nova-core/gsp/fw/r570_144.rs          |   31 -
 drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs | 1060 ---------------------
 4 files changed, 2 insertions(+), 1093 deletions(-)

diff --git a/drivers/gpu/nova-core/fsp.rs b/drivers/gpu/nova-core/fsp.rs
index ea08cd58346f..5976a1730981 100644
--- a/drivers/gpu/nova-core/fsp.rs
+++ b/drivers/gpu/nova-core/fsp.rs
@@ -259,7 +259,8 @@ fn frts_vidmem_offset(hal: &dyn hal::FspHal, fb_info: &FbSizes) -> Result<u64> {
         // As per OpenRM's `kfspPrepareBootCommands_GH100`.
         if fb_info.pmu_reserved_size != 0 {
             offset = (offset + u64::from(fb_info.pmu_reserved_size))
-                // The 2 MiB alignment is r570-specific.
+                // This must be aligned to WPR alignment (128 KiB) and be at least 128 KiB in size.
+                // 2 MiB satisfies both.
                 .align_up(Alignment::SZ_2M)
                 .ok_or(EINVAL)?;
         }
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index c5ed5d47918a..48e0ea6aaea9 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -3,7 +3,6 @@
 
 pub(crate) mod commands;
 mod r000_00;
-mod r570_144;
 
 // Alias to avoid repeating the version number with every use.
 use r000_00 as bindings;
diff --git a/drivers/gpu/nova-core/gsp/fw/r570_144.rs b/drivers/gpu/nova-core/gsp/fw/r570_144.rs
deleted file mode 100644
index 2e6f0d298756..000000000000
--- a/drivers/gpu/nova-core/gsp/fw/r570_144.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-//! Firmware bindings.
-//!
-//! Imports the generated bindings by `bindgen`.
-//!
-//! This module may not be directly used. Please abstract or re-export the needed symbols in the
-//! parent module instead.
-
-#![allow(
-    dead_code,
-    clippy::all,
-    clippy::undocumented_unsafe_blocks,
-    clippy::ptr_as_ptr,
-    clippy::ref_as_ptr,
-    missing_docs,
-    non_camel_case_types,
-    non_upper_case_globals,
-    non_snake_case,
-    improper_ctypes,
-    unreachable_pub,
-    unsafe_op_in_unsafe_fn
-)]
-use kernel::ffi;
-use pin_init::MaybeZeroable;
-
-include!("r570_144/bindings.rs");
-
-// SAFETY: This type has a size of zero, so its inclusion into another type should not affect their
-// ability to implement `Zeroable`.
-unsafe impl<T> kernel::prelude::Zeroable for __IncompleteArrayField<T> {}
diff --git a/drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs b/drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs
deleted file mode 100644
index afe3e007f088..000000000000
--- a/drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs
+++ /dev/null
@@ -1,1060 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#[repr(C)]
-#[derive(Default)]
-pub struct __IncompleteArrayField<T>(::core::marker::PhantomData<T>, [T; 0]);
-impl<T> __IncompleteArrayField<T> {
-    #[inline]
-    pub const fn new() -> Self {
-        __IncompleteArrayField(::core::marker::PhantomData, [])
-    }
-    #[inline]
-    pub fn as_ptr(&self) -> *const T {
-        self as *const _ as *const T
-    }
-    #[inline]
-    pub fn as_mut_ptr(&mut self) -> *mut T {
-        self as *mut _ as *mut T
-    }
-    #[inline]
-    pub unsafe fn as_slice(&self, len: usize) -> &[T] {
-        ::core::slice::from_raw_parts(self.as_ptr(), len)
-    }
-    #[inline]
-    pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
-        ::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
-    }
-}
-impl<T> ::core::fmt::Debug for __IncompleteArrayField<T> {
-    fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
-        fmt.write_str("__IncompleteArrayField")
-    }
-}
-pub const NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_0: u32 = 0;
-pub const NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3: u32 = 3;
-pub const NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_7: u32 = 7;
-pub const NV_VGPU_MSG_SIGNATURE_VALID: u32 = 1129337430;
-pub const GSP_FW_HEAP_PARAM_OS_SIZE_LIBOS2: u32 = 0;
-pub const GSP_FW_HEAP_PARAM_OS_SIZE_LIBOS3_BAREMETAL: u32 = 23068672;
-pub const GSP_FW_HEAP_PARAM_BASE_RM_SIZE_TU10X: u32 = 8388608;
-pub const GSP_FW_HEAP_PARAM_BASE_RM_SIZE_GH100: u32 = 14680064;
-pub const GSP_FW_HEAP_PARAM_SIZE_PER_GB_FB: u32 = 98304;
-pub const GSP_FW_HEAP_PARAM_CLIENT_ALLOC_SIZE: u32 = 100663296;
-pub const GSP_FW_HEAP_SIZE_VGPU_DEFAULT: u32 = 609222656;
-pub const GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS2_MIN_MB: u32 = 64;
-pub const GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS2_MAX_MB: u32 = 256;
-pub const GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS3_BAREMETAL_MIN_MB: u32 = 88;
-pub const GSP_FW_HEAP_SIZE_OVERRIDE_LIBOS3_BAREMETAL_MAX_MB: u32 = 280;
-pub const GSP_FW_WPR_META_REVISION: u32 = 1;
-pub const GSP_FW_WPR_META_MAGIC: i64 = -2577556379034558285;
-pub const REGISTRY_TABLE_ENTRY_TYPE_DWORD: u32 = 1;
-pub const GSP_MSG_QUEUE_ELEMENT_SIZE_MAX: u32 = 65536;
-pub type __u8 = ffi::c_uchar;
-pub type __u16 = ffi::c_ushort;
-pub type __u32 = ffi::c_uint;
-pub type __u64 = ffi::c_ulonglong;
-pub type u8_ = __u8;
-pub type u16_ = __u16;
-pub type u32_ = __u32;
-pub type u64_ = __u64;
-pub const NV_VGPU_MSG_FUNCTION_NOP: _bindgen_ty_2 = 0;
-pub const NV_VGPU_MSG_FUNCTION_SET_GUEST_SYSTEM_INFO: _bindgen_ty_2 = 1;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_ROOT: _bindgen_ty_2 = 2;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_DEVICE: _bindgen_ty_2 = 3;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_MEMORY: _bindgen_ty_2 = 4;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_CTX_DMA: _bindgen_ty_2 = 5;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_CHANNEL_DMA: _bindgen_ty_2 = 6;
-pub const NV_VGPU_MSG_FUNCTION_MAP_MEMORY: _bindgen_ty_2 = 7;
-pub const NV_VGPU_MSG_FUNCTION_BIND_CTX_DMA: _bindgen_ty_2 = 8;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_OBJECT: _bindgen_ty_2 = 9;
-pub const NV_VGPU_MSG_FUNCTION_FREE: _bindgen_ty_2 = 10;
-pub const NV_VGPU_MSG_FUNCTION_LOG: _bindgen_ty_2 = 11;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_VIDMEM: _bindgen_ty_2 = 12;
-pub const NV_VGPU_MSG_FUNCTION_UNMAP_MEMORY: _bindgen_ty_2 = 13;
-pub const NV_VGPU_MSG_FUNCTION_MAP_MEMORY_DMA: _bindgen_ty_2 = 14;
-pub const NV_VGPU_MSG_FUNCTION_UNMAP_MEMORY_DMA: _bindgen_ty_2 = 15;
-pub const NV_VGPU_MSG_FUNCTION_GET_EDID: _bindgen_ty_2 = 16;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_DISP_CHANNEL: _bindgen_ty_2 = 17;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_DISP_OBJECT: _bindgen_ty_2 = 18;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_SUBDEVICE: _bindgen_ty_2 = 19;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_DYNAMIC_MEMORY: _bindgen_ty_2 = 20;
-pub const NV_VGPU_MSG_FUNCTION_DUP_OBJECT: _bindgen_ty_2 = 21;
-pub const NV_VGPU_MSG_FUNCTION_IDLE_CHANNELS: _bindgen_ty_2 = 22;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_EVENT: _bindgen_ty_2 = 23;
-pub const NV_VGPU_MSG_FUNCTION_SEND_EVENT: _bindgen_ty_2 = 24;
-pub const NV_VGPU_MSG_FUNCTION_REMAPPER_CONTROL: _bindgen_ty_2 = 25;
-pub const NV_VGPU_MSG_FUNCTION_DMA_CONTROL: _bindgen_ty_2 = 26;
-pub const NV_VGPU_MSG_FUNCTION_DMA_FILL_PTE_MEM: _bindgen_ty_2 = 27;
-pub const NV_VGPU_MSG_FUNCTION_MANAGE_HW_RESOURCE: _bindgen_ty_2 = 28;
-pub const NV_VGPU_MSG_FUNCTION_BIND_ARBITRARY_CTX_DMA: _bindgen_ty_2 = 29;
-pub const NV_VGPU_MSG_FUNCTION_CREATE_FB_SEGMENT: _bindgen_ty_2 = 30;
-pub const NV_VGPU_MSG_FUNCTION_DESTROY_FB_SEGMENT: _bindgen_ty_2 = 31;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_SHARE_DEVICE: _bindgen_ty_2 = 32;
-pub const NV_VGPU_MSG_FUNCTION_DEFERRED_API_CONTROL: _bindgen_ty_2 = 33;
-pub const NV_VGPU_MSG_FUNCTION_REMOVE_DEFERRED_API: _bindgen_ty_2 = 34;
-pub const NV_VGPU_MSG_FUNCTION_SIM_ESCAPE_READ: _bindgen_ty_2 = 35;
-pub const NV_VGPU_MSG_FUNCTION_SIM_ESCAPE_WRITE: _bindgen_ty_2 = 36;
-pub const NV_VGPU_MSG_FUNCTION_SIM_MANAGE_DISPLAY_CONTEXT_DMA: _bindgen_ty_2 = 37;
-pub const NV_VGPU_MSG_FUNCTION_FREE_VIDMEM_VIRT: _bindgen_ty_2 = 38;
-pub const NV_VGPU_MSG_FUNCTION_PERF_GET_PSTATE_INFO: _bindgen_ty_2 = 39;
-pub const NV_VGPU_MSG_FUNCTION_PERF_GET_PERFMON_SAMPLE: _bindgen_ty_2 = 40;
-pub const NV_VGPU_MSG_FUNCTION_PERF_GET_VIRTUAL_PSTATE_INFO: _bindgen_ty_2 = 41;
-pub const NV_VGPU_MSG_FUNCTION_PERF_GET_LEVEL_INFO: _bindgen_ty_2 = 42;
-pub const NV_VGPU_MSG_FUNCTION_MAP_SEMA_MEMORY: _bindgen_ty_2 = 43;
-pub const NV_VGPU_MSG_FUNCTION_UNMAP_SEMA_MEMORY: _bindgen_ty_2 = 44;
-pub const NV_VGPU_MSG_FUNCTION_SET_SURFACE_PROPERTIES: _bindgen_ty_2 = 45;
-pub const NV_VGPU_MSG_FUNCTION_CLEANUP_SURFACE: _bindgen_ty_2 = 46;
-pub const NV_VGPU_MSG_FUNCTION_UNLOADING_GUEST_DRIVER: _bindgen_ty_2 = 47;
-pub const NV_VGPU_MSG_FUNCTION_TDR_SET_TIMEOUT_STATE: _bindgen_ty_2 = 48;
-pub const NV_VGPU_MSG_FUNCTION_SWITCH_TO_VGA: _bindgen_ty_2 = 49;
-pub const NV_VGPU_MSG_FUNCTION_GPU_EXEC_REG_OPS: _bindgen_ty_2 = 50;
-pub const NV_VGPU_MSG_FUNCTION_GET_STATIC_INFO: _bindgen_ty_2 = 51;
-pub const NV_VGPU_MSG_FUNCTION_ALLOC_VIRTMEM: _bindgen_ty_2 = 52;
-pub const NV_VGPU_MSG_FUNCTION_UPDATE_PDE_2: _bindgen_ty_2 = 53;
-pub const NV_VGPU_MSG_FUNCTION_SET_PAGE_DIRECTORY: _bindgen_ty_2 = 54;
-pub const NV_VGPU_MSG_FUNCTION_GET_STATIC_PSTATE_INFO: _bindgen_ty_2 = 55;
-pub const NV_VGPU_MSG_FUNCTION_TRANSLATE_GUEST_GPU_PTES: _bindgen_ty_2 = 56;
-pub const NV_VGPU_MSG_FUNCTION_RESERVED_57: _bindgen_ty_2 = 57;
-pub const NV_VGPU_MSG_FUNCTION_RESET_CURRENT_GR_CONTEXT: _bindgen_ty_2 = 58;
-pub const NV_VGPU_MSG_FUNCTION_SET_SEMA_MEM_VALIDATION_STATE: _bindgen_ty_2 = 59;
-pub const NV_VGPU_MSG_FUNCTION_GET_ENGINE_UTILIZATION: _bindgen_ty_2 = 60;
-pub const NV_VGPU_MSG_FUNCTION_UPDATE_GPU_PDES: _bindgen_ty_2 = 61;
-pub const NV_VGPU_MSG_FUNCTION_GET_ENCODER_CAPACITY: _bindgen_ty_2 = 62;
-pub const NV_VGPU_MSG_FUNCTION_VGPU_PF_REG_READ32: _bindgen_ty_2 = 63;
-pub const NV_VGPU_MSG_FUNCTION_SET_GUEST_SYSTEM_INFO_EXT: _bindgen_ty_2 = 64;
-pub const NV_VGPU_MSG_FUNCTION_GET_GSP_STATIC_INFO: _bindgen_ty_2 = 65;
-pub const NV_VGPU_MSG_FUNCTION_RMFS_INIT: _bindgen_ty_2 = 66;
-pub const NV_VGPU_MSG_FUNCTION_RMFS_CLOSE_QUEUE: _bindgen_ty_2 = 67;
-pub const NV_VGPU_MSG_FUNCTION_RMFS_CLEANUP: _bindgen_ty_2 = 68;
-pub const NV_VGPU_MSG_FUNCTION_RMFS_TEST: _bindgen_ty_2 = 69;
-pub const NV_VGPU_MSG_FUNCTION_UPDATE_BAR_PDE: _bindgen_ty_2 = 70;
-pub const NV_VGPU_MSG_FUNCTION_CONTINUATION_RECORD: _bindgen_ty_2 = 71;
-pub const NV_VGPU_MSG_FUNCTION_GSP_SET_SYSTEM_INFO: _bindgen_ty_2 = 72;
-pub const NV_VGPU_MSG_FUNCTION_SET_REGISTRY: _bindgen_ty_2 = 73;
-pub const NV_VGPU_MSG_FUNCTION_GSP_INIT_POST_OBJGPU: _bindgen_ty_2 = 74;
-pub const NV_VGPU_MSG_FUNCTION_SUBDEV_EVENT_SET_NOTIFICATION: _bindgen_ty_2 = 75;
-pub const NV_VGPU_MSG_FUNCTION_GSP_RM_CONTROL: _bindgen_ty_2 = 76;
-pub const NV_VGPU_MSG_FUNCTION_GET_STATIC_INFO2: _bindgen_ty_2 = 77;
-pub const NV_VGPU_MSG_FUNCTION_DUMP_PROTOBUF_COMPONENT: _bindgen_ty_2 = 78;
-pub const NV_VGPU_MSG_FUNCTION_UNSET_PAGE_DIRECTORY: _bindgen_ty_2 = 79;
-pub const NV_VGPU_MSG_FUNCTION_GET_CONSOLIDATED_STATIC_INFO: _bindgen_ty_2 = 80;
-pub const NV_VGPU_MSG_FUNCTION_GMMU_REGISTER_FAULT_BUFFER: _bindgen_ty_2 = 81;
-pub const NV_VGPU_MSG_FUNCTION_GMMU_UNREGISTER_FAULT_BUFFER: _bindgen_ty_2 = 82;
-pub const NV_VGPU_MSG_FUNCTION_GMMU_REGISTER_CLIENT_SHADOW_FAULT_BUFFER: _bindgen_ty_2 = 83;
-pub const NV_VGPU_MSG_FUNCTION_GMMU_UNREGISTER_CLIENT_SHADOW_FAULT_BUFFER: _bindgen_ty_2 = 84;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SET_VGPU_FB_USAGE: _bindgen_ty_2 = 85;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_NVFBC_SW_SESSION_UPDATE_INFO: _bindgen_ty_2 = 86;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_NVENC_SW_SESSION_UPDATE_INFO: _bindgen_ty_2 = 87;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_RESET_CHANNEL: _bindgen_ty_2 = 88;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_RESET_ISOLATED_CHANNEL: _bindgen_ty_2 = 89;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPU_HANDLE_VF_PRI_FAULT: _bindgen_ty_2 = 90;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_CLK_GET_EXTENDED_INFO: _bindgen_ty_2 = 91;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_PERF_BOOST: _bindgen_ty_2 = 92;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_PERF_VPSTATES_GET_CONTROL: _bindgen_ty_2 = 93;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_ZBC_CLEAR_TABLE: _bindgen_ty_2 = 94;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SET_ZBC_COLOR_CLEAR: _bindgen_ty_2 = 95;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SET_ZBC_DEPTH_CLEAR: _bindgen_ty_2 = 96;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPFIFO_SCHEDULE: _bindgen_ty_2 = 97;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SET_TIMESLICE: _bindgen_ty_2 = 98;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_PREEMPT: _bindgen_ty_2 = 99;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FIFO_DISABLE_CHANNELS: _bindgen_ty_2 = 100;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SET_TSG_INTERLEAVE_LEVEL: _bindgen_ty_2 = 101;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SET_CHANNEL_INTERLEAVE_LEVEL: _bindgen_ty_2 = 102;
-pub const NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC: _bindgen_ty_2 = 103;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_P2P_CAPS_V2: _bindgen_ty_2 = 104;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_CIPHER_AES_ENCRYPT: _bindgen_ty_2 = 105;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_CIPHER_SESSION_KEY: _bindgen_ty_2 = 106;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_CIPHER_SESSION_KEY_STATUS: _bindgen_ty_2 = 107;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_CLEAR_ALL_SM_ERROR_STATES: _bindgen_ty_2 = 108;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_READ_ALL_SM_ERROR_STATES: _bindgen_ty_2 = 109;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_SET_EXCEPTION_MASK: _bindgen_ty_2 = 110;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPU_PROMOTE_CTX: _bindgen_ty_2 = 111;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GR_CTXSW_PREEMPTION_BIND: _bindgen_ty_2 = 112;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GR_SET_CTXSW_PREEMPTION_MODE: _bindgen_ty_2 = 113;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GR_CTXSW_ZCULL_BIND: _bindgen_ty_2 = 114;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPU_INITIALIZE_CTX: _bindgen_ty_2 = 115;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_VASPACE_COPY_SERVER_RESERVED_PDES: _bindgen_ty_2 = 116;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FIFO_CLEAR_FAULTED_BIT: _bindgen_ty_2 = 117;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_LATEST_ECC_ADDRESSES: _bindgen_ty_2 = 118;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_MC_SERVICE_INTERRUPTS: _bindgen_ty_2 = 119;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DMA_SET_DEFAULT_VASPACE: _bindgen_ty_2 = 120;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_CE_PCE_MASK: _bindgen_ty_2 = 121;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_ZBC_CLEAR_TABLE_ENTRY: _bindgen_ty_2 = 122;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_NVLINK_PEER_ID_MASK: _bindgen_ty_2 = 123;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_NVLINK_STATUS: _bindgen_ty_2 = 124;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_P2P_CAPS: _bindgen_ty_2 = 125;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_P2P_CAPS_MATRIX: _bindgen_ty_2 = 126;
-pub const NV_VGPU_MSG_FUNCTION_RESERVED_0: _bindgen_ty_2 = 127;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_RESERVE_PM_AREA_SMPC: _bindgen_ty_2 = 128;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_RESERVE_HWPM_LEGACY: _bindgen_ty_2 = 129;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_B0CC_EXEC_REG_OPS: _bindgen_ty_2 = 130;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_BIND_PM_RESOURCES: _bindgen_ty_2 = 131;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_SUSPEND_CONTEXT: _bindgen_ty_2 = 132;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_RESUME_CONTEXT: _bindgen_ty_2 = 133;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_EXEC_REG_OPS: _bindgen_ty_2 = 134;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_SET_MODE_MMU_DEBUG: _bindgen_ty_2 = 135;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_READ_SINGLE_SM_ERROR_STATE: _bindgen_ty_2 = 136;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_CLEAR_SINGLE_SM_ERROR_STATE: _bindgen_ty_2 = 137;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_SET_MODE_ERRBAR_DEBUG: _bindgen_ty_2 = 138;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_SET_NEXT_STOP_TRIGGER_TYPE: _bindgen_ty_2 = 139;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_ALLOC_PMA_STREAM: _bindgen_ty_2 = 140;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_PMA_STREAM_UPDATE_GET_PUT: _bindgen_ty_2 = 141;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FB_GET_INFO_V2: _bindgen_ty_2 = 142;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FIFO_SET_CHANNEL_PROPERTIES: _bindgen_ty_2 = 143;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GR_GET_CTX_BUFFER_INFO: _bindgen_ty_2 = 144;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_KGR_GET_CTX_BUFFER_PTES: _bindgen_ty_2 = 145;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPU_EVICT_CTX: _bindgen_ty_2 = 146;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FB_GET_FS_INFO: _bindgen_ty_2 = 147;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GRMGR_GET_GR_FS_INFO: _bindgen_ty_2 = 148;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_STOP_CHANNEL: _bindgen_ty_2 = 149;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GR_PC_SAMPLING_MODE: _bindgen_ty_2 = 150;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_PERF_RATED_TDP_GET_STATUS: _bindgen_ty_2 = 151;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_PERF_RATED_TDP_SET_CONTROL: _bindgen_ty_2 = 152;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FREE_PMA_STREAM: _bindgen_ty_2 = 153;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_TIMER_SET_GR_TICK_FREQ: _bindgen_ty_2 = 154;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FIFO_SETUP_VF_ZOMBIE_SUBCTX_PDB: _bindgen_ty_2 = 155;
-pub const NV_VGPU_MSG_FUNCTION_GET_CONSOLIDATED_GR_STATIC_INFO: _bindgen_ty_2 = 156;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_SET_SINGLE_SM_SINGLE_STEP: _bindgen_ty_2 = 157;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GR_GET_TPC_PARTITION_MODE: _bindgen_ty_2 = 158;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GR_SET_TPC_PARTITION_MODE: _bindgen_ty_2 = 159;
-pub const NV_VGPU_MSG_FUNCTION_UVM_PAGING_CHANNEL_ALLOCATE: _bindgen_ty_2 = 160;
-pub const NV_VGPU_MSG_FUNCTION_UVM_PAGING_CHANNEL_DESTROY: _bindgen_ty_2 = 161;
-pub const NV_VGPU_MSG_FUNCTION_UVM_PAGING_CHANNEL_MAP: _bindgen_ty_2 = 162;
-pub const NV_VGPU_MSG_FUNCTION_UVM_PAGING_CHANNEL_UNMAP: _bindgen_ty_2 = 163;
-pub const NV_VGPU_MSG_FUNCTION_UVM_PAGING_CHANNEL_PUSH_STREAM: _bindgen_ty_2 = 164;
-pub const NV_VGPU_MSG_FUNCTION_UVM_PAGING_CHANNEL_SET_HANDLES: _bindgen_ty_2 = 165;
-pub const NV_VGPU_MSG_FUNCTION_UVM_METHOD_STREAM_GUEST_PAGES_OPERATION: _bindgen_ty_2 = 166;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_INTERNAL_QUIESCE_PMA_CHANNEL: _bindgen_ty_2 = 167;
-pub const NV_VGPU_MSG_FUNCTION_DCE_RM_INIT: _bindgen_ty_2 = 168;
-pub const NV_VGPU_MSG_FUNCTION_REGISTER_VIRTUAL_EVENT_BUFFER: _bindgen_ty_2 = 169;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_EVENT_BUFFER_UPDATE_GET: _bindgen_ty_2 = 170;
-pub const NV_VGPU_MSG_FUNCTION_GET_PLCABLE_ADDRESS_KIND: _bindgen_ty_2 = 171;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_PERF_LIMITS_SET_STATUS_V2: _bindgen_ty_2 = 172;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_INTERNAL_SRIOV_PROMOTE_PMA_STREAM: _bindgen_ty_2 = 173;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_MMU_DEBUG_MODE: _bindgen_ty_2 = 174;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_INTERNAL_PROMOTE_FAULT_METHOD_BUFFERS: _bindgen_ty_2 = 175;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FLCN_GET_CTX_BUFFER_SIZE: _bindgen_ty_2 = 176;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FLCN_GET_CTX_BUFFER_INFO: _bindgen_ty_2 = 177;
-pub const NV_VGPU_MSG_FUNCTION_DISABLE_CHANNELS: _bindgen_ty_2 = 178;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FABRIC_MEMORY_DESCRIBE: _bindgen_ty_2 = 179;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FABRIC_MEM_STATS: _bindgen_ty_2 = 180;
-pub const NV_VGPU_MSG_FUNCTION_SAVE_HIBERNATION_DATA: _bindgen_ty_2 = 181;
-pub const NV_VGPU_MSG_FUNCTION_RESTORE_HIBERNATION_DATA: _bindgen_ty_2 = 182;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_INTERNAL_MEMSYS_SET_ZBC_REFERENCED: _bindgen_ty_2 = 183;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_EXEC_PARTITIONS_CREATE: _bindgen_ty_2 = 184;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_EXEC_PARTITIONS_DELETE: _bindgen_ty_2 = 185;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPFIFO_GET_WORK_SUBMIT_TOKEN: _bindgen_ty_2 = 186;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPFIFO_SET_WORK_SUBMIT_TOKEN_NOTIF_INDEX: _bindgen_ty_2 = 187;
-pub const NV_VGPU_MSG_FUNCTION_PMA_SCRUBBER_SHARED_BUFFER_GUEST_PAGES_OPERATION: _bindgen_ty_2 =
-    188;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_MASTER_GET_VIRTUAL_FUNCTION_ERROR_CONT_INTR_MASK:
-    _bindgen_ty_2 = 189;
-pub const NV_VGPU_MSG_FUNCTION_SET_SYSMEM_DIRTY_PAGE_TRACKING_BUFFER: _bindgen_ty_2 = 190;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SUBDEVICE_GET_P2P_CAPS: _bindgen_ty_2 = 191;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_BUS_SET_P2P_MAPPING: _bindgen_ty_2 = 192;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_BUS_UNSET_P2P_MAPPING: _bindgen_ty_2 = 193;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_FLA_SETUP_INSTANCE_MEM_BLOCK: _bindgen_ty_2 = 194;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPU_MIGRATABLE_OPS: _bindgen_ty_2 = 195;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_TOTAL_HS_CREDITS: _bindgen_ty_2 = 196;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GET_HS_CREDITS: _bindgen_ty_2 = 197;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SET_HS_CREDITS: _bindgen_ty_2 = 198;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_PM_AREA_PC_SAMPLER: _bindgen_ty_2 = 199;
-pub const NV_VGPU_MSG_FUNCTION_INVALIDATE_TLB: _bindgen_ty_2 = 200;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPU_QUERY_ECC_STATUS: _bindgen_ty_2 = 201;
-pub const NV_VGPU_MSG_FUNCTION_ECC_NOTIFIER_WRITE_ACK: _bindgen_ty_2 = 202;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_GET_MODE_MMU_DEBUG: _bindgen_ty_2 = 203;
-pub const NV_VGPU_MSG_FUNCTION_RM_API_CONTROL: _bindgen_ty_2 = 204;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_CMD_INTERNAL_GPU_START_FABRIC_PROBE: _bindgen_ty_2 = 205;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_NVLINK_GET_INBAND_RECEIVED_DATA: _bindgen_ty_2 = 206;
-pub const NV_VGPU_MSG_FUNCTION_GET_STATIC_DATA: _bindgen_ty_2 = 207;
-pub const NV_VGPU_MSG_FUNCTION_RESERVED_208: _bindgen_ty_2 = 208;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_GPU_GET_INFO_V2: _bindgen_ty_2 = 209;
-pub const NV_VGPU_MSG_FUNCTION_GET_BRAND_CAPS: _bindgen_ty_2 = 210;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_CMD_NVLINK_INBAND_SEND_DATA: _bindgen_ty_2 = 211;
-pub const NV_VGPU_MSG_FUNCTION_UPDATE_GPM_GUEST_BUFFER_INFO: _bindgen_ty_2 = 212;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_CMD_INTERNAL_CONTROL_GSP_TRACE: _bindgen_ty_2 = 213;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SET_ZBC_STENCIL_CLEAR: _bindgen_ty_2 = 214;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SUBDEVICE_GET_VGPU_HEAP_STATS: _bindgen_ty_2 = 215;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_SUBDEVICE_GET_LIBOS_HEAP_STATS: _bindgen_ty_2 = 216;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_SET_MODE_MMU_GCC_DEBUG: _bindgen_ty_2 = 217;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_DBG_GET_MODE_MMU_GCC_DEBUG: _bindgen_ty_2 = 218;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_RESERVE_HES: _bindgen_ty_2 = 219;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_RELEASE_HES: _bindgen_ty_2 = 220;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_RESERVE_CCU_PROF: _bindgen_ty_2 = 221;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_RELEASE_CCU_PROF: _bindgen_ty_2 = 222;
-pub const NV_VGPU_MSG_FUNCTION_RESERVED: _bindgen_ty_2 = 223;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_CMD_GET_CHIPLET_HS_CREDIT_POOL: _bindgen_ty_2 = 224;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_CMD_GET_HS_CREDITS_MAPPING: _bindgen_ty_2 = 225;
-pub const NV_VGPU_MSG_FUNCTION_CTRL_EXEC_PARTITIONS_EXPORT: _bindgen_ty_2 = 226;
-pub const NV_VGPU_MSG_FUNCTION_NUM_FUNCTIONS: _bindgen_ty_2 = 227;
-pub type _bindgen_ty_2 = ffi::c_uint;
-pub const NV_VGPU_MSG_EVENT_FIRST_EVENT: _bindgen_ty_3 = 4096;
-pub const NV_VGPU_MSG_EVENT_GSP_INIT_DONE: _bindgen_ty_3 = 4097;
-pub const NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER: _bindgen_ty_3 = 4098;
-pub const NV_VGPU_MSG_EVENT_POST_EVENT: _bindgen_ty_3 = 4099;
-pub const NV_VGPU_MSG_EVENT_RC_TRIGGERED: _bindgen_ty_3 = 4100;
-pub const NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED: _bindgen_ty_3 = 4101;
-pub const NV_VGPU_MSG_EVENT_OS_ERROR_LOG: _bindgen_ty_3 = 4102;
-pub const NV_VGPU_MSG_EVENT_RG_LINE_INTR: _bindgen_ty_3 = 4103;
-pub const NV_VGPU_MSG_EVENT_GPUACCT_PERFMON_UTIL_SAMPLES: _bindgen_ty_3 = 4104;
-pub const NV_VGPU_MSG_EVENT_SIM_READ: _bindgen_ty_3 = 4105;
-pub const NV_VGPU_MSG_EVENT_SIM_WRITE: _bindgen_ty_3 = 4106;
-pub const NV_VGPU_MSG_EVENT_SEMAPHORE_SCHEDULE_CALLBACK: _bindgen_ty_3 = 4107;
-pub const NV_VGPU_MSG_EVENT_UCODE_LIBOS_PRINT: _bindgen_ty_3 = 4108;
-pub const NV_VGPU_MSG_EVENT_VGPU_GSP_PLUGIN_TRIGGERED: _bindgen_ty_3 = 4109;
-pub const NV_VGPU_MSG_EVENT_PERF_GPU_BOOST_SYNC_LIMITS_CALLBACK: _bindgen_ty_3 = 4110;
-pub const NV_VGPU_MSG_EVENT_PERF_BRIDGELESS_INFO_UPDATE: _bindgen_ty_3 = 4111;
-pub const NV_VGPU_MSG_EVENT_VGPU_CONFIG: _bindgen_ty_3 = 4112;
-pub const NV_VGPU_MSG_EVENT_DISPLAY_MODESET: _bindgen_ty_3 = 4113;
-pub const NV_VGPU_MSG_EVENT_EXTDEV_INTR_SERVICE: _bindgen_ty_3 = 4114;
-pub const NV_VGPU_MSG_EVENT_NVLINK_INBAND_RECEIVED_DATA_256: _bindgen_ty_3 = 4115;
-pub const NV_VGPU_MSG_EVENT_NVLINK_INBAND_RECEIVED_DATA_512: _bindgen_ty_3 = 4116;
-pub const NV_VGPU_MSG_EVENT_NVLINK_INBAND_RECEIVED_DATA_1024: _bindgen_ty_3 = 4117;
-pub const NV_VGPU_MSG_EVENT_NVLINK_INBAND_RECEIVED_DATA_2048: _bindgen_ty_3 = 4118;
-pub const NV_VGPU_MSG_EVENT_NVLINK_INBAND_RECEIVED_DATA_4096: _bindgen_ty_3 = 4119;
-pub const NV_VGPU_MSG_EVENT_TIMED_SEMAPHORE_RELEASE: _bindgen_ty_3 = 4120;
-pub const NV_VGPU_MSG_EVENT_NVLINK_IS_GPU_DEGRADED: _bindgen_ty_3 = 4121;
-pub const NV_VGPU_MSG_EVENT_PFM_REQ_HNDLR_STATE_SYNC_CALLBACK: _bindgen_ty_3 = 4122;
-pub const NV_VGPU_MSG_EVENT_NVLINK_FAULT_UP: _bindgen_ty_3 = 4123;
-pub const NV_VGPU_MSG_EVENT_GSP_LOCKDOWN_NOTICE: _bindgen_ty_3 = 4124;
-pub const NV_VGPU_MSG_EVENT_MIG_CI_CONFIG_UPDATE: _bindgen_ty_3 = 4125;
-pub const NV_VGPU_MSG_EVENT_UPDATE_GSP_TRACE: _bindgen_ty_3 = 4126;
-pub const NV_VGPU_MSG_EVENT_NVLINK_FATAL_ERROR_RECOVERY: _bindgen_ty_3 = 4127;
-pub const NV_VGPU_MSG_EVENT_GSP_POST_NOCAT_RECORD: _bindgen_ty_3 = 4128;
-pub const NV_VGPU_MSG_EVENT_FECS_ERROR: _bindgen_ty_3 = 4129;
-pub const NV_VGPU_MSG_EVENT_RECOVERY_ACTION: _bindgen_ty_3 = 4130;
-pub const NV_VGPU_MSG_EVENT_NUM_EVENTS: _bindgen_ty_3 = 4131;
-pub type _bindgen_ty_3 = ffi::c_uint;
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct NV0080_CTRL_GPU_GET_SRIOV_CAPS_PARAMS {
-    pub totalVFs: u32_,
-    pub firstVfOffset: u32_,
-    pub vfFeatureMask: u32_,
-    pub __bindgen_padding_0: [u8; 4usize],
-    pub FirstVFBar0Address: u64_,
-    pub FirstVFBar1Address: u64_,
-    pub FirstVFBar2Address: u64_,
-    pub bar0Size: u64_,
-    pub bar1Size: u64_,
-    pub bar2Size: u64_,
-    pub b64bitBar0: u8_,
-    pub b64bitBar1: u8_,
-    pub b64bitBar2: u8_,
-    pub bSriovEnabled: u8_,
-    pub bSriovHeavyEnabled: u8_,
-    pub bEmulateVFBar0TlbInvalidationRegister: u8_,
-    pub bClientRmAllocatedCtxBuffer: u8_,
-    pub bNonPowerOf2ChannelCountSupported: u8_,
-    pub bVfResizableBAR1Supported: u8_,
-    pub __bindgen_padding_1: [u8; 7usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct NV2080_CTRL_BIOS_GET_SKU_INFO_PARAMS {
-    pub BoardID: u32_,
-    pub chipSKU: [ffi::c_char; 9usize],
-    pub chipSKUMod: [ffi::c_char; 5usize],
-    pub __bindgen_padding_0: [u8; 2usize],
-    pub skuConfigVersion: u32_,
-    pub project: [ffi::c_char; 5usize],
-    pub projectSKU: [ffi::c_char; 5usize],
-    pub CDP: [ffi::c_char; 6usize],
-    pub projectSKUMod: [ffi::c_char; 2usize],
-    pub __bindgen_padding_1: [u8; 2usize],
-    pub businessCycle: u32_,
-}
-pub type NV2080_CTRL_CMD_FB_GET_FB_REGION_SURFACE_MEM_TYPE_FLAG = [u8_; 17usize];
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO {
-    pub base: u64_,
-    pub limit: u64_,
-    pub reserved: u64_,
-    pub performance: u32_,
-    pub supportCompressed: u8_,
-    pub supportISO: u8_,
-    pub bProtected: u8_,
-    pub blackList: NV2080_CTRL_CMD_FB_GET_FB_REGION_SURFACE_MEM_TYPE_FLAG,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_PARAMS {
-    pub numFBRegions: u32_,
-    pub __bindgen_padding_0: [u8; 4usize],
-    pub fbRegion: [NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO; 16usize],
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone, MaybeZeroable)]
-pub struct NV2080_CTRL_GPU_GET_GID_INFO_PARAMS {
-    pub index: u32_,
-    pub flags: u32_,
-    pub length: u32_,
-    pub data: [u8_; 256usize],
-}
-impl Default for NV2080_CTRL_GPU_GET_GID_INFO_PARAMS {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct DOD_METHOD_DATA {
-    pub status: u32_,
-    pub acpiIdListLen: u32_,
-    pub acpiIdList: [u32_; 16usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct JT_METHOD_DATA {
-    pub status: u32_,
-    pub jtCaps: u32_,
-    pub jtRevId: u16_,
-    pub bSBIOSCaps: u8_,
-    pub __bindgen_padding_0: u8,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct MUX_METHOD_DATA_ELEMENT {
-    pub acpiId: u32_,
-    pub mode: u32_,
-    pub status: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct MUX_METHOD_DATA {
-    pub tableLen: u32_,
-    pub acpiIdMuxModeTable: [MUX_METHOD_DATA_ELEMENT; 16usize],
-    pub acpiIdMuxPartTable: [MUX_METHOD_DATA_ELEMENT; 16usize],
-    pub acpiIdMuxStateTable: [MUX_METHOD_DATA_ELEMENT; 16usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct CAPS_METHOD_DATA {
-    pub status: u32_,
-    pub optimusCaps: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct ACPI_METHOD_DATA {
-    pub bValid: u8_,
-    pub __bindgen_padding_0: [u8; 3usize],
-    pub dodMethodData: DOD_METHOD_DATA,
-    pub jtMethodData: JT_METHOD_DATA,
-    pub muxMethodData: MUX_METHOD_DATA,
-    pub capsMethodData: CAPS_METHOD_DATA,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct VIRTUAL_DISPLAY_GET_MAX_RESOLUTION_PARAMS {
-    pub headIndex: u32_,
-    pub maxHResolution: u32_,
-    pub maxVResolution: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct VIRTUAL_DISPLAY_GET_NUM_HEADS_PARAMS {
-    pub numHeads: u32_,
-    pub maxNumHeads: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct BUSINFO {
-    pub deviceID: u16_,
-    pub vendorID: u16_,
-    pub subdeviceID: u16_,
-    pub subvendorID: u16_,
-    pub revisionID: u8_,
-    pub __bindgen_padding_0: u8,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_VF_INFO {
-    pub totalVFs: u32_,
-    pub firstVFOffset: u32_,
-    pub FirstVFBar0Address: u64_,
-    pub FirstVFBar1Address: u64_,
-    pub FirstVFBar2Address: u64_,
-    pub b64bitBar0: u8_,
-    pub b64bitBar1: u8_,
-    pub b64bitBar2: u8_,
-    pub __bindgen_padding_0: [u8; 5usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_PCIE_CONFIG_REG {
-    pub linkCap: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct EcidManufacturingInfo {
-    pub ecidLow: u32_,
-    pub ecidHigh: u32_,
-    pub ecidExtended: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct FW_WPR_LAYOUT_OFFSET {
-    pub nonWprHeapOffset: u64_,
-    pub frtsOffset: u64_,
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone, MaybeZeroable)]
-pub struct GspStaticConfigInfo_t {
-    pub grCapsBits: [u8_; 23usize],
-    pub __bindgen_padding_0: u8,
-    pub gidInfo: NV2080_CTRL_GPU_GET_GID_INFO_PARAMS,
-    pub SKUInfo: NV2080_CTRL_BIOS_GET_SKU_INFO_PARAMS,
-    pub __bindgen_padding_1: [u8; 4usize],
-    pub fbRegionInfoParams: NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_PARAMS,
-    pub sriovCaps: NV0080_CTRL_GPU_GET_SRIOV_CAPS_PARAMS,
-    pub sriovMaxGfid: u32_,
-    pub engineCaps: [u32_; 3usize],
-    pub poisonFuseEnabled: u8_,
-    pub __bindgen_padding_2: [u8; 7usize],
-    pub fb_length: u64_,
-    pub fbio_mask: u64_,
-    pub fb_bus_width: u32_,
-    pub fb_ram_type: u32_,
-    pub fbp_mask: u64_,
-    pub l2_cache_size: u32_,
-    pub gpuNameString: [u8_; 64usize],
-    pub gpuShortNameString: [u8_; 64usize],
-    pub gpuNameString_Unicode: [u16_; 64usize],
-    pub bGpuInternalSku: u8_,
-    pub bIsQuadroGeneric: u8_,
-    pub bIsQuadroAd: u8_,
-    pub bIsNvidiaNvs: u8_,
-    pub bIsVgx: u8_,
-    pub bGeforceSmb: u8_,
-    pub bIsTitan: u8_,
-    pub bIsTesla: u8_,
-    pub bIsMobile: u8_,
-    pub bIsGc6Rtd3Allowed: u8_,
-    pub bIsGc8Rtd3Allowed: u8_,
-    pub bIsGcOffRtd3Allowed: u8_,
-    pub bIsGcoffLegacyAllowed: u8_,
-    pub bIsMigSupported: u8_,
-    pub RTD3GC6TotalBoardPower: u16_,
-    pub RTD3GC6PerstDelay: u16_,
-    pub __bindgen_padding_3: [u8; 2usize],
-    pub bar1PdeBase: u64_,
-    pub bar2PdeBase: u64_,
-    pub bVbiosValid: u8_,
-    pub __bindgen_padding_4: [u8; 3usize],
-    pub vbiosSubVendor: u32_,
-    pub vbiosSubDevice: u32_,
-    pub bPageRetirementSupported: u8_,
-    pub bSplitVasBetweenServerClientRm: u8_,
-    pub bClRootportNeedsNosnoopWAR: u8_,
-    pub __bindgen_padding_5: u8,
-    pub displaylessMaxHeads: VIRTUAL_DISPLAY_GET_NUM_HEADS_PARAMS,
-    pub displaylessMaxResolution: VIRTUAL_DISPLAY_GET_MAX_RESOLUTION_PARAMS,
-    pub __bindgen_padding_6: [u8; 4usize],
-    pub displaylessMaxPixels: u64_,
-    pub hInternalClient: u32_,
-    pub hInternalDevice: u32_,
-    pub hInternalSubdevice: u32_,
-    pub bSelfHostedMode: u8_,
-    pub bAtsSupported: u8_,
-    pub bIsGpuUefi: u8_,
-    pub bIsEfiInit: u8_,
-    pub ecidInfo: [EcidManufacturingInfo; 2usize],
-    pub fwWprLayoutOffset: FW_WPR_LAYOUT_OFFSET,
-}
-impl Default for GspStaticConfigInfo_t {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GspSystemInfo {
-    pub gpuPhysAddr: u64_,
-    pub gpuPhysFbAddr: u64_,
-    pub gpuPhysInstAddr: u64_,
-    pub gpuPhysIoAddr: u64_,
-    pub nvDomainBusDeviceFunc: u64_,
-    pub simAccessBufPhysAddr: u64_,
-    pub notifyOpSharedSurfacePhysAddr: u64_,
-    pub pcieAtomicsOpMask: u64_,
-    pub consoleMemSize: u64_,
-    pub maxUserVa: u64_,
-    pub pciConfigMirrorBase: u32_,
-    pub pciConfigMirrorSize: u32_,
-    pub PCIDeviceID: u32_,
-    pub PCISubDeviceID: u32_,
-    pub PCIRevisionID: u32_,
-    pub pcieAtomicsCplDeviceCapMask: u32_,
-    pub oorArch: u8_,
-    pub __bindgen_padding_0: [u8; 7usize],
-    pub clPdbProperties: u64_,
-    pub Chipset: u32_,
-    pub bGpuBehindBridge: u8_,
-    pub bFlrSupported: u8_,
-    pub b64bBar0Supported: u8_,
-    pub bMnocAvailable: u8_,
-    pub chipsetL1ssEnable: u32_,
-    pub bUpstreamL0sUnsupported: u8_,
-    pub bUpstreamL1Unsupported: u8_,
-    pub bUpstreamL1PorSupported: u8_,
-    pub bUpstreamL1PorMobileOnly: u8_,
-    pub bSystemHasMux: u8_,
-    pub upstreamAddressValid: u8_,
-    pub FHBBusInfo: BUSINFO,
-    pub chipsetIDInfo: BUSINFO,
-    pub __bindgen_padding_1: [u8; 2usize],
-    pub acpiMethodData: ACPI_METHOD_DATA,
-    pub hypervisorType: u32_,
-    pub bIsPassthru: u8_,
-    pub __bindgen_padding_2: [u8; 7usize],
-    pub sysTimerOffsetNs: u64_,
-    pub gspVFInfo: GSP_VF_INFO,
-    pub bIsPrimary: u8_,
-    pub isGridBuild: u8_,
-    pub __bindgen_padding_3: [u8; 2usize],
-    pub pcieConfigReg: GSP_PCIE_CONFIG_REG,
-    pub gridBuildCsp: u32_,
-    pub bPreserveVideoMemoryAllocations: u8_,
-    pub bTdrEventSupported: u8_,
-    pub bFeatureStretchVblankCapable: u8_,
-    pub bEnableDynamicGranularityPageArrays: u8_,
-    pub bClockBoostSupported: u8_,
-    pub bRouteDispIntrsToCPU: u8_,
-    pub __bindgen_padding_4: [u8; 6usize],
-    pub hostPageSize: u64_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct MESSAGE_QUEUE_INIT_ARGUMENTS {
-    pub sharedMemPhysAddr: u64_,
-    pub pageTableEntryCount: u32_,
-    pub __bindgen_padding_0: [u8; 4usize],
-    pub cmdQueueOffset: u64_,
-    pub statQueueOffset: u64_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_SR_INIT_ARGUMENTS {
-    pub oldLevel: u32_,
-    pub flags: u32_,
-    pub bInPMTransition: u8_,
-    pub __bindgen_padding_0: [u8; 3usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_ARGUMENTS_CACHED {
-    pub messageQueueInitArguments: MESSAGE_QUEUE_INIT_ARGUMENTS,
-    pub srInitArguments: GSP_SR_INIT_ARGUMENTS,
-    pub gpuInstance: u32_,
-    pub bDmemStack: u8_,
-    pub __bindgen_padding_0: [u8; 7usize],
-    pub profilerArgs: GSP_ARGUMENTS_CACHED__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_ARGUMENTS_CACHED__bindgen_ty_1 {
-    pub pa: u64_,
-    pub size: u64_,
-}
-#[repr(C)]
-#[derive(Copy, Clone, MaybeZeroable)]
-pub union rpc_message_rpc_union_field_v03_00 {
-    pub spare: u32_,
-    pub cpuRmGfid: u32_,
-}
-impl Default for rpc_message_rpc_union_field_v03_00 {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-pub type rpc_message_rpc_union_field_v = rpc_message_rpc_union_field_v03_00;
-#[repr(C)]
-#[derive(MaybeZeroable)]
-pub struct rpc_message_header_v03_00 {
-    pub header_version: u32_,
-    pub signature: u32_,
-    pub length: u32_,
-    pub function: u32_,
-    pub rpc_result: u32_,
-    pub rpc_result_private: u32_,
-    pub sequence: u32_,
-    pub u: rpc_message_rpc_union_field_v,
-    pub rpc_message_data: __IncompleteArrayField<u8_>,
-}
-impl Default for rpc_message_header_v03_00 {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-pub type rpc_message_header_v = rpc_message_header_v03_00;
-#[repr(C)]
-#[derive(Copy, Clone, MaybeZeroable)]
-pub struct GspFwWprMeta {
-    pub magic: u64_,
-    pub revision: u64_,
-    pub sysmemAddrOfRadix3Elf: u64_,
-    pub sizeOfRadix3Elf: u64_,
-    pub sysmemAddrOfBootloader: u64_,
-    pub sizeOfBootloader: u64_,
-    pub bootloaderCodeOffset: u64_,
-    pub bootloaderDataOffset: u64_,
-    pub bootloaderManifestOffset: u64_,
-    pub __bindgen_anon_1: GspFwWprMeta__bindgen_ty_1,
-    pub gspFwRsvdStart: u64_,
-    pub nonWprHeapOffset: u64_,
-    pub nonWprHeapSize: u64_,
-    pub gspFwWprStart: u64_,
-    pub gspFwHeapOffset: u64_,
-    pub gspFwHeapSize: u64_,
-    pub gspFwOffset: u64_,
-    pub bootBinOffset: u64_,
-    pub frtsOffset: u64_,
-    pub frtsSize: u64_,
-    pub gspFwWprEnd: u64_,
-    pub fbSize: u64_,
-    pub vgaWorkspaceOffset: u64_,
-    pub vgaWorkspaceSize: u64_,
-    pub bootCount: u64_,
-    pub __bindgen_anon_2: GspFwWprMeta__bindgen_ty_2,
-    pub gspFwHeapVfPartitionCount: u8_,
-    pub flags: u8_,
-    pub padding: [u8_; 2usize],
-    pub pmuReservedSize: u32_,
-    pub verified: u64_,
-}
-#[repr(C)]
-#[derive(Copy, Clone, MaybeZeroable)]
-pub union GspFwWprMeta__bindgen_ty_1 {
-    pub __bindgen_anon_1: GspFwWprMeta__bindgen_ty_1__bindgen_ty_1,
-    pub __bindgen_anon_2: GspFwWprMeta__bindgen_ty_1__bindgen_ty_2,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GspFwWprMeta__bindgen_ty_1__bindgen_ty_1 {
-    pub sysmemAddrOfSignature: u64_,
-    pub sizeOfSignature: u64_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GspFwWprMeta__bindgen_ty_1__bindgen_ty_2 {
-    pub gspFwHeapFreeListWprOffset: u32_,
-    pub unused0: u32_,
-    pub unused1: u64_,
-}
-impl Default for GspFwWprMeta__bindgen_ty_1 {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-#[repr(C)]
-#[derive(Copy, Clone, MaybeZeroable)]
-pub union GspFwWprMeta__bindgen_ty_2 {
-    pub __bindgen_anon_1: GspFwWprMeta__bindgen_ty_2__bindgen_ty_1,
-    pub __bindgen_anon_2: GspFwWprMeta__bindgen_ty_2__bindgen_ty_2,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GspFwWprMeta__bindgen_ty_2__bindgen_ty_1 {
-    pub partitionRpcAddr: u64_,
-    pub partitionRpcRequestOffset: u16_,
-    pub partitionRpcReplyOffset: u16_,
-    pub elfCodeOffset: u32_,
-    pub elfDataOffset: u32_,
-    pub elfCodeSize: u32_,
-    pub elfDataSize: u32_,
-    pub lsUcodeVersion: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GspFwWprMeta__bindgen_ty_2__bindgen_ty_2 {
-    pub partitionRpcPadding: [u32_; 4usize],
-    pub sysmemAddrOfCrashReportQueue: u64_,
-    pub sizeOfCrashReportQueue: u32_,
-    pub lsUcodeVersionPadding: [u32_; 1usize],
-}
-impl Default for GspFwWprMeta__bindgen_ty_2 {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-impl Default for GspFwWprMeta {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-pub type LibosAddress = u64_;
-pub const LibosMemoryRegionKind_LIBOS_MEMORY_REGION_NONE: LibosMemoryRegionKind = 0;
-pub const LibosMemoryRegionKind_LIBOS_MEMORY_REGION_CONTIGUOUS: LibosMemoryRegionKind = 1;
-pub const LibosMemoryRegionKind_LIBOS_MEMORY_REGION_RADIX3: LibosMemoryRegionKind = 2;
-pub type LibosMemoryRegionKind = ffi::c_uint;
-pub const LibosMemoryRegionLoc_LIBOS_MEMORY_REGION_LOC_NONE: LibosMemoryRegionLoc = 0;
-pub const LibosMemoryRegionLoc_LIBOS_MEMORY_REGION_LOC_SYSMEM: LibosMemoryRegionLoc = 1;
-pub const LibosMemoryRegionLoc_LIBOS_MEMORY_REGION_LOC_FB: LibosMemoryRegionLoc = 2;
-pub type LibosMemoryRegionLoc = ffi::c_uint;
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct LibosMemoryRegionInitArgument {
-    pub id8: LibosAddress,
-    pub pa: LibosAddress,
-    pub size: LibosAddress,
-    pub kind: u8_,
-    pub loc: u8_,
-    pub __bindgen_padding_0: [u8; 6usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct PACKED_REGISTRY_ENTRY {
-    pub nameOffset: u32_,
-    pub type_: u8_,
-    pub __bindgen_padding_0: [u8; 3usize],
-    pub data: u32_,
-    pub length: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, MaybeZeroable)]
-pub struct PACKED_REGISTRY_TABLE {
-    pub size: u32_,
-    pub numEntries: u32_,
-    pub entries: __IncompleteArrayField<PACKED_REGISTRY_ENTRY>,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct msgqTxHeader {
-    pub version: u32_,
-    pub size: u32_,
-    pub msgSize: u32_,
-    pub msgCount: u32_,
-    pub writePtr: u32_,
-    pub flags: u32_,
-    pub rxHdrOff: u32_,
-    pub entryOff: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct msgqRxHeader {
-    pub readPtr: u32_,
-}
-#[repr(C)]
-#[repr(align(8))]
-#[derive(MaybeZeroable)]
-pub struct GSP_MSG_QUEUE_ELEMENT {
-    pub authTagBuffer: [u8_; 16usize],
-    pub aadBuffer: [u8_; 16usize],
-    pub checkSum: u32_,
-    pub seqNum: u32_,
-    pub elemCount: u32_,
-    pub __bindgen_padding_0: [u8; 4usize],
-    pub rpc: rpc_message_header_v,
-}
-impl Default for GSP_MSG_QUEUE_ELEMENT {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-pub const GSP_DMA_TARGET_GSP_DMA_TARGET_LOCAL_FB: GSP_DMA_TARGET = 0;
-pub const GSP_DMA_TARGET_GSP_DMA_TARGET_COHERENT_SYSTEM: GSP_DMA_TARGET = 1;
-pub const GSP_DMA_TARGET_GSP_DMA_TARGET_NONCOHERENT_SYSTEM: GSP_DMA_TARGET = 2;
-pub const GSP_DMA_TARGET_GSP_DMA_TARGET_COUNT: GSP_DMA_TARGET = 3;
-pub type GSP_DMA_TARGET = ffi::c_uint;
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_FMC_INIT_PARAMS {
-    pub regkeys: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone, MaybeZeroable)]
-pub struct GSP_ACR_BOOT_GSP_RM_PARAMS {
-    pub target: GSP_DMA_TARGET,
-    pub gspRmDescSize: u32_,
-    pub gspRmDescOffset: u64_,
-    pub wprCarveoutOffset: u64_,
-    pub wprCarveoutSize: u32_,
-    pub bIsGspRmBoot: u8_,
-    pub __bindgen_padding_0: [u8; 3usize],
-}
-impl Default for GSP_ACR_BOOT_GSP_RM_PARAMS {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone, MaybeZeroable)]
-pub struct GSP_RM_PARAMS {
-    pub target: GSP_DMA_TARGET,
-    pub __bindgen_padding_0: [u8; 4usize],
-    pub bootArgsOffset: u64_,
-}
-impl Default for GSP_RM_PARAMS {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone, MaybeZeroable)]
-pub struct GSP_SPDM_PARAMS {
-    pub target: GSP_DMA_TARGET,
-    pub __bindgen_padding_0: [u8; 4usize],
-    pub payloadBufferOffset: u64_,
-    pub payloadBufferSize: u32_,
-    pub __bindgen_padding_1: [u8; 4usize],
-}
-impl Default for GSP_SPDM_PARAMS {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone, MaybeZeroable)]
-pub struct GSP_FMC_BOOT_PARAMS {
-    pub initParams: GSP_FMC_INIT_PARAMS,
-    pub __bindgen_padding_0: [u8; 4usize],
-    pub bootGspRmParams: GSP_ACR_BOOT_GSP_RM_PARAMS,
-    pub gspRmParams: GSP_RM_PARAMS,
-    pub gspSpdmParams: GSP_SPDM_PARAMS,
-}
-impl Default for GSP_FMC_BOOT_PARAMS {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct rpc_unloading_guest_driver_v1F_07 {
-    pub bInPMTransition: u8_,
-    pub bGc6Entering: u8_,
-    pub __bindgen_padding_0: [u8; 2usize],
-    pub newLevel: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, MaybeZeroable)]
-pub struct rpc_run_cpu_sequencer_v17_00 {
-    pub bufferSizeDWord: u32_,
-    pub cmdIndex: u32_,
-    pub regSaveArea: [u32_; 8usize],
-    pub commandBuffer: __IncompleteArrayField<u32_>,
-}
-pub const GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE: GSP_SEQ_BUF_OPCODE = 0;
-pub const GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_MODIFY: GSP_SEQ_BUF_OPCODE = 1;
-pub const GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_POLL: GSP_SEQ_BUF_OPCODE = 2;
-pub const GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_DELAY_US: GSP_SEQ_BUF_OPCODE = 3;
-pub const GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_STORE: GSP_SEQ_BUF_OPCODE = 4;
-pub const GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESET: GSP_SEQ_BUF_OPCODE = 5;
-pub const GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_START: GSP_SEQ_BUF_OPCODE = 6;
-pub const GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_WAIT_FOR_HALT: GSP_SEQ_BUF_OPCODE = 7;
-pub const GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_CORE_RESUME: GSP_SEQ_BUF_OPCODE = 8;
-pub type GSP_SEQ_BUF_OPCODE = ffi::c_uint;
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_SEQ_BUF_PAYLOAD_REG_WRITE {
-    pub addr: u32_,
-    pub val: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_SEQ_BUF_PAYLOAD_REG_MODIFY {
-    pub addr: u32_,
-    pub mask: u32_,
-    pub val: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_SEQ_BUF_PAYLOAD_REG_POLL {
-    pub addr: u32_,
-    pub mask: u32_,
-    pub val: u32_,
-    pub timeout: u32_,
-    pub error: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_SEQ_BUF_PAYLOAD_DELAY_US {
-    pub val: u32_,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]
-pub struct GSP_SEQ_BUF_PAYLOAD_REG_STORE {
-    pub addr: u32_,
-    pub index: u32_,
-}
-#[repr(C)]
-#[derive(Copy, Clone, MaybeZeroable)]
-pub struct GSP_SEQUENCER_BUFFER_CMD {
-    pub opCode: GSP_SEQ_BUF_OPCODE,
-    pub payload: GSP_SEQUENCER_BUFFER_CMD__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Copy, Clone, MaybeZeroable)]
-pub union GSP_SEQUENCER_BUFFER_CMD__bindgen_ty_1 {
-    pub regWrite: GSP_SEQ_BUF_PAYLOAD_REG_WRITE,
-    pub regModify: GSP_SEQ_BUF_PAYLOAD_REG_MODIFY,
-    pub regPoll: GSP_SEQ_BUF_PAYLOAD_REG_POLL,
-    pub delayUs: GSP_SEQ_BUF_PAYLOAD_DELAY_US,
-    pub regStore: GSP_SEQ_BUF_PAYLOAD_REG_STORE,
-}
-impl Default for GSP_SEQUENCER_BUFFER_CMD__bindgen_ty_1 {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}
-impl Default for GSP_SEQUENCER_BUFFER_CMD {
-    fn default() -> Self {
-        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
-        unsafe {
-            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
-            s.assume_init()
-        }
-    }
-}

-- 
2.56.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 03/15] gpu: nova-core: gsp: populate VF information in GSP_INIT
  2026-12-03 12:09 ` [PATCH 03/15] gpu: nova-core: gsp: populate VF information in GSP_INIT Alexandre Courbot
@ 2026-12-03 14:03   ` Maxime Ripard
  2026-12-03 14:32     ` Miguel Ojeda
  0 siblings, 1 reply; 19+ messages in thread
From: Maxime Ripard @ 2026-12-03 14:03 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
	Tamir Duberstein, Onur Özkan, Maarten Lankhorst,
	Thomas Zimmermann, Jonathan Corbet, Shuah Khan, Randy Dunlap,
	John Hubbard, Alistair Popple, Timur Tabi, Eliot Courtney,
	Zhi Wang, Alok Kumar, nova-gpu, dri-devel, rust-for-linux,
	linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

Hi Alex,

On Thu, Dec 03, 2026 at 09:09:20PM +0900, Alexandre Courbot wrote:
> From: Zhi Wang <zhiw@nvidia.com>
> 
> GSP firmware requires the VF BAR layout to route interrupts and doorbell
> events to individual virtual functions.
> 
> When vGPU mode is enabled, read the VF topology from the typed PCI
> SR-IOV extended capability and populate the existing NVKV VF information
> schema in GSP_INIT.
> 
> Signed-off-by: Zhi Wang <zhiw@nvidia.com>
> Signed-off-by: Alok Kumar <alkumar@nvidia.com>
> [acourbot: also add `RMSetSriovMode` regkey here.]
> [acourbot: avoid double-match of `VgpuState`.]
> [acourbot: use `bitfield!` for `VfInfo::flags`.]
> [acourbot: document more returned errors.]
> Co-developed-by: Alexandre Courbot <acourbot@nvidia.com>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
>  drivers/gpu/nova-core/gsp/commands/gmc.rs | 13 +++++--
>  drivers/gpu/nova-core/gsp/fw/commands.rs  | 65 ++++++++++++++++++++++++++++---
>  2 files changed, 70 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/gsp/commands/gmc.rs b/drivers/gpu/nova-core/gsp/commands/gmc.rs
> index f74ada78f7ac..f0a0a6798d6b 100644
> --- a/drivers/gpu/nova-core/gsp/commands/gmc.rs
> +++ b/drivers/gpu/nova-core/gsp/commands/gmc.rs
> @@ -37,6 +37,7 @@
>          },
>      },
>      sbuffer::SBufferIter,
> +    vgpu::VgpuState, //

It looks like you have a spurious comment here?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 03/15] gpu: nova-core: gsp: populate VF information in GSP_INIT
  2026-12-03 14:03   ` Maxime Ripard
@ 2026-12-03 14:32     ` Miguel Ojeda
  2026-12-03 14:38       ` Maxime Ripard
  0 siblings, 1 reply; 19+ messages in thread
From: Miguel Ojeda @ 2026-12-03 14:32 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Courbot, Danilo Krummrich, Alice Ryhl, David Airlie,
	Simona Vetter, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, Daniel Almeida, Tamir Duberstein, Onur Özkan,
	Maarten Lankhorst, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap, John Hubbard, Alistair Popple, Timur Tabi,
	Eliot Courtney, Zhi Wang, Alok Kumar, nova-gpu, dri-devel,
	rust-for-linux, linux-doc, linux-kernel

On Thu, Dec 3, 2026 at 3:03 PM Maxime Ripard <mripard@kernel.org> wrote:
>
> It looks like you have a spurious comment here?

It is a workaround to get `rustfmt` to do what we want, which avoids
merge conflicts; please see:

  https://docs.kernel.org/rust/coding-guidelines.html#imports

(We are trying to get that feature stabilized in `rustfmt`; we may get
it for the next Debian Stable; otherwise, the next one)

I hope that helps!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 03/15] gpu: nova-core: gsp: populate VF information in GSP_INIT
  2026-12-03 14:32     ` Miguel Ojeda
@ 2026-12-03 14:38       ` Maxime Ripard
  0 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2026-12-03 14:38 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alexandre Courbot, Danilo Krummrich, Alice Ryhl, David Airlie,
	Simona Vetter, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, Daniel Almeida, Tamir Duberstein, Onur Özkan,
	Maarten Lankhorst, Thomas Zimmermann, Jonathan Corbet, Shuah Khan,
	Randy Dunlap, John Hubbard, Alistair Popple, Timur Tabi,
	Eliot Courtney, Zhi Wang, Alok Kumar, nova-gpu, dri-devel,
	rust-for-linux, linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

On Thu, Dec 03, 2026 at 03:32:42PM +0100, Miguel Ojeda wrote:
> On Thu, Dec 3, 2026 at 3:03 PM Maxime Ripard <mripard@kernel.org> wrote:
> >
> > It looks like you have a spurious comment here?
> 
> It is a workaround to get `rustfmt` to do what we want, which avoids
> merge conflicts; please see:
> 
>   https://docs.kernel.org/rust/coding-guidelines.html#imports
> 
> (We are trying to get that feature stabilized in `rustfmt`; we may get
> it for the next Debian Stable; otherwise, the next one)
> 
> I hope that helps!

Yeah, it does. Sorry for the noise :)

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2026-12-03 14:38 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 12:09 [PATCH 00/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
2026-12-03 12:09 ` [PATCH 01/15] gpu: nova-core: gsp: nvkv: add const constructor for Key Alexandre Courbot
2026-12-03 12:09 ` [PATCH 02/15] gpu: nova-core: gsp: add the GSP_INIT command and its reply Alexandre Courbot
2026-12-03 12:09 ` [PATCH 03/15] gpu: nova-core: gsp: populate VF information in GSP_INIT Alexandre Courbot
2026-12-03 14:03   ` Maxime Ripard
2026-12-03 14:32     ` Miguel Ojeda
2026-12-03 14:38       ` Maxime Ripard
2026-12-03 12:09 ` [PATCH 04/15] gpu: nova-core: gsp: re-export PowerStateLevel from gsp::commands Alexandre Courbot
2026-12-03 12:09 ` [PATCH 05/15] gpu: nova-core: gsp: add the GSP_SUSPEND request Alexandre Courbot
2026-12-03 12:09 ` [PATCH 06/15] gpu: nova-core: firmware: add the ucodes firmware loader Alexandre Courbot
2026-12-03 12:09 ` [PATCH 07/15] gpu: nova-core: gsp: define GSP_MSG_QUEUE_ELEMENT_SIZE_MAX without bindings Alexandre Courbot
2026-12-03 12:09 ` [PATCH 08/15] gpu: nova-core: fb: increase Blackwell reserved memory sizes for r000 Alexandre Courbot
2026-12-03 12:09 ` [PATCH 09/15] gpu: nova-core: gsp: drain the message queue while waiting for GSP suspend Alexandre Courbot
2026-12-03 12:09 ` [PATCH 10/15] gpu: nova-core: gsp: zero-initialize FMC boot parameter structs Alexandre Courbot
2026-12-03 12:09 ` [PATCH 11/15] gpu: nova-core: firmware: add r000 GSP bindings Alexandre Courbot
2026-12-03 12:09 ` [PATCH 12/15] gpu: nova-core: switch to the r000 GSP firmware Alexandre Courbot
2026-12-03 12:09 ` [PATCH 13/15] gpu: nova-core: gsp: delete the GSP sequencer Alexandre Courbot
2026-12-03 12:09 ` [PATCH 14/15] gpu: nova-core: gsp: delete the r570 RPC commands Alexandre Courbot
2026-12-03 12:09 ` [PATCH 15/15] gpu: nova-core: firmware: delete the r570 bindings Alexandre Courbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox