Re: [PATCH v3 30/33] gpu: nova-core: match GSP RPC replies by sequence, not just function

From: Alexandre Courbot

Date: Wed Sep 23 2026 - 11:29:18 EST


On Fri Sep 18, 2026 at 10:07 AM JST, John Hubbard wrote:
<...>
> @@ -663,7 +665,7 @@ pub(crate) fn await_msg<M: MessageFromGsp>(&self) -> Result<M>
> // This allows all error types, including `Infallible`, to be used for `M::InitError`.
> Error: From<M::InitError>,
> {
> - self.inner.lock().await_msg()
> + self.inner.lock().await_msg(None)
> }
>
> /// Logs and consumes every message the GSP has already posted, and returns without waiting for
> @@ -685,8 +687,9 @@ pub(crate) fn drain(&self) -> Result {
> struct CmdqInner<'a> {
> /// Device this command queue belongs to.
> dev: &'a device::Device,
> - /// Current command sequence number.
> - seq: u32,
> + /// Next RPC sequence number, advanced once per command, however many messages the command is
> + /// split into.
> + rpc_seq: u32,

This renaming of `seq` into `rpc_seq` does not seem to serve any purpose
and introduces a lot of churn.

> /// Set once a message fails framing validation. Every later receive fails, since
> /// the bad message cannot be skipped. See "Draining the GSP-to-CPU queue" in
> /// `Documentation/gpu/nova/core/interrupts.rst`.
> @@ -711,7 +714,7 @@ impl CmdqInner<'_> {
> /// written to by its [`CommandToGsp::init_variable_payload`] method.
> ///
> /// Error codes returned by the command initializers are propagated as-is.
> - fn send_single_command<M>(&mut self, command: M) -> Result
> + fn send_single_command<M>(&mut self, command: M, rpc_seq: u32) -> Result

Passing `rpc_seq` here looks wrong since we already should have that
data available from `self`. And IIUC it's also easily avoidable by
increasing `self.rpc_seq` *after* the split state handling in
`send_command` (running it in a closure to capture the result if we also
want to increase in case or error).