Re: [PATCH v2 8/9] gpu: nova-core: gsp: support large RPCs via continuation record
From: Alexandre Courbot
Date: Wed Feb 25 2026 - 23:41:01 EST
On Thu Feb 19, 2026 at 4:30 PM JST, Eliot Courtney wrote:
<snip>
> @@ -575,6 +579,39 @@ pub(crate) fn send_command<M>(&mut self, bar: &Bar0, command: M) -> Result
> Ok(())
> }
>
> + /// Sends `command` to the GSP.
> + ///
> + /// The command may be split into multiple messages if it is large.
> + ///
> + /// # Errors
> + ///
> + /// - `ETIMEDOUT` if space does not become available within the timeout.
> + /// - `EIO` if the variable payload requested by the command has not been entirely
> + /// written to by its [`CommandToGsp::init_variable_payload`] method.
> + ///
> + /// Error codes returned by the command initializers are propagated as-is.
> + pub(crate) fn send_command<M>(&mut self, bar: &Bar0, command: M) -> Result
> + where
> + M: CommandToGsp,
> + Error: From<M::InitError>,
> + {
> + let mut state = SplitState::new(&command)?;
> +
> + self.send_single_command(bar, state.command(command))?;
I think it would be nice to send the actual command (and not the
`SplitCommand`) when commands don't need to be split. Split commands are
supposed to be the exception, but the current code makes us use them
unconditionally.
So something like:
if command_size(&command) <= MAX_CMD_SIZE {
self.send_single_command(bar, command)
} else {
// Split and send the parts
...
}
would read better IMHO. You can have a
`SplitCommand::command_needs_splitting` method if you want to avoid
comparing against the const in `send_command`, but honestly I think this
is self-documenting already - you split the command because it is larger
than the maximum supported size of the queue.
It also would have the benefit of simplifying `SplitState` and
`SplitCommand` since they wouldn't have to handle the non-split case at
all. Actually you could just have a method that consumes the command and
returns a tuple with the `SplitCommand` wrapping it, and its
continuation records. That way I suspect you also remove the need to
pass `command` twice.