> $GITHUB_OUTPUT
-
- - name: Create GitHub Release
- uses: softprops/action-gh-release@v2
- with:
- draft: false
- prerelease: ${{ needs.verify-tag.outputs.is_prerelease == 'true' }}
- body: |
- ## Changes
- ${{ steps.release_notes.outputs.changelog }}
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- publish:
- name: Publish to crates.io
- runs-on: ubuntu-latest
- needs: [verify-tag, check]
- if: needs.verify-tag.outputs.should_release == 'true'
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Install Rust toolchain
- uses: dtolnay/rust-toolchain@nightly
-
- - name: Dry run publish
- run: cargo publish --dry-run
-
- - name: Publish to crates.io
- run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
+ needs: [check, test]
+ uses: arceos-hypervisor/axci/.github/workflows/release.yml@main
+ with:
+ verify_branch: true
+ verify_version: true
+ secrets:
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index dc3b293..6a58ef8 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,3 +1,6 @@
+# Integration Test Workflow
+# References shared workflow from axci
+
name: Test
on:
@@ -7,44 +10,8 @@ on:
tags-ignore:
- '**'
pull_request:
- workflow_call:
+ workflow_dispatch:
jobs:
- load-config:
- name: Load CI Configuration
- runs-on: ubuntu-latest
- outputs:
- targets: ${{ steps.config.outputs.targets }}
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Load configuration
- id: config
- run: |
- TARGETS=$(jq -c '.targets' .github/config.json)
- echo "targets=$TARGETS" >> $GITHUB_OUTPUT
-
test:
- name: Test
- runs-on: ubuntu-latest
- needs: load-config
- strategy:
- fail-fast: false
- matrix:
- target: ${{ fromJson(needs.load-config.outputs.targets) }}
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Install Rust toolchain
- uses: dtolnay/rust-toolchain@nightly
-
- # - name: Run tests
- # run: cargo test --target ${{ matrix.target }} --all-features -- --nocapture
-
- # - name: Run doc tests
- # run: cargo test --target ${{ matrix.target }} --doc
- - name: Run tests
- run: echo "Tests are skipped!"
+ uses: arceos-hypervisor/axci/.github/workflows/test.yml@main
diff --git a/.gitignore b/.gitignore
index 55c0d45..39ee779 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,11 @@ rusty-tags.vi
# We ignore Cargo.lock because `axvcpu` is just a library
Cargo.lock
+
+# Test results (generated by shared test framework)
+/test-results/
+/test_repos/
+*.log
+
+# Downloaded test framework
+/scripts/.axci/
diff --git a/README.md b/README.md
index 12ebcf7..6a3ef63 100644
--- a/README.md
+++ b/README.md
@@ -1,78 +1,154 @@
-# axdevice
-
-**axdevice** is a reusable, OS-agnostic device abstraction layer designed for virtual machines. It allows dynamic device configuration and MMIO emulation in `no_std` environments, making it suitable for hypervisors or operating systems targeting RISC-V or AArch64.
-
-## ✨ Highlights
-
-- 📦 **Componentized**: Designed as a modular crate to be integrated into any OS or hypervisor.
-- 🧩 **Flexible device abstraction**: Supports dynamic device registration and MMIO handling.
-- 🛠️ **No `std` required**: Uses `alloc` and `core` only, suitable for bare-metal development.
-- 🧵 **Thread-safe**: Devices are stored using `Arc`, ready for multicore use.
-- 🧱 **Easily extensible**: Just plug in device types via `axdevice_base::BaseDeviceOps`.
-
-## 📦 Structure
-
-- `config.rs`: Defines `AxVmDeviceConfig`, a wrapper for device configuration input.
-- `device.rs`: Defines `AxVmDevices`, manages and dispatches MMIO to registered devices.
-
-## 📐 Dependency Graph
-
-```text
- +-------------------+
- | axvmconfig | <- defines EmulatedDeviceConfig
- +-------------------+
- |
- v
-+------------------+ uses +-----------------------+
-| axdevice +-------------->+ axdevice_base::trait |
-| (this crate) | +-----------------------+
-+------------------+ ^
- | |
- v |
-+------------------+ |
-| axaddrspace | -- GuestPhysAddr ----+
-+------------------+
+axdevice
+
+OS-Agnostic Virtual Device Abstraction Layer
+
+
+
+[](https://crates.io/crates/axdevice)
+[](https://docs.rs/axdevice)
+[](https://www.rust-lang.org/)
+[](https://github.com/arceos-hypervisor/axdevice/blob/main/LICENSE)
+
+
+
+English | [中文](README_CN.md)
+
+# Introduction
+
+`axdevice` is a reusable, OS-agnostic device abstraction layer for virtual machines. It provides unified management for emulated devices and dispatches guest accesses to MMIO, system-register, and port-based devices in `#![no_std]` environments.
+
+This crate currently exports two core types:
+
+- **`AxVmDeviceConfig`** - Wraps a list of `EmulatedDeviceConfig` items used to initialize VM devices
+- **`AxVmDevices`** - Manages device collections, dispatches device access requests, and allocates IVC channels
+
+The crate is suitable for hypervisors and low-level OS components targeting AArch64 or RISC-V.
+
+## Quick Start
+
+### Requirements
+
+- Rust nightly toolchain
+- Rust components: rust-src, clippy, rustfmt
+
+```bash
+# Install rustup (if not installed)
+curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
+
+# Install nightly toolchain and components
+rustup install nightly
+rustup component add rust-src clippy rustfmt --toolchain nightly
```
-## 🔁 Usage Flow
-
-```text
-[1] Load VM device config (Vec)
- ↓
-[2] Create AxVmDeviceConfig
- ↓
-[3] Pass into AxVmDevices::new()
- ↓
-[4] MMIO access triggers handle_mmio_{read,write}
- ↓
-[5] Device selected by GuestPhysAddr
- ↓
-[6] Forwarded to BaseDeviceOps::handle_{read,write}()
+### Run Check and Test
+
+```bash
+# 1. Enter the repository
+cd axdevice
+
+# 2. Code check (format + clippy + build)
+./scripts/check.sh
+
+# 3. Run tests
+./scripts/test.sh
```
-## 🚀 Example
+## Integration
+
+### Installation
+
+Add to your `Cargo.toml`:
+
+```toml
+[dependencies]
+axdevice = "0.2.2"
+```
+
+### Example
```rust
+use std::sync::{Arc, Mutex};
+
+use axaddrspace::device::AccessWidth;
+use axaddrspace::{GuestPhysAddr, GuestPhysAddrRange};
use axdevice::{AxVmDeviceConfig, AxVmDevices};
+use axdevice_base::BaseDeviceOps;
+use axerrno::AxResult;
+use axvmconfig::EmulatedDeviceType;
+
+struct MockMmioDevice {
+ range: GuestPhysAddrRange,
+ last_write: Mutex