Helix uses a modular driver architecture where drivers are implemented as kernel modules that can be loaded, unloaded, and hot-reloaded at runtime.
Driver Model — Layer Stack 5N · 4E ▶ Kernel Subsystems filesystem, network,… 1 Driver Interface Layer Standardized device … 2 Driver Module Framework helix-modules 2 HAL Hardware Access helix-hal 2 ■ Hardware Physical devices 1
☝ Drag to pan · 🤏 Pinch to zoom · Tap a node
Ctrl+F Search
P Path
S Stats
F Fullscreen
E Export
Shift+Drag Move node
↑↓ Navigate
+/− Zoom
Each driver category implements a specific trait:
pub trait BlockDevice : Send + Sync {
fn read_block ( & self , lba : u64 , buf : & mut [ u8 ] ) -> Result < ( ) > ;
fn write_block ( & self , lba : u64 , buf : & [ u8 ] ) -> Result < ( ) > ;
fn flush ( & self ) -> Result < ( ) > ;
fn block_size ( & self ) -> u32 ;
fn total_blocks ( & self ) -> u64 ;
pub trait NetworkDevice : Send + Sync {
fn send ( & self , packet : & [ u8 ] ) -> Result < ( ) > ;
fn recv ( & self , buf : & mut [ u8 ] ) -> Result < usize > ;
fn mac_address ( & self ) -> [ u8 ; 6 ] ;
fn link_speed ( & self ) -> u64 ;
fn is_link_up ( & self ) -> bool ;
pub trait GpuDevice : Send + Sync {
fn init ( & mut self ) -> Result < ( ) > ;
fn submit_commands ( & self , cmds : & CommandBuffer ) -> Result < ( ) > ;
fn allocate_memory ( & mut self , size : usize , flags : MemFlags ) -> Result < GpuAlloc > ;
fn free_memory ( & mut self , alloc : GpuAlloc ) -> Result < ( ) > ;
Index BlockDevice read_block write_block flush block_size total_blocks NetworkDevice send recv mac_address link_speed is_link_up GpuDevice init submit_commands allocate_memory free_memory
The Magma GPU driver (drivers/gpu/magma/) is currently the only hardware driver in Helix. It's a massive undertaking with 52+ sub-crates targeting NVIDIA-compatible GPU hardware.
Magma GPU Driver — Architecture 8N · 7E ▶ magma/ GPU driver stack 7 magma-core/ Core GPU abstraction… 1 magma-hal/ Hardware abstraction 1 magma-mem/ Memory management 1 magma-cmd/ Command processing 1 magma-rpc/ Firmware interface 1 magma-gl/ OpenGL 4.6 1 magma-vulkan/ Vulkan 1.3 1
☝ Drag to pan · 🤏 Pinch to zoom · Tap a node
Ctrl+F Search
P Path
S Stats
F Fullscreen
E Export
Shift+Drag Move node
↑↓ Navigate
+/− Zoom
drivers/gpu/magma/crates/magma-hal/src/pci.rs
pub fn enumerate_gpus ( ) -> Vec < PciDeviceInfo > {
// Scan PCI bus for VGA-compatible devices
// Class code: 0x03 (Display controller)
// Subclass: 0x00 (VGA), 0x02 (3D)
pub vendor_id : u16 , // 0x10DE = NVIDIA
pub device_id : u16 , // GPU model identifier
pub bars : [ Option < Bar > ; 6 ] ,
Index enumerate_gpus PciDevice
BAR Size Purpose BAR0 16-32 MB GPU registers (MMIO) BAR1 128 MB - 32 GB Mappable VRAM (ReBAR) BAR2 Variable I/O ports (legacy) BAR3 32 MB NV_PFAULT, NV_PRAMIN
For modern NVIDIA GPUs, Magma communicates with the GPU Security Processor (GSP) via RPC:
drivers/gpu/magma/crates/magma-hal/src/gsp.rs
// Send an RPC message to GSP
// pub fn send(&self, msg: RpcMessage) -> Result<()>;
// pub fn recv(&self) -> Result<RpcMessage>;
pub payload : Option < Vec < u8 >> ,
Index RpcChannel RpcMessage
GSP handles: power management, thermal monitoring, security policies, and hardware initialization sequences that are too complex or proprietary for the open-source driver.
The following drivers are planned for future development:
Driver Target Priority AHCI SATA controllers High NVMe NVMe SSDs High VirtIO-blk QEMU virtual block devices Medium USB Mass Storage USB drives Low
Driver Target Priority VirtIO-net QEMU virtual network High E1000 Intel Gigabit Ethernet Medium RTL8139 Realtek (QEMU default) Medium XHCI USB 3.0 host controller Low
Driver Target Priority PS/2 Keyboard and mouse High USB HID USB keyboards, mice, gamepads Medium VirtIO-input QEMU virtual input Medium
Driver Target Priority Serial 16550 UART Done (in HAL) RTC CMOS Real-Time Clock Medium ACPI Power management Medium PCIe PCI Express bus enumeration High
To implement a new driver in Helix:
drivers/example/src/lib.rs
use helix_modules :: v2 :: * ;
impl ModuleTrait for MyDriver {
fn info ( & self ) -> ModuleInfo {
ModuleInfo :: new ( "my_driver" )
. description ( "Driver for XYZ hardware" )
. flags ( ModuleFlags :: DRIVER )
fn init ( & mut self , ctx : & Context ) -> Result < ( ) , ModuleError > {
// Discover hardware via PCI scan
fn start ( & mut self ) -> Result < ( ) , ModuleError > {
// Register interrupt handler
fn stop ( & mut self ) -> Result < ( ) , ModuleError > {
fn handle_event ( & mut self , event : & Event ) -> EventResponse {
Event :: Tick { .. } => { /* periodic housekeeping */ }
Event :: Shutdown => { let _ = self . stop ( ) ; }
Index MyDriver MyDriver info init start stop handle_event
drivers/example/src/lib.rs
impl BlockDevice for MyDriver {
fn read_block ( & self , lba : u64 , buf : & mut [ u8 ] ) -> Result < ( ) > {
// MMIO read from hardware
fn write_block ( & self , lba : u64 , buf : & [ u8 ] ) -> Result < ( ) > {
// MMIO write to hardware
fn flush ( & self ) -> Result < ( ) > { Ok ( ( ) ) }
fn block_size ( & self ) -> u32 { 512 }
fn total_blocks ( & self ) -> u64 { self . capacity / 512 }
Index MyDriver read_block write_block flush block_size total_blocks
drivers/example/Cargo.toml helix - modules = { path = "../../modules" }
helix - hal = { path = "../../hal" }
// The module_v2! macro handles registration automatically
drivers/example/src/lib.rs // Safe MMIO access via HAL
let bar0 = hal . map_bar ( pci_device , 0 ) ? ;
let status = bar0 . read32 ( REGISTER_STATUS ) ;
bar0 . write32 ( REGISTER_COMMAND , CMD_ENABLE ) ;
hal . register_irq ( pci_device . irq_line , | frame | {
let status = bar0 . read32 ( REGISTER_IRQ_STATUS ) ;
bar0 . write32 ( REGISTER_IRQ_ACK , status ) ;