Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ percpu = { version = "0.2.0", features = ["arm-el2"] }
# System dependent modules provided by ArceOS-Hypervisor.
axvcpu = "0.1"
axaddrspace = "0.1"
axdevice = { git = "https://github.com/arceos-hypervisor/axdevice.git" }
axdevice = { git = "https://github.com/DINGBROK423/axdevice.git", branch = "virt-blk", default-features = false }
axdevice_base = "0.1"
axvmconfig = { version = "0.1", default-features = false }
axvmconfig = { git = "https://github.com/DINGBROK423/axvmconfig.git", branch = "merge_add_virtio_mmio", default-features = false }
Comment on lines +28 to +30
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependencies are pointing to personal GitHub forks (DINGBROK423) instead of the official arceos-hypervisor organization repositories. For production use, these should point to stable, official releases or the main organization repositories to ensure maintenance, stability, and trustworthiness of the dependencies.

Copilot uses AI. Check for mistakes.

[target.'cfg(target_arch = "x86_64")'.dependencies]
x86_vcpu = "0.1"
Expand All @@ -40,5 +40,5 @@ arm_vcpu = { git = "https://github.com/arceos-hypervisor/arm_vcpu", branch = "ne
arm_vgic = { version = "0.1", features = ["vgicv3"] }

[patch.crates-io]
axvmconfig = { git = "https://github.com/arceos-hypervisor/axvmconfig.git", branch = "next" }
axvmconfig = { git = "https://github.com/DINGBROK423/axvmconfig.git", branch = "merge_add_virtio_mmio", default-features = false }
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line appears to be redundant - it patches axvmconfig to the same repository and branch that's already specified in the dependencies section at line 30. Consider removing this patch entry to avoid confusion and potential version conflicts.

Suggested change
axvmconfig = { git = "https://github.com/DINGBROK423/axvmconfig.git", branch = "merge_add_virtio_mmio", default-features = false }

Copilot uses AI. Check for mistakes.
axvcpu = {git = "https://github.com/arceos-hypervisor/axvcpu.git", branch = "next"}
32 changes: 22 additions & 10 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use axaddrspace::GuestPhysAddr;

pub use axvmconfig::{
AxVMCrateConfig, EmulatedDeviceConfig, PassThroughAddressConfig, PassThroughDeviceConfig,
VMInterruptMode, VMType, VmMemConfig, VmMemMappingType,
VMInterruptMode, VMType, VmMemConfig, VmMemMappingType, VirtioBlkMmioDeviceConfig,
};

// /// A part of `AxVCpuConfig`, which represents an architecture-dependent `VCpu`.
Expand Down Expand Up @@ -53,7 +53,9 @@ pub struct AxVMConfig {
pub(crate) phys_cpu_ls: PhysCpuList,
pub cpu_config: AxVCpuConfig,
pub image_config: VMImageConfig,
memory_regions: Vec<VmMemConfig>,
emu_devices: Vec<EmulatedDeviceConfig>,
virtio_blk_mmio: Vec<VirtioBlkMmioDeviceConfig>,
pass_through_devices: Vec<PassThroughDeviceConfig>,
excluded_devices: Vec<Vec<String>>,
pass_through_addresses: Vec<PassThroughAddressConfig>,
Expand Down Expand Up @@ -83,8 +85,9 @@ impl From<AxVMCrateConfig> for AxVMConfig {
dtb_load_gpa: cfg.kernel.dtb_load_addr.map(GuestPhysAddr::from),
ramdisk_load_gpa: cfg.kernel.ramdisk_load_addr.map(GuestPhysAddr::from),
},
// memory_regions: cfg.kernel.memory_regions,
memory_regions: cfg.kernel.memory_regions,
emu_devices: cfg.devices.emu_devices,
virtio_blk_mmio: cfg.devices.virtio_blk_mmio.unwrap_or_default(),
pass_through_devices: cfg.devices.passthrough_devices,
excluded_devices: cfg.devices.excluded_devices,
pass_through_addresses: cfg.devices.passthrough_addresses,
Expand Down Expand Up @@ -133,15 +136,15 @@ impl AxVMConfig {
pub fn pass_through_addresses(&self) -> &Vec<PassThroughAddressConfig> {
&self.pass_through_addresses
}
// /// Returns configurations related to VM memory regions.
// pub fn memory_regions(&self) -> Vec<VmMemConfig> {
// &self.memory_regions
// }
/// Returns configurations related to VM memory regions.
pub fn memory_regions(&self) -> &Vec<VmMemConfig> {
&self.memory_regions
}

// /// Adds a new memory region to the VM configuration.
// pub fn add_memory_region(&mut self, region: VmMemConfig) {
// self.memory_regions.push(region);
// }
/// Adds a new memory region to the VM configuration.
pub fn add_memory_region(&mut self, region: VmMemConfig) {
self.memory_regions.push(region);
}
Comment on lines +139 to +147
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly added public methods memory_regions(), add_memory_region(), and virtio_blk_mmio() lack documentation comments. Public API methods should have doc comments explaining their purpose, parameters, and return values to improve code maintainability and API usability.

Copilot uses AI. Check for mistakes.

// /// Checks if the VM memory regions contain a specific range.
// pub fn contains_memory_range(&self, range: &Range<usize>) -> bool {
Expand All @@ -155,6 +158,11 @@ impl AxVMConfig {
&self.emu_devices
}

/// Returns configurations related to Virtio-blk MMIO devices.
pub fn virtio_blk_mmio(&self) -> &Vec<VirtioBlkMmioDeviceConfig> {
&self.virtio_blk_mmio
}

/// Returns configurations related to VM passthrough devices.
pub fn pass_through_devices(&self) -> &Vec<PassThroughDeviceConfig> {
&self.pass_through_devices
Expand Down Expand Up @@ -189,6 +197,10 @@ impl AxVMConfig {
pub fn interrupt_mode(&self) -> VMInterruptMode {
self.interrupt_mode
}

Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly added public method get_vcpu_affinities_pcpu_ids() lacks documentation comments. Public API methods should have doc comments explaining their purpose, return value format, and usage to improve code maintainability and API usability.

Suggested change
/// Returns the vCPU-to-pCPU affinity information for this VM.
///
/// Each element in the returned vector is a tuple of
/// `(vcpu_index, pcpu_id, pcpu_set_index)`:
/// - `vcpu_index`: the index of the vCPU within this VM.
/// - `pcpu_id`: an optional physical CPU identifier; `None` means the vCPU
/// is not pinned to a specific physical CPU.
/// - `pcpu_set_index`: the index into the configured physical CPU set that
/// this vCPU is associated with.
///
/// This is a convenience wrapper around the underlying physical CPU list,
/// intended for callers that need to inspect or configure vCPU pinning.

Copilot uses AI. Check for mistakes.
pub fn get_vcpu_affinities_pcpu_ids(&self) -> Vec<(usize, Option<usize>, usize)> {
self.phys_cpu_ls.get_vcpu_affinities_pcpu_ids()
}
}

#[derive(Debug, Default, Clone)]
Expand Down
Loading