This revision features a more adequate method for receiving messages, and some general cleanup. It looks solid to me, and although there are further minor improvements I want to eventually see I think it makes an adequate first milestone.
I am considering merging this before -rc6, so it can make it into 6.19. If there are reasons not to, please scream. :) A branch including this series and its dependencies is available at [1]. [1] https://github.com/Gnurou/linux/tree/b4/gsp_boot Changes in v9: - More doccomments. - Use the `MessageFromGsp` trait instead of an arbitrary closure to extract incoming messages from the message queue. - Split the message receiving method into a non-generic transport layer receive, and the generic part validating and constructing the message. - Use well-defined types for sending and receiving messages instead of error-prone tuples. - Link to v8: https://lore.kernel.org/r/[email protected] Changes in v8: - Add lots of doccomments. - Refactor and simplify GSP command sending - now uses a single trait and a single method. - Leverage the new `from_bytes_prefix` family of methods to simplify GSP command queue code a bit. - Simplify RM arguments. - Split the `GspSetSystemInfo` and `SetRegistry` commands into their own patch. - Add a `is_empty` method to `SBufferIter` and use it to detect when a command's variable length payload has not been entirely written. - Harmonize imports according to new format rules. - Link to v7: https://lore.kernel.org/r/[email protected] Changes in v7: - Remove `as` conversions by using the features of the `num` module. - Add build-time conversion of constant integer values to smaller types. - Thanks to the two items above, make more functions infallible. - Remove unneeded `nr_ptes` member of the `Cmdq`. - Use `repr(u32)` for `MsgFunction` to simplify it. - Use `from_ref` instead of casting references into pointers with `as`. - Add message header version type to remove use of magic number. - Switch some parameters to `usize` to limit type conversions. - Add comments for undocumented functions. - Remove `function_number` method of `GspMsgElement` and return invalid function numbers as the error value of `function` instead. - Work around the renaming of `slice::flatten` to `slice::as_flattened` in Rust 1.80 (thanks Miguel!). - Fix clippy warning with Rust 1.78. - Link to v6: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Alexandre Courbot <[email protected]> --- Alexandre Courbot (3): gpu: nova-core: compute layout of more framebuffer regions required for GSP gpu: nova-core: num: add functions to safely convert a const value to a smaller type rust: enable slice_flatten feature and provide it through an extension trait Alistair Popple (9): gpu: nova-core: Set correct DMA mask gpu: nova-core: Create initial Gsp gpu: nova-core: gsp: Create wpr metadata gpu: nova-core: Add zeroable trait to bindings gpu: nova-core: gsp: Add GSP command queue bindings and handling gpu: nova-core: gsp: Create rmargs gpu: nova-core: gsp: Add SetSystemInfo command gpu: nova-core: gsp: Add SetRegistry command gpu: nova-core: gsp: Boot GSP Joel Fernandes (3): gpu: nova-core: Add a slice-buffer (sbuffer) datastructure gpu: nova-core: falcon: Add support to check if RISC-V is active gpu: nova-core: falcon: Add support to write firmware version drivers/gpu/nova-core/driver.rs | 16 + drivers/gpu/nova-core/falcon.rs | 15 + drivers/gpu/nova-core/fb.rs | 72 ++- drivers/gpu/nova-core/firmware/gsp.rs | 7 +- drivers/gpu/nova-core/firmware/riscv.rs | 11 +- drivers/gpu/nova-core/gpu.rs | 2 +- drivers/gpu/nova-core/gsp.rs | 156 ++++- drivers/gpu/nova-core/gsp/boot.rs | 85 ++- drivers/gpu/nova-core/gsp/cmdq.rs | 680 +++++++++++++++++++++ drivers/gpu/nova-core/gsp/commands.rs | 129 ++++ drivers/gpu/nova-core/gsp/fw.rs | 608 ++++++++++++++++++- drivers/gpu/nova-core/gsp/fw/commands.rs | 106 ++++ drivers/gpu/nova-core/gsp/fw/r570_144.rs | 6 +- drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs | 703 ++++++++++++++++++++++ drivers/gpu/nova-core/nova_core.rs | 1 + drivers/gpu/nova-core/num.rs | 51 ++ drivers/gpu/nova-core/regs.rs | 17 +- drivers/gpu/nova-core/sbuffer.rs | 228 +++++++ init/Kconfig | 3 + rust/kernel/lib.rs | 4 + rust/kernel/prelude.rs | 3 + rust/kernel/slice.rs | 49 ++ 22 files changed, 2918 insertions(+), 34 deletions(-) --- base-commit: 80b3dc0a5a2e51fb2b8f3406f5ee20ad4a652316 change-id: 20251027-gsp_boot-c6bb048a304e Best regards, -- Alexandre Courbot <[email protected]>
