[PATCH v2 0/9] gpu: nova-core: gsp: add continuation record support

Eliot Courtney posted 9 patches 1 month, 2 weeks ago
There is a newer version of this series
drivers/gpu/nova-core/gsp/cmdq.rs                 | 118 +++++++---
drivers/gpu/nova-core/gsp/commands.rs             | 256 +++++++++++++++++++++-
drivers/gpu/nova-core/gsp/fw.rs                   | 106 +++++----
drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs |   1 +
rust/kernel/error.rs                              |   1 +
5 files changed, 408 insertions(+), 74 deletions(-)
[PATCH v2 0/9] gpu: nova-core: gsp: add continuation record support
Posted by Eliot Courtney 1 month, 2 weeks ago
GSP commands over 16 pages need to be sent using "continuation records"
which essentially means splitting the payload over multiple commands.

This series adds a command type `ContinuationRecord` which just writes
its header and whatever payload it is given. It also adds types
`SplitState` and `SplitCommand` which support splitting a large RPC
into smaller ones while transparently letting regular sized RPCs be sent
without extra copies.

The send pathway uses `SplitState` to send all commands, but if
the command fits into 16 pages, it still writes directly into the
command queue. If it is larger than 16 pages and needs continuation
records, it writes into a staging buffer, so there is one copy.

Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
Changes in v2:
- Added doccoments
- Renamed driver_bytes_available_to_write to driver_write_area_size
- allocate_command_with_timeout merged allocate_command with timeout parameter
- Replaced hardcoded GSP_PAGE_SIZE * 16 with bindings
- Changed oversized command error from EIO to EMSGSIZE
- Added EMSGSIZE to kernel/error.rs
- Split WrappingCommand functionality into SplitState + SplitCommand enum
- Made max_size a const (MAX_CMD_SIZE)
- Removed send_continuation_record + added comment for type inference
- send_single_command now consumes the command
- Extracted command_size + used in SplitState 
- Link to v1: https://lore.kernel.org/r/20260212-cmdq-continuation-v1-0-73079ded55e6@nvidia.com

---
Eliot Courtney (9):
      gpu: nova-core: gsp: sort MsgFunction variants alphabetically
      gpu: nova-core: gsp: add mechanism to wait for space on command queue
      rust: add EMSGSIZE error code
      gpu: nova-core: gsp: add checking oversized commands
      gpu: nova-core: gsp: clarify invariant on command queue
      gpu: nova-core: gsp: unconditionally call variable payload handling
      gpu: nova-core: gsp: add command_size helper
      gpu: nova-core: gsp: support large RPCs via continuation record
      gpu: nova-core: gsp: add tests for SplitState

 drivers/gpu/nova-core/gsp/cmdq.rs                 | 118 +++++++---
 drivers/gpu/nova-core/gsp/commands.rs             | 256 +++++++++++++++++++++-
 drivers/gpu/nova-core/gsp/fw.rs                   | 106 +++++----
 drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs |   1 +
 rust/kernel/error.rs                              |   1 +
 5 files changed, 408 insertions(+), 74 deletions(-)
---
base-commit: 956b9cbd7f156c8672dac94a00de3c6a0939c692
change-id: 20260203-cmdq-continuation-b99f3d5966c3

Best regards,
-- 
Eliot Courtney <ecourtney@nvidia.com>
Re: [PATCH v2 0/9] gpu: nova-core: gsp: add continuation record support
Posted by Alexandre Courbot 1 month, 1 week ago
Hi Eliot,

On Thu Feb 19, 2026 at 4:30 PM JST, Eliot Courtney wrote:
> GSP commands over 16 pages need to be sent using "continuation records"
> which essentially means splitting the payload over multiple commands.
>
> This series adds a command type `ContinuationRecord` which just writes
> its header and whatever payload it is given. It also adds types
> `SplitState` and `SplitCommand` which support splitting a large RPC
> into smaller ones while transparently letting regular sized RPCs be sent
> without extra copies.
>
> The send pathway uses `SplitState` to send all commands, but if
> the command fits into 16 pages, it still writes directly into the
> command queue. If it is larger than 16 pages and needs continuation
> records, it writes into a staging buffer, so there is one copy.
>
> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>

Thanks, this looks solid - unfortunately it fails to apply on top of
`drm-rust-next` (not your fault, the patchset was sent before -rc1 got
tagged). Patch 1 has a trivial conflict due to the removal of the
`Display` implementation, but patch 8 does not even give me the option
to resolve anything. Could you rebase on top of `drm-rust-next` and send
a v3? I would like to experiment a bit with patch 8 but cannot do it
unfortunately.
Re: [PATCH v2 0/9] gpu: nova-core: gsp: add continuation record support
Posted by Zhi Wang 1 month, 1 week ago
On Thu, 19 Feb 2026 16:30:49 +0900
Eliot Courtney <ecourtney@nvidia.com> wrote:

Tested-by: Zhi Wang <zhiw@nvidia.com>

> GSP commands over 16 pages need to be sent using "continuation
> records" which essentially means splitting the payload over multiple
> commands.
> 
> This series adds a command type `ContinuationRecord` which just writes
> its header and whatever payload it is given. It also adds types
> `SplitState` and `SplitCommand` which support splitting a large RPC
> into smaller ones while transparently letting regular sized RPCs be
> sent without extra copies.
> 
> The send pathway uses `SplitState` to send all commands, but if
> the command fits into 16 pages, it still writes directly into the
> command queue. If it is larger than 16 pages and needs continuation
> records, it writes into a staging buffer, so there is one copy.
> 
> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
> ---
> Changes in v2:
> - Added doccoments
> - Renamed driver_bytes_available_to_write to driver_write_area_size
> - allocate_command_with_timeout merged allocate_command with timeout
> parameter
> - Replaced hardcoded GSP_PAGE_SIZE * 16 with bindings
> - Changed oversized command error from EIO to EMSGSIZE
> - Added EMSGSIZE to kernel/error.rs
> - Split WrappingCommand functionality into SplitState + SplitCommand
> enum
> - Made max_size a const (MAX_CMD_SIZE)
> - Removed send_continuation_record + added comment for type inference
> - send_single_command now consumes the command
> - Extracted command_size + used in SplitState 
> - Link to v1:
> https://lore.kernel.org/r/20260212-cmdq-continuation-v1-0-73079ded55e6@nvidia.com
> 
> ---
> Eliot Courtney (9):
>       gpu: nova-core: gsp: sort MsgFunction variants alphabetically
>       gpu: nova-core: gsp: add mechanism to wait for space on command
> queue rust: add EMSGSIZE error code
>       gpu: nova-core: gsp: add checking oversized commands
>       gpu: nova-core: gsp: clarify invariant on command queue
>       gpu: nova-core: gsp: unconditionally call variable payload
> handling gpu: nova-core: gsp: add command_size helper
>       gpu: nova-core: gsp: support large RPCs via continuation record
>       gpu: nova-core: gsp: add tests for SplitState
> 
>  drivers/gpu/nova-core/gsp/cmdq.rs                 | 118 +++++++---
>  drivers/gpu/nova-core/gsp/commands.rs             | 256
> +++++++++++++++++++++- drivers/gpu/nova-core/gsp/fw.rs
>    | 106 +++++---- drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs
> |   1 + rust/kernel/error.rs                              |   1 +
>  5 files changed, 408 insertions(+), 74 deletions(-)
> ---
> base-commit: 956b9cbd7f156c8672dac94a00de3c6a0939c692
> change-id: 20260203-cmdq-continuation-b99f3d5966c3
> 
> Best regards,