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 <[email protected]> --- 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/[email protected] --- 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 <[email protected]>
