lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251104232626.2277008-1-joelagnelf@nvidia.com>
Date: Tue,  4 Nov 2025 18:26:26 -0500
From: Joel Fernandes <joelagnelf@...dia.com>
To: linux-kernel@...r.kernel.org,
	rust-for-linux@...r.kernel.org,
	dri-devel@...ts.freedesktop.org,
	dakr@...nel.org,
	acourbot@...dia.com
Cc: Alistair Popple <apopple@...dia.com>,
	Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Boqun Feng <boqun.feng@...il.com>,
	Gary Guo <gary@...yguo.net>,
	bjorn3_gh@...tonmail.com,
	Benno Lossin <lossin@...nel.org>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>,
	Trevor Gross <tmgross@...ch.edu>,
	David Airlie <airlied@...il.com>,
	Simona Vetter <simona@...ll.ch>,
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
	Maxime Ripard <mripard@...nel.org>,
	Thomas Zimmermann <tzimmermann@...e.de>,
	John Hubbard <jhubbard@...dia.com>,
	Joel Fernandes <joelagnelf@...dia.com>,
	Timur Tabi <ttabi@...dia.com>,
	joel@...lfernandes.org,
	Daniel Almeida <daniel.almeida@...labora.com>,
	nouveau@...ts.freedesktop.org
Subject: [PATCH v2 13/12] nova-core: sequencer: Refactor run() to handle unknown messages

Refactor GspSequencer::run() to follow the same pattern as gsp_init_done()
by wrapping message reception in a loop that ignores unknown messages
(ERANGE errors).

Suggested-by: Timur Tabi <ttabi@...dia.com>
Signed-off-by: Joel Fernandes <joelagnelf@...dia.com>
---
Additional patch to cure probe issue on Timur's GA102 (which happens to receive
too many NOCAT records).

 drivers/gpu/nova-core/gsp/sequencer.rs | 86 +++++++++++++++-----------
 1 file changed, 49 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs
index ecc80f668dc8..b98e5146abd8 100644
--- a/drivers/gpu/nova-core/gsp/sequencer.rs
+++ b/drivers/gpu/nova-core/gsp/sequencer.rs
@@ -35,8 +35,8 @@ impl MessageFromGsp for fw::rpc_run_cpu_sequencer_v17_00 {
 
 const CMD_SIZE: usize = size_of::<fw::GSP_SEQUENCER_BUFFER_CMD>();
 
-struct GspSequencerInfo<'a> {
-    info: &'a fw::rpc_run_cpu_sequencer_v17_00,
+struct GspSequencerInfo {
+    cmd_index: u32,
     cmd_data: KVec<u8>,
 }
 
@@ -125,7 +125,7 @@ pub(crate) fn size_bytes(&self) -> usize {
 }
 
 pub(crate) struct GspSequencer<'a> {
-    seq_info: GspSequencerInfo<'a>,
+    seq_info: GspSequencerInfo,
     bar: &'a Bar0,
     sec2_falcon: &'a Falcon<Sec2>,
     gsp_falcon: &'a Falcon<Gsp>,
@@ -368,7 +368,7 @@ fn into_iter(self) -> Self::IntoIter {
         GspSeqIter {
             cmd_data,
             current_offset: 0,
-            total_cmds: self.seq_info.info.cmdIndex,
+            total_cmds: self.seq_info.cmd_index,
             cmds_processed: 0,
             dev: self.dev,
         }
@@ -387,41 +387,53 @@ pub(crate) struct GspSequencerParams<'a> {
 
 impl<'a> GspSequencer<'a> {
     pub(crate) fn run(cmdq: &mut Cmdq, params: GspSequencerParams<'a>, timeout: Delta) -> Result {
-        cmdq.receive_msg_from_gsp(timeout, |info, mut sbuf| {
-            let cmd_data = sbuf.flush_into_kvec(GFP_KERNEL)?;
-            let seq_info = GspSequencerInfo { info, cmd_data };
-
-            let sequencer = GspSequencer {
-                seq_info,
-                bar: params.bar,
-                sec2_falcon: params.sec2_falcon,
-                gsp_falcon: params.gsp_falcon,
-                libos_dma_handle: params.libos_dma_handle,
-                gsp_fw: params.gsp_fw,
-                dev: params.dev,
-            };
-
-            dev_dbg!(params.dev, "Running CPU Sequencer commands\n");
-
-            for cmd_result in &sequencer {
-                match cmd_result {
-                    Ok(cmd) => cmd.run(&sequencer)?,
-                    Err(e) => {
-                        dev_err!(
-                            params.dev,
-                            "Error running command at index {}\n",
-                            sequencer.seq_info.info.cmdIndex
-                        );
-                        return Err(e);
-                    }
+        let seq_info = loop {
+            match cmdq.receive_msg_from_gsp(
+                timeout,
+                |info: &fw::rpc_run_cpu_sequencer_v17_00, mut sbuf| {
+                    let cmd_data = sbuf.flush_into_kvec(GFP_KERNEL)?;
+                    Ok(GspSequencerInfo {
+                        cmd_index: info.cmdIndex,
+                        cmd_data,
+                    })
+                },
+            ) {
+                Ok(seq_info) => break seq_info,
+                Err(ERANGE) => continue,
+                Err(e) => return Err(e),
+            }
+        };
+
+        let sequencer = GspSequencer {
+            seq_info,
+            bar: params.bar,
+            sec2_falcon: params.sec2_falcon,
+            gsp_falcon: params.gsp_falcon,
+            libos_dma_handle: params.libos_dma_handle,
+            gsp_fw: params.gsp_fw,
+            dev: params.dev,
+        };
+
+        dev_dbg!(params.dev, "Running CPU Sequencer commands\n");
+
+        for cmd_result in &sequencer {
+            match cmd_result {
+                Ok(cmd) => cmd.run(&sequencer)?,
+                Err(e) => {
+                    dev_err!(
+                        params.dev,
+                        "Error running command at index {}\n",
+                        sequencer.seq_info.cmd_index
+                    );
+                    return Err(e);
                 }
             }
+        }
 
-            dev_dbg!(
-                params.dev,
-                "CPU Sequencer commands completed successfully\n"
-            );
-            Ok(())
-        })
+        dev_dbg!(
+            params.dev,
+            "CPU Sequencer commands completed successfully\n"
+        );
+        Ok(())
     }
 }
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ