Skip to content

Commit 6abff2e

Browse files
committed
feat: 更新Cargo.toml和Cargo.lock,添加新依赖项并调整现有依赖项配置
1 parent 01d0365 commit 6abff2e

File tree

9 files changed

+125
-297
lines changed

9 files changed

+125
-297
lines changed

Cargo.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ license = "GPL-3.0-or-later OR Apache-2.0 OR MulanPubL-2.0 OR MulanPSL2"
2323
version = "0.1.0"
2424

2525
[workspace.dependencies]
26-
axvm-types = "0.1"
2726
bitflags = "2.2"
2827
cfg-if = "1.0"
2928
cpumask = "0.1.0"
@@ -85,10 +84,11 @@ axdevice = {git = "https://github.com/arceos-hypervisor/axdevice.git"}
8584
axdevice_base = "0.1"
8685
axvisor_api = "0.1"
8786
driver = {path = "modules/driver"}
87+
axvm-types = {path = "modules/axvm-types"}
8888

8989
# platform
9090
axplat-x86-qemu-q35 = {path = "platform/x86-qemu-q35"}
91-
axvmconfig = "0.1"
91+
axvmconfig = {version ="0.1", default-features = false }
9292

9393
[patch.crates-io]
9494
arm_vcpu = {path = "modules/arm_vcpu"}
@@ -97,7 +97,6 @@ axaddrspace = {path = "modules/axaddrspace"}
9797
axdevice_base = {path = "modules/axdevice_base"}
9898
axvcpu = {path = "modules/axvcpu"}
9999
axvisor_api = {path = "modules/axvisor_api"}
100-
axvm-types = {path = "modules/axvm-types"}
101100
axvmconfig = {path = "modules/axvmconfig"}
102101
x86_vcpu = {path = "modules/x86_vcpu"}
103102
x86_vlapic = {path = "modules/x86_vlapic"}

kernel/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ name = "axvisor"
77
[features]
88
# Note: ept-level-4 support is now provided through dynamic page table selection in axaddrspace
99
# The feature gate is no longer needed
10+
dyn-plat = ["axstd/myplat", "axstd/driver-dyn", "axruntime/driver-dyn"]
1011
ept-level-4 = ["axvm/4-level-ept"]
1112
fs = ["axstd/fs", "axruntime/fs"]
12-
dyn-plat = ["axstd/myplat", "axstd/driver-dyn", "axruntime/driver-dyn"]
1313

1414
[dependencies]
15+
anyhow = {version = "1.0", default-features = false}
1516
bitflags.workspace = true
1617
cfg-if.workspace = true
1718
cpumask.workspace = true
@@ -22,7 +23,6 @@ lazyinit = "0.2"
2223
log = "0.4"
2324
spin = "0.9"
2425
timer_list = "0.1.0"
25-
anyhow = {version = "1.0", default-features = false}
2626

2727
# System dependent modules provided by ArceOS.
2828
axstd = {workspace = true, features = [
@@ -39,6 +39,7 @@ axhvc.workspace = true
3939
axruntime = {workspace = true, features = ["alloc", "irq", "paging", "smp", "multitask"]}
4040
axvcpu.workspace = true
4141
axvm.workspace = true
42+
axvmconfig = {workspace = true}
4243

4344
# System independent crates provided by ArceOS, these crates could be imported by remote url.
4445
axerrno.workspace = true
@@ -58,16 +59,15 @@ axdevice.workspace = true
5859
axdevice_base = "0.1"
5960
# axvisor_api = "0.1"
6061
driver.workspace = true
61-
toml = { version= "0.9", default-features = false}
62-
62+
toml = {version = "0.9", default-features = false}
6363

6464
[target.'cfg(target_arch = "aarch64")'.dependencies]
6565
aarch64-cpu-ext = "0.1"
6666
arm-gic-driver = {version = "0.15.5", features = ["rdif"]}
6767

6868
[build-dependencies]
69+
anyhow = "1.0"
6970
prettyplease = "0.2"
7071
quote = "1.0"
7172
syn = "2.0"
7273
toml.workspace = true
73-
anyhow = "1.0"

kernel/src/vmm/config.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ use std::string::ToString;
22

33
use alloc::vec::Vec;
44
use anyhow::bail;
5-
use axvm::{AxVMConfig, Vm, config::AxVMCrateConfig};
5+
use axvm::{
6+
AxVMConfig, CpuId, GuestPhysAddr, Vm,
7+
config::{AxVCpuConfig, AxVMCrateConfig, CpuNumType, VMImagesConfig},
8+
};
69

710
use crate::vmm::vm_list::VMRef;
811

@@ -31,6 +34,35 @@ pub fn get_guest_prelude_vmconfig() -> anyhow::Result<Vec<AxVMCrateConfig>> {
3134
Ok(vm_configs)
3235
}
3336

37+
pub fn build_vmconfig(cfg: AxVMCrateConfig) -> anyhow::Result<AxVMConfig> {
38+
let mut cpu_num = CpuNumType::Alloc(1);
39+
if let Some(num) = cfg.base.cpu_num {
40+
cpu_num = CpuNumType::Alloc(num);
41+
}
42+
if let Some(ref ids) = cfg.base.cpu_ids {
43+
cpu_num = CpuNumType::Fixed(ids.iter().map(|&id| CpuId::new(id)).collect());
44+
}
45+
46+
let image_config = super::images::load_images(&cfg)?;
47+
48+
Ok(AxVMConfig {
49+
id: cfg.base.id,
50+
name: cfg.base.name,
51+
cpu_num,
52+
cpu_config: AxVCpuConfig {
53+
bsp_entry: GuestPhysAddr::from(cfg.kernel.entry_point),
54+
ap_entry: GuestPhysAddr::from(cfg.kernel.entry_point),
55+
},
56+
image_config,
57+
emu_devices: cfg.devices.emu_devices,
58+
pass_through_devices: cfg.devices.passthrough_devices,
59+
excluded_devices: cfg.devices.excluded_devices,
60+
pass_through_addresses: cfg.devices.passthrough_addresses,
61+
spi_list: Vec::new(),
62+
interrupt_mode: cfg.devices.interrupt_mode,
63+
})
64+
}
65+
3466
#[allow(clippy::module_inception, dead_code)]
3567
pub mod config {
3668
use alloc::string::String;

0 commit comments

Comments
 (0)