rust: core: implement rx580 state optimization engine and c-to-rust char dev
Subsystems (4)
PATCH 1/1 rust: core: implement rx580 state optimization engine and c-to-rust char dev
This patch introduces an automated indexed state mechanism to optimize VRAM latency and command loops for the Radeon RX 580 architecture. Additionally, it provides a converted C-to-Rust sample char driver.
Signed-off-by Breno Rodrigues Alves <[email protected]>
--- RUST_GUIDELINES.md | 3 ++ drivers/char/Kconfig | 8 +++++ drivers/char/Makefile | 1 + drivers/char/alves_char_dev.rs | 26 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/Kbuild | 1 + drivers/gpu/drm/amd/amdgpu/alves_core.rs | 45 ++++++++++++++++++++++++ 6 files changed, 84 insertions(+) create mode 100644 RUST_GUIDELINES.md create mode 100644 drivers/char/alves_char_dev.rs create mode 100644 drivers/gpu/drm/amd/amdgpu/Kbuild create mode 100644 drivers/gpu/drm/amd/amdgpu/alves_core.rs
RUST_GUIDELINES.md new file +3 -0
@@ -0,0 +1,3 @@ +# Rust for Linux - Core Guidelines +- Style: Linear, pragmatic, flat, Linus Torvalds style. +- Constraints: Zero-cost abstractions, strict RAII, no binary bloat.
drivers/char/Kconfig +8 -0
@@ -372,3 +372,11 @@ config ADI driver include crash and makedumpfile. endmenu +config ALVES_CHAR_DEV + tristate "Alves C-to-Rust Character Device Driver" + dependson RUST + help + This is a character device driver migrated from C to Rust. + It acts as a core showcase of 2% module conversions. + It provides foundational structures for execution validation. + Say Y or M here if you want to test the Rust infrastructure.
drivers/char/Makefile +1 -0
@@ -41,3 +41,4 @@ obj-$(CONFIG_PS3_FLASH) += ps3flash.o obj-$(CONFIG_XILLYBUS_CLASS) += xillybus/ obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o obj-$(CONFIG_ADI) += adi.o +obj-$(CONFIG_ALVES_CHAR_DEV) += alves_char_dev.o
drivers/char/alves_char_dev.rs new file +26 -0
@@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +//! Simple Character Device converted from legacy C to Rust. + +use kernel::prelude::*; +use kernel::chrdev::Registration ; + +module! { +type :AlvesCharDevice , + name:"alves_char_dev" , + author:"Breno Rodrigues Alves" , + description:"Pragmatic C-to-Rust converted character device driver" , + license:"GPL OR MIT" , +} + +struct AlvesCharDevice { + _dev:Registration , +} + +impl kernel::Module for AlvesCharDevice { + fn init(_module: $'static ThisModule$') -> Result<Self> { +pr_info! ("Alves C-to-Rust module initialized successfully\n" ); +Ok (AlvesCharDevice { + _dev:Registration ::new (c_str! ("alves_char_dev" ),0 )?, + }) + } +}
drivers/gpu/drm/amd/amdgpu/Kbuild new file +1 -0
@@ -0,0 +1 @@ +amdgpu-y += alves_core.o
drivers/gpu/drm/amd/amdgpu/alves_core.rs new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.43.0