public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements
@ 2026-02-17  2:45 Alexandre Courbot
  2026-02-17  2:45 ` [PATCH v3 1/8] gpu: nova-core: gsp: warn if data remains after processing a message Alexandre Courbot
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: Alexandre Courbot @ 2026-02-17  2:45 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, Eliot Courtney, nouveau, dri-devel, linux-kernel,
	rust-for-linux, Alexandre Courbot, Lyude Paul, Gary Guo

A few simple, loosely-related small improvements for nova-core,
including reporting unprocessed data in GSP messages, removal of
unnecessary code in GSP and the sequencer, and leveraging the Zeroable
derive macro and core library's CStr. Probably nothing too
controversial, so I plan on applying it soon after -rc1 gets released.

This revision is based on master.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Changes in v3:
- Use inspect() to warn about remaining data in the GSP command queue.
- Drop "firmware: fwsec: do not require bound device when unneeded".
- Drop "simplify str_from_null_terminated" as `str_from_null_terminated`
  has been removed.
- Derive `Zeroable` on the original `GspStaticConfigInfo` tuple struct.
- Link to v2: https://patch.msgid.link/20251216-nova-misc-v2-0-dc7b42586c04@nvidia.com

Changes in v2:
- Rebase on drm-rust-next.
- Add a patch to reuse previously acquired reference to define in GSP
  boot sequence.
- Link to v1: https://patch.msgid.link/20251208-nova-misc-v1-0-a3ce01376169@nvidia.com

---
Alexandre Courbot (8):
      gpu: nova-core: gsp: warn if data remains after processing a message
      gpu: nova-core: gsp: remove unnecessary Display impls
      gpu: nova-core: gsp: simplify sequencer opcode parsing
      gpu: nova-core: gsp: remove unneeded sequencer trait
      gpu: nova-core: gsp: derive `Debug` on more sequencer types
      gpu: nova-core: gsp: derive Zeroable for GspStaticConfigInfo
      gpu: nova-core: use core library's CStr instead of kernel one
      gpu: nova-core: gsp: use available device reference

 drivers/gpu/nova-core/firmware.rs        |   2 +-
 drivers/gpu/nova-core/firmware/gsp.rs    |   6 +-
 drivers/gpu/nova-core/gsp/boot.rs        |  34 +++-------
 drivers/gpu/nova-core/gsp/cmdq.rs        |  14 ++++-
 drivers/gpu/nova-core/gsp/fw.rs          | 104 +++----------------------------
 drivers/gpu/nova-core/gsp/fw/commands.rs |   5 +-
 drivers/gpu/nova-core/gsp/sequencer.rs   |  18 +++---
 drivers/gpu/nova-core/nova_core.rs       |   2 +-
 8 files changed, 45 insertions(+), 140 deletions(-)
---
base-commit: 9702969978695d9a699a1f34771580cdbb153b33
change-id: 20251208-nova-misc-1d797b5d64f2

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


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

* [PATCH v3 1/8] gpu: nova-core: gsp: warn if data remains after processing a message
  2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
@ 2026-02-17  2:45 ` Alexandre Courbot
  2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
  2026-02-17  2:45 ` [PATCH v3 2/8] gpu: nova-core: gsp: remove unnecessary Display impls Alexandre Courbot
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Alexandre Courbot @ 2026-02-17  2:45 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, Eliot Courtney, nouveau, dri-devel, linux-kernel,
	rust-for-linux, Alexandre Courbot, Lyude Paul

Not processing the whole data from a received message is a strong
indicator of a bug - emit a warning when such cases are detected.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/cmdq.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
index 46819a82a51a..607fb9ad69b0 100644
--- a/drivers/gpu/nova-core/gsp/cmdq.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq.rs
@@ -661,7 +661,17 @@ pub(crate) fn receive_msg<M: MessageFromGsp>(&mut self, timeout: Delta) -> Resul
             let (cmd, contents_1) = M::Message::from_bytes_prefix(message.contents.0).ok_or(EIO)?;
             let mut sbuffer = SBufferIter::new_reader([contents_1, message.contents.1]);
 
-            M::read(cmd, &mut sbuffer).map_err(|e| e.into())
+            M::read(cmd, &mut sbuffer)
+                .map_err(|e| e.into())
+                .inspect(|_| {
+                    if !sbuffer.is_empty() {
+                        dev_warn!(
+                            &self.dev,
+                            "GSP message {:?} has unprocessed data\n",
+                            function
+                        );
+                    }
+                })
         } else {
             Err(ERANGE)
         };

-- 
2.53.0


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

* [PATCH v3 2/8] gpu: nova-core: gsp: remove unnecessary Display impls
  2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
  2026-02-17  2:45 ` [PATCH v3 1/8] gpu: nova-core: gsp: warn if data remains after processing a message Alexandre Courbot
@ 2026-02-17  2:45 ` Alexandre Courbot
  2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
  2026-02-17  2:45 ` [PATCH v3 3/8] gpu: nova-core: gsp: simplify sequencer opcode parsing Alexandre Courbot
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Alexandre Courbot @ 2026-02-17  2:45 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, Eliot Courtney, nouveau, dri-devel, linux-kernel,
	rust-for-linux, Alexandre Courbot, Lyude Paul, Gary Guo

We only ever display these in debug context, for which the automatically
derived `Debug` impls work just fine - so use them and remove these
boilerplate-looking implementations.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Alistair Popple <apopple@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/cmdq.rs |  2 +-
 drivers/gpu/nova-core/gsp/fw.rs   | 54 ---------------------------------------
 2 files changed, 1 insertion(+), 55 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
index 607fb9ad69b0..9eabec49849d 100644
--- a/drivers/gpu/nova-core/gsp/cmdq.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq.rs
@@ -531,7 +531,7 @@ pub(crate) fn send_command<M>(&mut self, bar: &Bar0, command: M) -> Result
 
         dev_dbg!(
             &self.dev,
-            "GSP RPC: send: seq# {}, function={}, length=0x{:x}\n",
+            "GSP RPC: send: seq# {}, function={:?}, length=0x{:x}\n",
             self.seq,
             M::FUNCTION,
             dst.header.length(),
diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 83ff91614e36..3c26b165038e 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -10,7 +10,6 @@
 
 use kernel::{
     dma::CoherentAllocation,
-    fmt,
     prelude::*,
     ptr::{
         Alignable,
@@ -223,43 +222,6 @@ pub(crate) enum MsgFunction {
     UcodeLibOsPrint = bindings::NV_VGPU_MSG_EVENT_UCODE_LIBOS_PRINT,
 }
 
-impl fmt::Display for MsgFunction {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        match self {
-            // Common function codes
-            MsgFunction::Nop => write!(f, "NOP"),
-            MsgFunction::SetGuestSystemInfo => write!(f, "SET_GUEST_SYSTEM_INFO"),
-            MsgFunction::AllocRoot => write!(f, "ALLOC_ROOT"),
-            MsgFunction::AllocDevice => write!(f, "ALLOC_DEVICE"),
-            MsgFunction::AllocMemory => write!(f, "ALLOC_MEMORY"),
-            MsgFunction::AllocCtxDma => write!(f, "ALLOC_CTX_DMA"),
-            MsgFunction::AllocChannelDma => write!(f, "ALLOC_CHANNEL_DMA"),
-            MsgFunction::MapMemory => write!(f, "MAP_MEMORY"),
-            MsgFunction::BindCtxDma => write!(f, "BIND_CTX_DMA"),
-            MsgFunction::AllocObject => write!(f, "ALLOC_OBJECT"),
-            MsgFunction::Free => write!(f, "FREE"),
-            MsgFunction::Log => write!(f, "LOG"),
-            MsgFunction::GetGspStaticInfo => write!(f, "GET_GSP_STATIC_INFO"),
-            MsgFunction::SetRegistry => write!(f, "SET_REGISTRY"),
-            MsgFunction::GspSetSystemInfo => write!(f, "GSP_SET_SYSTEM_INFO"),
-            MsgFunction::GspInitPostObjGpu => write!(f, "GSP_INIT_POST_OBJGPU"),
-            MsgFunction::GspRmControl => write!(f, "GSP_RM_CONTROL"),
-            MsgFunction::GetStaticInfo => write!(f, "GET_STATIC_INFO"),
-
-            // Event codes
-            MsgFunction::GspInitDone => write!(f, "INIT_DONE"),
-            MsgFunction::GspRunCpuSequencer => write!(f, "RUN_CPU_SEQUENCER"),
-            MsgFunction::PostEvent => write!(f, "POST_EVENT"),
-            MsgFunction::RcTriggered => write!(f, "RC_TRIGGERED"),
-            MsgFunction::MmuFaultQueued => write!(f, "MMU_FAULT_QUEUED"),
-            MsgFunction::OsErrorLog => write!(f, "OS_ERROR_LOG"),
-            MsgFunction::GspPostNoCat => write!(f, "NOCAT"),
-            MsgFunction::GspLockdownNotice => write!(f, "LOCKDOWN_NOTICE"),
-            MsgFunction::UcodeLibOsPrint => write!(f, "LIBOS_PRINT"),
-        }
-    }
-}
-
 impl TryFrom<u32> for MsgFunction {
     type Error = kernel::error::Error;
 
@@ -330,22 +292,6 @@ pub(crate) enum SeqBufOpcode {
     RegWrite = bindings::GSP_SEQ_BUF_OPCODE_GSP_SEQ_BUF_OPCODE_REG_WRITE,
 }
 
-impl fmt::Display for SeqBufOpcode {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        match self {
-            SeqBufOpcode::CoreReset => write!(f, "CORE_RESET"),
-            SeqBufOpcode::CoreResume => write!(f, "CORE_RESUME"),
-            SeqBufOpcode::CoreStart => write!(f, "CORE_START"),
-            SeqBufOpcode::CoreWaitForHalt => write!(f, "CORE_WAIT_FOR_HALT"),
-            SeqBufOpcode::DelayUs => write!(f, "DELAY_US"),
-            SeqBufOpcode::RegModify => write!(f, "REG_MODIFY"),
-            SeqBufOpcode::RegPoll => write!(f, "REG_POLL"),
-            SeqBufOpcode::RegStore => write!(f, "REG_STORE"),
-            SeqBufOpcode::RegWrite => write!(f, "REG_WRITE"),
-        }
-    }
-}
-
 impl TryFrom<u32> for SeqBufOpcode {
     type Error = kernel::error::Error;
 

-- 
2.53.0


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

* [PATCH v3 3/8] gpu: nova-core: gsp: simplify sequencer opcode parsing
  2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
  2026-02-17  2:45 ` [PATCH v3 1/8] gpu: nova-core: gsp: warn if data remains after processing a message Alexandre Courbot
  2026-02-17  2:45 ` [PATCH v3 2/8] gpu: nova-core: gsp: remove unnecessary Display impls Alexandre Courbot
@ 2026-02-17  2:45 ` Alexandre Courbot
  2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
  2026-02-17  2:45 ` [PATCH v3 4/8] gpu: nova-core: gsp: remove unneeded sequencer trait Alexandre Courbot
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Alexandre Courbot @ 2026-02-17  2:45 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, Eliot Courtney, nouveau, dri-devel, linux-kernel,
	rust-for-linux, Alexandre Courbot, Lyude Paul, Gary Guo

The opcodes are already the right type in the C union, so we can use
them directly instead of converting them to a byte stream and back again
using `FromBytes`.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/fw.rs | 40 +++++-----------------------------------
 1 file changed, 5 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 3c26b165038e..624f5670ed50 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -472,13 +472,7 @@ pub(crate) fn reg_write_payload(&self) -> Result<RegWritePayload> {
             return Err(EINVAL);
         }
         // SAFETY: Opcode is verified to be `RegWrite`, so union contains valid `RegWritePayload`.
-        let payload_bytes = unsafe {
-            core::slice::from_raw_parts(
-                core::ptr::addr_of!(self.0.payload.regWrite).cast::<u8>(),
-                core::mem::size_of::<RegWritePayload>(),
-            )
-        };
-        Ok(*RegWritePayload::from_bytes(payload_bytes).ok_or(EINVAL)?)
+        Ok(RegWritePayload(unsafe { self.0.payload.regWrite }))
     }
 
     /// Returns the register modify payload by value.
@@ -489,13 +483,7 @@ pub(crate) fn reg_modify_payload(&self) -> Result<RegModifyPayload> {
             return Err(EINVAL);
         }
         // SAFETY: Opcode is verified to be `RegModify`, so union contains valid `RegModifyPayload`.
-        let payload_bytes = unsafe {
-            core::slice::from_raw_parts(
-                core::ptr::addr_of!(self.0.payload.regModify).cast::<u8>(),
-                core::mem::size_of::<RegModifyPayload>(),
-            )
-        };
-        Ok(*RegModifyPayload::from_bytes(payload_bytes).ok_or(EINVAL)?)
+        Ok(RegModifyPayload(unsafe { self.0.payload.regModify }))
     }
 
     /// Returns the register poll payload by value.
@@ -506,13 +494,7 @@ pub(crate) fn reg_poll_payload(&self) -> Result<RegPollPayload> {
             return Err(EINVAL);
         }
         // SAFETY: Opcode is verified to be `RegPoll`, so union contains valid `RegPollPayload`.
-        let payload_bytes = unsafe {
-            core::slice::from_raw_parts(
-                core::ptr::addr_of!(self.0.payload.regPoll).cast::<u8>(),
-                core::mem::size_of::<RegPollPayload>(),
-            )
-        };
-        Ok(*RegPollPayload::from_bytes(payload_bytes).ok_or(EINVAL)?)
+        Ok(RegPollPayload(unsafe { self.0.payload.regPoll }))
     }
 
     /// Returns the delay payload by value.
@@ -523,13 +505,7 @@ pub(crate) fn delay_us_payload(&self) -> Result<DelayUsPayload> {
             return Err(EINVAL);
         }
         // SAFETY: Opcode is verified to be `DelayUs`, so union contains valid `DelayUsPayload`.
-        let payload_bytes = unsafe {
-            core::slice::from_raw_parts(
-                core::ptr::addr_of!(self.0.payload.delayUs).cast::<u8>(),
-                core::mem::size_of::<DelayUsPayload>(),
-            )
-        };
-        Ok(*DelayUsPayload::from_bytes(payload_bytes).ok_or(EINVAL)?)
+        Ok(DelayUsPayload(unsafe { self.0.payload.delayUs }))
     }
 
     /// Returns the register store payload by value.
@@ -540,13 +516,7 @@ pub(crate) fn reg_store_payload(&self) -> Result<RegStorePayload> {
             return Err(EINVAL);
         }
         // SAFETY: Opcode is verified to be `RegStore`, so union contains valid `RegStorePayload`.
-        let payload_bytes = unsafe {
-            core::slice::from_raw_parts(
-                core::ptr::addr_of!(self.0.payload.regStore).cast::<u8>(),
-                core::mem::size_of::<RegStorePayload>(),
-            )
-        };
-        Ok(*RegStorePayload::from_bytes(payload_bytes).ok_or(EINVAL)?)
+        Ok(RegStorePayload(unsafe { self.0.payload.regStore }))
     }
 }
 

-- 
2.53.0


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

* [PATCH v3 4/8] gpu: nova-core: gsp: remove unneeded sequencer trait
  2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
                   ` (2 preceding siblings ...)
  2026-02-17  2:45 ` [PATCH v3 3/8] gpu: nova-core: gsp: simplify sequencer opcode parsing Alexandre Courbot
@ 2026-02-17  2:45 ` Alexandre Courbot
  2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
  2026-02-17  2:45 ` [PATCH v3 5/8] gpu: nova-core: gsp: derive `Debug` on more sequencer types Alexandre Courbot
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Alexandre Courbot @ 2026-02-17  2:45 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, Eliot Courtney, nouveau, dri-devel, linux-kernel,
	rust-for-linux, Alexandre Courbot, Lyude Paul, Gary Guo

The `GspSeqCmdRunner` trait is never used as we never call the `run`
methods from generic code. Remove it.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/sequencer.rs | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs
index e415a2aa3203..9278ffd5216d 100644
--- a/drivers/gpu/nova-core/gsp/sequencer.rs
+++ b/drivers/gpu/nova-core/gsp/sequencer.rs
@@ -144,12 +144,7 @@ pub(crate) struct GspSequencer<'a> {
     dev: ARef<device::Device>,
 }
 
-/// Trait for running sequencer commands.
-pub(crate) trait GspSeqCmdRunner {
-    fn run(&self, sequencer: &GspSequencer<'_>) -> Result;
-}
-
-impl GspSeqCmdRunner for fw::RegWritePayload {
+impl fw::RegWritePayload {
     fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
         let addr = usize::from_safe_cast(self.addr());
 
@@ -157,7 +152,7 @@ fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
     }
 }
 
-impl GspSeqCmdRunner for fw::RegModifyPayload {
+impl fw::RegModifyPayload {
     fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
         let addr = usize::from_safe_cast(self.addr());
 
@@ -169,7 +164,7 @@ fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
     }
 }
 
-impl GspSeqCmdRunner for fw::RegPollPayload {
+impl fw::RegPollPayload {
     fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
         let addr = usize::from_safe_cast(self.addr());
 
@@ -194,14 +189,14 @@ fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
     }
 }
 
-impl GspSeqCmdRunner for fw::DelayUsPayload {
+impl fw::DelayUsPayload {
     fn run(&self, _sequencer: &GspSequencer<'_>) -> Result {
         fsleep(Delta::from_micros(i64::from(self.val())));
         Ok(())
     }
 }
 
-impl GspSeqCmdRunner for fw::RegStorePayload {
+impl fw::RegStorePayload {
     fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
         let addr = usize::from_safe_cast(self.addr());
 
@@ -209,7 +204,7 @@ fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
     }
 }
 
-impl GspSeqCmdRunner for GspSeqCmd {
+impl GspSeqCmd {
     fn run(&self, seq: &GspSequencer<'_>) -> Result {
         match self {
             GspSeqCmd::RegWrite(cmd) => cmd.run(seq),

-- 
2.53.0


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

* [PATCH v3 5/8] gpu: nova-core: gsp: derive `Debug` on more sequencer types
  2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
                   ` (3 preceding siblings ...)
  2026-02-17  2:45 ` [PATCH v3 4/8] gpu: nova-core: gsp: remove unneeded sequencer trait Alexandre Courbot
@ 2026-02-17  2:45 ` Alexandre Courbot
  2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
  2026-02-17  2:45 ` [PATCH v3 6/8] gpu: nova-core: gsp: derive Zeroable for GspStaticConfigInfo Alexandre Courbot
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Alexandre Courbot @ 2026-02-17  2:45 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, Eliot Courtney, nouveau, dri-devel, linux-kernel,
	rust-for-linux, Alexandre Courbot, Lyude Paul, Gary Guo

Being able to print these is useful when debugging the sequencer.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/fw.rs        | 10 +++++-----
 drivers/gpu/nova-core/gsp/sequencer.rs |  1 +
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
index 624f5670ed50..f1797e1f0d9d 100644
--- a/drivers/gpu/nova-core/gsp/fw.rs
+++ b/drivers/gpu/nova-core/gsp/fw.rs
@@ -330,7 +330,7 @@ fn from(value: SeqBufOpcode) -> Self {
 
 /// Wrapper for GSP sequencer register write payload.
 #[repr(transparent)]
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
 pub(crate) struct RegWritePayload(bindings::GSP_SEQ_BUF_PAYLOAD_REG_WRITE);
 
 impl RegWritePayload {
@@ -353,7 +353,7 @@ unsafe impl AsBytes for RegWritePayload {}
 
 /// Wrapper for GSP sequencer register modify payload.
 #[repr(transparent)]
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
 pub(crate) struct RegModifyPayload(bindings::GSP_SEQ_BUF_PAYLOAD_REG_MODIFY);
 
 impl RegModifyPayload {
@@ -381,7 +381,7 @@ unsafe impl AsBytes for RegModifyPayload {}
 
 /// Wrapper for GSP sequencer register poll payload.
 #[repr(transparent)]
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
 pub(crate) struct RegPollPayload(bindings::GSP_SEQ_BUF_PAYLOAD_REG_POLL);
 
 impl RegPollPayload {
@@ -414,7 +414,7 @@ unsafe impl AsBytes for RegPollPayload {}
 
 /// Wrapper for GSP sequencer delay payload.
 #[repr(transparent)]
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
 pub(crate) struct DelayUsPayload(bindings::GSP_SEQ_BUF_PAYLOAD_DELAY_US);
 
 impl DelayUsPayload {
@@ -432,7 +432,7 @@ unsafe impl AsBytes for DelayUsPayload {}
 
 /// Wrapper for GSP sequencer register store payload.
 #[repr(transparent)]
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
 pub(crate) struct RegStorePayload(bindings::GSP_SEQ_BUF_PAYLOAD_REG_STORE);
 
 impl RegStorePayload {
diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs
index 9278ffd5216d..0cfbedc47fcf 100644
--- a/drivers/gpu/nova-core/gsp/sequencer.rs
+++ b/drivers/gpu/nova-core/gsp/sequencer.rs
@@ -67,6 +67,7 @@ fn read(
 /// 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),

-- 
2.53.0


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

* [PATCH v3 6/8] gpu: nova-core: gsp: derive Zeroable for GspStaticConfigInfo
  2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
                   ` (4 preceding siblings ...)
  2026-02-17  2:45 ` [PATCH v3 5/8] gpu: nova-core: gsp: derive `Debug` on more sequencer types Alexandre Courbot
@ 2026-02-17  2:45 ` Alexandre Courbot
  2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
  2026-02-17  2:45 ` [PATCH v3 7/8] gpu: nova-core: use core library's CStr instead of kernel one Alexandre Courbot
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: Alexandre Courbot @ 2026-02-17  2:45 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, Eliot Courtney, nouveau, dri-devel, linux-kernel,
	rust-for-linux, Alexandre Courbot, Lyude Paul

We can now derive `Zeroable` on tuple structs, so do this instead of
providing our own implementation.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/fw/commands.rs | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 21be44199693..67f44421fcc3 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -107,6 +107,7 @@ 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 {
@@ -122,7 +123,3 @@ unsafe impl AsBytes for GspStaticConfigInfo {}
 // SAFETY: This struct only contains integer types for which all bit patterns
 // are valid.
 unsafe impl FromBytes for GspStaticConfigInfo {}
-
-// SAFETY: This struct only contains integer types and fixed-size arrays for which
-// all bit patterns are valid.
-unsafe impl Zeroable for GspStaticConfigInfo {}

-- 
2.53.0


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

* [PATCH v3 7/8] gpu: nova-core: use core library's CStr instead of kernel one
  2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
                   ` (5 preceding siblings ...)
  2026-02-17  2:45 ` [PATCH v3 6/8] gpu: nova-core: gsp: derive Zeroable for GspStaticConfigInfo Alexandre Courbot
@ 2026-02-17  2:45 ` Alexandre Courbot
  2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
  2026-02-17  2:45 ` [PATCH v3 8/8] gpu: nova-core: gsp: use available device reference Alexandre Courbot
  2026-02-17  5:48 ` Claude review: gpu: nova-core: miscellaneous improvements Claude Code Review Bot
  8 siblings, 1 reply; 18+ messages in thread
From: Alexandre Courbot @ 2026-02-17  2:45 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, Eliot Courtney, nouveau, dri-devel, linux-kernel,
	rust-for-linux, Alexandre Courbot, Lyude Paul, Gary Guo

The kernel's own CStr type has been replaced by the one in the core
library, and is now an alias to the latter. Change our imports to
directly reference the actual type.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/firmware.rs     | 2 +-
 drivers/gpu/nova-core/firmware/gsp.rs | 6 +++++-
 drivers/gpu/nova-core/nova_core.rs    | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova-core/firmware.rs
index 68779540aa28..2f7249383e51 100644
--- a/drivers/gpu/nova-core/firmware.rs
+++ b/drivers/gpu/nova-core/firmware.rs
@@ -424,7 +424,7 @@ const fn make_entry_chipset(self, chipset: &str) -> Self {
     }
 
     pub(crate) const fn create(
-        module_name: &'static kernel::str::CStr,
+        module_name: &'static core::ffi::CStr,
     ) -> firmware::ModInfoBuilder<N> {
         let mut this = Self(firmware::ModInfoBuilder::new(module_name));
         let mut i = 0;
diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs
index 9488a626352f..ae3f6581c5b6 100644
--- a/drivers/gpu/nova-core/firmware/gsp.rs
+++ b/drivers/gpu/nova-core/firmware/gsp.rs
@@ -32,9 +32,13 @@
 /// that scheme before nova-core becomes stable, which means this module will eventually be
 /// removed.
 mod elf {
+    use core::{
+        ffi::CStr,
+        mem::size_of, //
+    };
+
     use kernel::{
         bindings,
-        prelude::*,
         transmute::FromBytes, //
     };
 
diff --git a/drivers/gpu/nova-core/nova_core.rs b/drivers/gpu/nova-core/nova_core.rs
index c1121e7c64c5..b5caf1044697 100644
--- a/drivers/gpu/nova-core/nova_core.rs
+++ b/drivers/gpu/nova-core/nova_core.rs
@@ -18,7 +18,7 @@
 mod sbuffer;
 mod vbios;
 
-pub(crate) const MODULE_NAME: &kernel::str::CStr = <LocalModule as kernel::ModuleMetadata>::NAME;
+pub(crate) const MODULE_NAME: &core::ffi::CStr = <LocalModule as kernel::ModuleMetadata>::NAME;
 
 kernel::module_pci_driver! {
     type: driver::NovaCore,

-- 
2.53.0


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

* [PATCH v3 8/8] gpu: nova-core: gsp: use available device reference
  2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
                   ` (6 preceding siblings ...)
  2026-02-17  2:45 ` [PATCH v3 7/8] gpu: nova-core: use core library's CStr instead of kernel one Alexandre Courbot
@ 2026-02-17  2:45 ` Alexandre Courbot
  2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
  2026-02-17  5:48 ` Claude review: gpu: nova-core: miscellaneous improvements Claude Code Review Bot
  8 siblings, 1 reply; 18+ messages in thread
From: Alexandre Courbot @ 2026-02-17  2:45 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, Eliot Courtney, nouveau, dri-devel, linux-kernel,
	rust-for-linux, Alexandre Courbot, Gary Guo

We already have a regular reference to the `Device`, so we don't need to
repeatedly acquire one in this method.

Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/boot.rs | 34 ++++++++--------------------------
 1 file changed, 8 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs
index be427fe26a58..93651243ab1b 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -170,15 +170,10 @@ pub(crate) fn boot(
             Some(libos_handle as u32),
             Some((libos_handle >> 32) as u32),
         )?;
-        dev_dbg!(
-            pdev.as_ref(),
-            "GSP MBOX0: {:#x}, MBOX1: {:#x}\n",
-            mbox0,
-            mbox1
-        );
+        dev_dbg!(dev, "GSP MBOX0: {:#x}, MBOX1: {:#x}\n", mbox0, mbox1);
 
         dev_dbg!(
-            pdev.as_ref(),
+            dev,
             "Using SEC2 to load and run the booter_load firmware...\n"
         );
 
@@ -190,19 +185,10 @@ pub(crate) fn boot(
             Some(wpr_handle as u32),
             Some((wpr_handle >> 32) as u32),
         )?;
-        dev_dbg!(
-            pdev.as_ref(),
-            "SEC2 MBOX0: {:#x}, MBOX1{:#x}\n",
-            mbox0,
-            mbox1
-        );
+        dev_dbg!(dev, "SEC2 MBOX0: {:#x}, MBOX1{:#x}\n", mbox0, mbox1);
 
         if mbox0 != 0 {
-            dev_err!(
-                pdev.as_ref(),
-                "Booter-load failed with error {:#x}\n",
-                mbox0
-            );
+            dev_err!(dev, "Booter-load failed with error {:#x}\n", mbox0);
             return Err(ENODEV);
         }
 
@@ -216,11 +202,7 @@ pub(crate) fn boot(
             Delta::from_secs(5),
         )?;
 
-        dev_dbg!(
-            pdev.as_ref(),
-            "RISC-V active? {}\n",
-            gsp_falcon.is_riscv_active(bar),
-        );
+        dev_dbg!(dev, "RISC-V active? {}\n", gsp_falcon.is_riscv_active(bar),);
 
         // Create and run the GSP sequencer.
         let seq_params = GspSequencerParams {
@@ -228,7 +210,7 @@ pub(crate) fn boot(
             libos_dma_handle: libos_handle,
             gsp_falcon,
             sec2_falcon,
-            dev: pdev.as_ref().into(),
+            dev: dev.into(),
             bar,
         };
         GspSequencer::run(&mut self.cmdq, seq_params)?;
@@ -239,8 +221,8 @@ pub(crate) fn boot(
         // Obtain and display basic GPU information.
         let info = commands::get_gsp_info(&mut self.cmdq, bar)?;
         match info.gpu_name() {
-            Ok(name) => dev_info!(pdev.as_ref(), "GPU name: {}\n", name),
-            Err(e) => dev_warn!(pdev.as_ref(), "GPU name unavailable: {:?}\n", e),
+            Ok(name) => dev_info!(dev, "GPU name: {}\n", name),
+            Err(e) => dev_warn!(dev, "GPU name unavailable: {:?}\n", e),
         }
 
         Ok(())

-- 
2.53.0


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

* Claude review: gpu: nova-core: miscellaneous improvements
  2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
                   ` (7 preceding siblings ...)
  2026-02-17  2:45 ` [PATCH v3 8/8] gpu: nova-core: gsp: use available device reference Alexandre Courbot
@ 2026-02-17  5:48 ` Claude Code Review Bot
  8 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-02-17  5:48 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: gpu: nova-core: miscellaneous improvements
Author: Alexandre Courbot <acourbot@nvidia.com>
Patches: 9
Reviewed: 2026-02-17T15:48:06.496317

---

This is an 8-patch series of miscellaneous cleanups and improvements for nova-core, the Rust-based NVIDIA GPU driver. The patches are authored by Alexandre Courbot and most carry Reviewed-by tags from Lyude Paul and/or Gary Guo. The series is straightforward: it adds a diagnostic warning for unprocessed GSP message data, removes dead code (unused `Display` impls and an unused trait), simplifies sequencer opcode parsing by reading union fields directly, adds `Debug` derives, switches from the kernel's `CStr` alias to the underlying `core::ffi::CStr`, and replaces repeated `pdev.as_ref()` calls with an existing local `dev` reference.

The overall approach is sound. The patches are well-ordered: patch 2 removes `Display` impls before patch 5 adds `Debug` derives (avoiding confusion), and patch 3 simplifies union access before patch 4 removes the now-unnecessary trait. Each patch is independently correct and the series doesn't introduce any regressions.

I found one minor pre-existing formatting issue that the series carries forward, but no bugs or correctness problems in the new code.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: gpu: nova-core: gsp: warn if data remains after processing a message
  2026-02-17  2:45 ` [PATCH v3 1/8] gpu: nova-core: gsp: warn if data remains after processing a message Alexandre Courbot
@ 2026-02-17  5:48   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-02-17  5:48 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

This patch uses `.inspect()` on the `Result` to check whether the `SBufferIter` still has unprocessed data after `M::read()` completes. The use of `inspect` is appropriate - it only runs the closure on `Ok`, which is the right time to check for leftover data. The `function` variable is in scope (defined at line 656 of the original), so the debug format works correctly.

> +            M::read(cmd, &mut sbuffer)
> +                .map_err(|e| e.into())
> +                .inspect(|_| {
> +                    if !sbuffer.is_empty() {
> +                        dev_warn!(
> +                            &self.dev,
> +                            "GSP message {:?} has unprocessed data\n",
> +                            function
> +                        );
> +                    }
> +                })

One observation: `inspect` runs after `map_err`, so if `M::read` returns an error, we don't warn about unprocessed data. That seems intentional - if the read failed, there's no point warning about leftover bytes.

Note that `function` is formatted with `{:?}` (Debug format). The existing code in `send_command` uses `{}` (Display format) for the same type, but patch 2 removes the `Display` impl and changes that to `{:?}` as well - so the series is self-consistent.

No issues found.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: gpu: nova-core: gsp: remove unnecessary Display impls
  2026-02-17  2:45 ` [PATCH v3 2/8] gpu: nova-core: gsp: remove unnecessary Display impls Alexandre Courbot
@ 2026-02-17  5:48   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-02-17  5:48 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

This removes hand-written `Display` implementations for `MsgFunction` and `SeqBufOpcode` in favor of their derived `Debug` impls. The format string in `send_command` is updated from `{}` to `{:?}` to match.

> -            "GSP RPC: send: seq# {}, function={}, length=0x{:x}\n",
> +            "GSP RPC: send: seq# {}, function={:?}, length=0x{:x}\n",

The `fmt` import is also removed from the `use kernel` block. Clean and straightforward.

No issues found.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: gpu: nova-core: gsp: simplify sequencer opcode parsing
  2026-02-17  2:45 ` [PATCH v3 3/8] gpu: nova-core: gsp: simplify sequencer opcode parsing Alexandre Courbot
@ 2026-02-17  5:48   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-02-17  5:48 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

This replaces the roundabout pattern of creating a byte slice from the union field and then parsing it via `FromBytes` with a direct read of the union field. The safety comments are preserved and correct - the opcode is checked before accessing the union, so the union field access is valid.

> -        let payload_bytes = unsafe {
> -            core::slice::from_raw_parts(
> -                core::ptr::addr_of!(self.0.payload.regWrite).cast::<u8>(),
> -                core::mem::size_of::<RegWritePayload>(),
> -            )
> -        };
> -        Ok(*RegWritePayload::from_bytes(payload_bytes).ok_or(EINVAL)?)
> +        Ok(RegWritePayload(unsafe { self.0.payload.regWrite }))

Since the payload types are `#[repr(transparent)]` wrappers around the binding types, constructing them directly from the union field is sound. The `from_bytes` call could never fail anyway (the types implement `FromBytes`), so removing it doesn't change behavior - it just removes unnecessary indirection. The same pattern is repeated for all five payload types.

No issues found.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: gpu: nova-core: gsp: remove unneeded sequencer trait
  2026-02-17  2:45 ` [PATCH v3 4/8] gpu: nova-core: gsp: remove unneeded sequencer trait Alexandre Courbot
@ 2026-02-17  5:48   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-02-17  5:48 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

The `GspSeqCmdRunner` trait with its single method `fn run(&self, sequencer: &GspSequencer<'_>) -> Result` is removed in favor of inherent `run` methods on each payload type and on `GspSeqCmd`. Since the trait was never used for dynamic dispatch or generic code, the inherent methods work identically.

> -/// Trait for running sequencer commands.
> -pub(crate) trait GspSeqCmdRunner {
> -    fn run(&self, sequencer: &GspSequencer<'_>) -> Result;
> -}
> -
> -impl GspSeqCmdRunner for fw::RegWritePayload {
> +impl fw::RegWritePayload {

No issues found.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: gpu: nova-core: gsp: derive `Debug` on more sequencer types
  2026-02-17  2:45 ` [PATCH v3 5/8] gpu: nova-core: gsp: derive `Debug` on more sequencer types Alexandre Courbot
@ 2026-02-17  5:48   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-02-17  5:48 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Adds `#[derive(Debug)]` to the five payload wrapper types and to the `GspSeqCmd` enum. The wrapper types are `#[repr(transparent)]` over bindgen-generated structs. Since bindgen-generated structs for these GSP payloads typically derive `Debug`, the derived `Debug` on the transparent wrapper will work. Even if the inner binding type doesn't implement `Debug`, this wouldn't compile, so there's no risk of a subtle runtime issue.

> +#[derive(Copy, Clone, Debug)]
> pub(crate) struct RegWritePayload(bindings::GSP_SEQ_BUF_PAYLOAD_REG_WRITE);

> +#[derive(Debug)]
> pub(crate) enum GspSeqCmd {

No issues found.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: gpu: nova-core: gsp: derive Zeroable for GspStaticConfigInfo
  2026-02-17  2:45 ` [PATCH v3 6/8] gpu: nova-core: gsp: derive Zeroable for GspStaticConfigInfo Alexandre Courbot
@ 2026-02-17  5:48   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-02-17  5:48 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Replaces a manual `unsafe impl Zeroable` with `#[derive(Zeroable)]`. The safety justification ("This struct only contains integer types and fixed-size arrays for which all bit patterns are valid") is removed along with the manual impl.

> +#[derive(Zeroable)]
> pub(crate) struct GspStaticConfigInfo(bindings::GspStaticConfigInfo_t);

Since `GspStaticConfigInfo` is `#[repr(transparent)]` over a bindgen type, the derive macro needs the inner type to also be `Zeroable`. The commit message says the derive macro now works on tuple structs, so presumably the infrastructure handles this. If `bindings::GspStaticConfigInfo_t` doesn't implement `Zeroable`, the derive would fail at compile time, so this is safe.

No issues found.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: gpu: nova-core: use core library's CStr instead of kernel one
  2026-02-17  2:45 ` [PATCH v3 7/8] gpu: nova-core: use core library's CStr instead of kernel one Alexandre Courbot
@ 2026-02-17  5:48   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-02-17  5:48 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

Changes three files to use `core::ffi::CStr` instead of `kernel::str::CStr`. In the `elf` submodule of `firmware/gsp.rs`, the `kernel::prelude::*` import is replaced with a targeted import of just `kernel::bindings` and `kernel::transmute::FromBytes`, while `CStr` and `size_of` come from `core` directly.

> +    use core::{
> +        ffi::CStr,
> +        mem::size_of, //
> +    };
> +
>      use kernel::{
>          bindings,
> -        prelude::*,
>          transmute::FromBytes, //
>      };

The removal of `prelude::*` in the `elf` submodule is fine since the only thing the submodule used from the prelude was `CStr` (the submodule doesn't use `Result`, `Vec`, or other prelude items, as confirmed by inspecting the code). `size_of` was already imported via `core::mem::size_of` in the existing code.

No issues found.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: gpu: nova-core: gsp: use available device reference
  2026-02-17  2:45 ` [PATCH v3 8/8] gpu: nova-core: gsp: use available device reference Alexandre Courbot
@ 2026-02-17  5:48   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-02-17  5:48 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

This patch replaces `pdev.as_ref()` with `dev` in the `boot` method, where `dev` is already defined as `let dev = pdev.as_ref()` at the top of the function. The one place where `pdev.as_ref().into()` was used is changed to `dev.into()`.

> -        dev: pdev.as_ref().into(),
> +        dev: dev.into(),

I notice a pre-existing issue in the format string that the patch carries forward:

> +        dev_dbg!(dev, "SEC2 MBOX0: {:#x}, MBOX1{:#x}\n", mbox0, mbox1);

There's a missing colon and space after `MBOX1` - it reads `MBOX1{:#x}` instead of `MBOX1: {:#x}`. This exists in the original code too, so it's not introduced by this patch, but it might be worth a drive-by fix since the line is already being modified.

Also, there's a trailing comma in the reformatted debug line:

> +        dev_dbg!(dev, "RISC-V active? {}\n", gsp_falcon.is_riscv_active(bar),);

The trailing comma before `)` is valid Rust syntax (trailing commas are allowed in macro invocations), so this is purely a style observation. It appears to be an artifact of reformatting the multi-line original into a single line.

No correctness issues found.

---
Generated by Claude Code Patch Reviewer

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

end of thread, other threads:[~2026-02-17  5:48 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-17  2:45 [PATCH v3 0/8] gpu: nova-core: miscellaneous improvements Alexandre Courbot
2026-02-17  2:45 ` [PATCH v3 1/8] gpu: nova-core: gsp: warn if data remains after processing a message Alexandre Courbot
2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
2026-02-17  2:45 ` [PATCH v3 2/8] gpu: nova-core: gsp: remove unnecessary Display impls Alexandre Courbot
2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
2026-02-17  2:45 ` [PATCH v3 3/8] gpu: nova-core: gsp: simplify sequencer opcode parsing Alexandre Courbot
2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
2026-02-17  2:45 ` [PATCH v3 4/8] gpu: nova-core: gsp: remove unneeded sequencer trait Alexandre Courbot
2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
2026-02-17  2:45 ` [PATCH v3 5/8] gpu: nova-core: gsp: derive `Debug` on more sequencer types Alexandre Courbot
2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
2026-02-17  2:45 ` [PATCH v3 6/8] gpu: nova-core: gsp: derive Zeroable for GspStaticConfigInfo Alexandre Courbot
2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
2026-02-17  2:45 ` [PATCH v3 7/8] gpu: nova-core: use core library's CStr instead of kernel one Alexandre Courbot
2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
2026-02-17  2:45 ` [PATCH v3 8/8] gpu: nova-core: gsp: use available device reference Alexandre Courbot
2026-02-17  5:48   ` Claude review: " Claude Code Review Bot
2026-02-17  5:48 ` Claude review: gpu: nova-core: miscellaneous improvements Claude Code Review Bot

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