ArceOS Ecosystem Integration
Relevant source files
Purpose and Scope
This document explains how the axdevice
crate integrates with the broader ArceOS hypervisor ecosystem. It covers the modular architecture approach, dependency relationships with other ArceOS crates, and the layered design that enables extensible device emulation within virtual machines.
For information about the internal architecture of axdevice components, see System Architecture. For details about device configuration and emulation implementation, see Core Components.
ArceOS Hypervisor Ecosystem Structure
The axdevice
crate operates within a carefully structured ecosystem of ArceOS hypervisor components, each serving specific responsibilities in the virtualization stack.
Ecosystem Dependency Graph
flowchart TD subgraph subGraph4["External Dependencies"] log["logLogging Framework"] cfg_if["cfg-ifConditional Compilation"] end subgraph subGraph3["System Foundation Dependencies"] axerrno["axerrnoError Type Definitions"] memory_addr["memory_addrMemory Address Types"] end subgraph subGraph2["Device Abstraction Dependencies"] axdevice_base["axdevice_baseDevice Interface Traits"] axdevice_crates["axdevice_cratesDevice Implementation Framework"] end subgraph subGraph1["VM Management Dependencies"] axvmconfig["axvmconfigVM Configuration"] axaddrspace["axaddrspaceAddress Space Management"] end subgraph subGraph0["Device Management Layer"] axdevice["axdeviceDevice Orchestration"] end axaddrspace --> memory_addr axdevice --> axaddrspace axdevice --> axdevice_base axdevice --> axerrno axdevice --> axvmconfig axdevice --> cfg_if axdevice --> log axdevice --> memory_addr axdevice_base --> axdevice_crates axvmconfig --> axerrno
Sources: Cargo.toml(L1 - L19)
Dependency Architecture
ArceOS Hypervisor-Specific Dependencies
The axdevice
crate depends on three key ArceOS hypervisor components, each maintained in separate Git repositories to support modular development:
Dependency | Repository | Role in axdevice |
---|---|---|
axvmconfig | github.com/arceos-hypervisor/axvmconfig.git | Provides VM configuration structures that define device parameters |
axaddrspace | github.com/arceos-hypervisor/axaddrspace.git | Manages guest physical address space mappings for device MMIO regions |
axdevice_base | github.com/arceos-hypervisor/axdevice_crates.git | DefinesBaseDeviceOpstrait and device abstraction interfaces |
ArceOS System Foundation Dependencies
The crate relies on foundational ArceOS system components for basic functionality:
axerrno
: Provides standardized error types (AxError
,AxResult
) used throughout the hypervisor ecosystemmemory_addr
: Supplies memory address types (GuestPhysAddr
,HostVirtAddr
) for address space operations
External Ecosystem Dependencies
Standard Rust ecosystem crates provide utility functionality:
log
: Enables structured logging for debugging and monitoring device operationscfg-if
: Supports conditional compilation for platform-specific device implementations
Sources: Cargo.toml(L8 - L18)
Integration Patterns and Code Entities
Component Integration Flow
flowchart TD subgraph subGraph4["Error Handling Integration"] AxError["AxError"] AxResult["AxResult"] end subgraph subGraph3["Address Space Integration"] GuestPhysAddr["GuestPhysAddr"] HostVirtAddr["HostVirtAddr"] address_mapping["Address Mapping"] end subgraph subGraph2["Device Implementation Phase"] BaseDeviceOps["BaseDeviceOps trait"] device_implementations["Device Implementations"] end subgraph subGraph1["Device Management Phase"] AxVmDevices["AxVmDevices"] find_dev["find_dev()"] handle_read["handle_read()"] handle_write["handle_write()"] end subgraph subGraph0["Configuration Phase"] AxVmDeviceConfig["AxVmDeviceConfig"] EmulatedDeviceConfig["EmulatedDeviceConfig"] end AxError --> AxResult AxResult --> handle_read AxResult --> handle_write AxVmDeviceConfig --> EmulatedDeviceConfig AxVmDevices --> find_dev BaseDeviceOps --> device_implementations EmulatedDeviceConfig --> AxVmDevices GuestPhysAddr --> find_dev HostVirtAddr --> address_mapping address_mapping --> AxVmDevices find_dev --> handle_read find_dev --> handle_write handle_read --> BaseDeviceOps handle_write --> BaseDeviceOps
Trait and Type Integration Points
The ecosystem integration occurs through specific code entities that provide standardized interfaces:
Configuration Integration:
AxVmDeviceConfig
structure coordinates withaxvmconfig
crate for VM-level device configurationEmulatedDeviceConfig
instances define individual device parameters within the VM configuration
Device Operation Integration:
BaseDeviceOps
trait fromaxdevice_base
defines the interface contract for all emulated devicesfind_dev()
method usesGuestPhysAddr
frommemory_addr
crate for address-based device lookuphandle_read()
andhandle_write()
methods returnAxResult<T>
using error types fromaxerrno
Address Space Integration:
GuestPhysAddr
andHostVirtAddr
types frommemory_addr
enable precise memory mapping- Integration with
axaddrspace
manages guest physical memory regions assigned to devices
Sources: Cargo.toml(L13 - L18)
Modular Design Benefits
Repository Separation Strategy
The ArceOS hypervisor ecosystem uses a multi-repository approach that provides several architectural advantages:
Development Independence:
- Each component (
axvmconfig
,axaddrspace
,axdevice_base
) can evolve independently - Version pinning through Git dependencies allows controlled integration of component updates
- Teams can work on different aspects of the hypervisor without merge conflicts
Dependency Management:
axdevice
specifiesdefault-features = false
foraxvmconfig
, enabling minimal dependency inclusion- Git-based dependencies allow using cutting-edge features before crates.io publication
- Clear separation of concerns prevents circular dependencies between components
Extensibility Framework:
- New device types can be added by implementing
BaseDeviceOps
without modifying coreaxdevice
code - Additional VM configuration options can be added to
axvmconfig
without breaking existing device implementations - Address space management improvements in
axaddrspace
benefit all device emulation automatically
Integration Testing and Compatibility
The modular approach enables comprehensive integration testing:
- Each component maintains its own test suite for isolated functionality verification
- Integration tests can verify compatibility between specific versions of ecosystem components
- CI/CD pipelines can test multiple version combinations to ensure ecosystem stability
Sources: Cargo.toml(L16 - L18)