diff --git a/Cargo.lock b/Cargo.lock index e457bb8f..f72a814a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,9 +44,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" [[package]] name = "arceos-vmm" @@ -67,18 +67,16 @@ dependencies = [ "page_table_multiarch", "percpu", "raw-cpuid 11.2.0", - "riscv_vcpu", "spin", "toml", "x86", "x86_64 0.14.12", - "x86_vcpu", ] [[package]] name = "arceos_api" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "axalloc", "axconfig", @@ -97,9 +95,8 @@ dependencies = [ [[package]] name = "arm_gicv2" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arm_gicv2?rev=7acc0dd#7acc0dd1e1fefa90b4cd45342072d2350a74b071" +source = "git+https://github.com/arceos-hypervisor/arm_gicv2#dfe5f164b94cdd07081c2fe74a0cfe4bef2852c9" dependencies = [ - "crate_interface", "tock-registers", ] @@ -115,17 +112,15 @@ dependencies = [ [[package]] name = "arm_vcpu" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arm_vcpu.git#9a6c2587a36f4060505a6451e9a5c388a8b265ff" +source = "git+https://github.com/arceos-hypervisor/arm_vcpu.git#63fbc026fb730fdde2a81d6abc67666551bd2d9d" dependencies = [ "aarch64-cpu", "axaddrspace", "axerrno", "axvcpu", - "cortex-a", "log", "numeric-enum-macro", "percpu", - "smccc", "tock-registers", ] @@ -162,7 +157,7 @@ dependencies = [ [[package]] name = "axalloc" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "allocator", "axerrno", @@ -175,7 +170,7 @@ dependencies = [ [[package]] name = "axconfig" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "serde", "toml_edit 0.22.22", @@ -210,7 +205,7 @@ dependencies = [ [[package]] name = "axdriver" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "axalloc", "axconfig", @@ -267,7 +262,7 @@ dependencies = [ [[package]] name = "axfeat" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "axalloc", "axdriver", @@ -282,7 +277,7 @@ dependencies = [ [[package]] name = "axfs" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "axdriver", "axdriver_block", @@ -335,7 +330,7 @@ dependencies = [ [[package]] name = "axhal" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "aarch64-cpu", "arm_gicv2", @@ -381,7 +376,7 @@ dependencies = [ [[package]] name = "axlog" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "cfg-if", "crate_interface", @@ -392,7 +387,7 @@ dependencies = [ [[package]] name = "axmm" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "axconfig", "axerrno", @@ -406,7 +401,7 @@ dependencies = [ [[package]] name = "axruntime" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "axalloc", "axconfig", @@ -418,12 +413,14 @@ dependencies = [ "axtask", "chrono", "crate_interface", + "kernel_guard", + "percpu", ] [[package]] name = "axstd" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "arceos_api", "axerrno", @@ -435,7 +432,7 @@ dependencies = [ [[package]] name = "axsync" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "axtask", "kspin", @@ -444,7 +441,7 @@ dependencies = [ [[package]] name = "axtask" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#a3d5558c7aa8864d9bb8fd636bb8a64475534847" +source = "git+https://github.com/arceos-hypervisor/arceos.git?branch=vmm#9a845553df23944a6a3a0dd3e45df23c15f26465" dependencies = [ "axconfig", "axhal", @@ -464,7 +461,7 @@ dependencies = [ [[package]] name = "axvcpu" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/axvcpu.git#fba6c6a070fc3e3091201f22fd7698c2d5315543" +source = "git+https://github.com/arceos-hypervisor/axvcpu.git#1e9fa523378872ed0c947e2abd4699ed2d5025f2" dependencies = [ "axaddrspace", "axerrno", @@ -475,7 +472,7 @@ dependencies = [ [[package]] name = "axvm" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/axvm.git#bd990021bef1e72a7c6d1ac6199a201380297c45" +source = "git+https://github.com/arceos-hypervisor/axvm.git#6092edec74692767b51a9648228a050bae5e113b" dependencies = [ "arm_vcpu", "axaddrspace", @@ -632,7 +629,7 @@ checksum = "6af24c4862260a825484470f5526a91ad1031e04ab899be62478241231f62b46" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -712,9 +709,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "indexmap" @@ -723,7 +720,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.1", ] [[package]] @@ -766,9 +763,9 @@ checksum = "3861aac8febbb038673bf945ee47ac67940ca741b94d1bb3ff6066af2a181338" [[package]] name = "libc" -version = "0.2.161" +version = "0.2.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" [[package]] name = "linked_list" @@ -777,22 +774,22 @@ source = "git+https://github.com/arceos-org/linked_list.git?tag=v0.1.0#34c8db301 [[package]] name = "linkme" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70fe496a7af8c406f877635cbf3cd6a9fac9d6f443f58691cd8afe6ce0971af4" +checksum = "566336154b9e58a4f055f6dd4cbab62c7dc0826ce3c0a04e63b2d2ecd784cdae" dependencies = [ "linkme-impl", ] [[package]] name = "linkme-impl" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01f197a15988fb5b2ec0a5a9800c97e70771499c456ad757d63b3c5e9b96e75" +checksum = "edbe595006d355eaf9ae11db92707d4338cd2384d16866131cc1afdbdd35d8d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -913,7 +910,7 @@ checksum = "c825bdd6a7ddc470e59e65fbe2c80d0582e70f25067fbd4fa5a576b28bb25878" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -966,9 +963,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -1021,7 +1018,7 @@ dependencies = [ [[package]] name = "riscv_vcpu" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/riscv_vcpu.git#1021d026e413acaae3cf994420bb1fd94ff91dd9" +source = "git+https://github.com/arceos-hypervisor/riscv_vcpu.git#e3c992967219f10daadd0a71f6187641f381f563" dependencies = [ "axaddrspace", "axerrno", @@ -1082,7 +1079,7 @@ checksum = "a71347da9582cc6b6f3652c7d2c06516c9555690b3738ecdff7e84297f4e17fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -1137,22 +1134,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.213" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.213" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] [[package]] @@ -1163,12 +1160,6 @@ dependencies = [ "serde", ] -[[package]] -name = "smccc" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617d17f088ec733e5a6b86da6ce4cce1414e6e856d6061c16dda51cceae6f68c" - [[package]] name = "spin" version = "0.9.8" @@ -1210,9 +1201,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.85" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -1392,7 +1383,7 @@ dependencies = [ [[package]] name = "x86_vcpu" version = "0.1.0" -source = "git+https://github.com/arceos-hypervisor/x86_vcpu.git#991fa12d24859fef6b8a018d1c16494b9166f946" +source = "git+https://github.com/arceos-hypervisor/x86_vcpu.git#dc088685f76f83d52378d2fe78952cde3c187da9" dependencies = [ "axaddrspace", "axerrno", @@ -1428,5 +1419,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.87", ] diff --git a/Cargo.toml b/Cargo.toml index 163ec09b..d7d86829 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,3 @@ axstd = { git = "https://github.com/arceos-hypervisor/arceos.git", branch = "vmm axvm = { git = "https://github.com/arceos-hypervisor/axvm.git" } axvcpu = { git = "https://github.com/arceos-hypervisor/axvcpu.git" } axaddrspace = { git = "https://github.com/arceos-hypervisor/axaddrspace.git" } - -arm_vcpu = { git = "https://github.com/arceos-hypervisor/arm_vcpu.git" } -x86_vcpu = { git = "https://github.com/arceos-hypervisor/x86_vcpu.git" } -riscv_vcpu = { git = "https://github.com/arceos-hypervisor/riscv_vcpu.git" } diff --git a/arceos-vmm/Cargo.toml b/arceos-vmm/Cargo.toml index d1c68f87..95f0182c 100644 --- a/arceos-vmm/Cargo.toml +++ b/arceos-vmm/Cargo.toml @@ -15,9 +15,10 @@ axstd = { workspace = true, features = [ "alloc", "paging", "fs", - # "irq", + "irq", # It has to be disabed in riscv64. Todo: fix it. "hv", "multitask", + # "sched_rr" ] } # System dependent modules provided by ArceOS-Hypervisor. @@ -37,19 +38,14 @@ percpu = { version = "0.1.4", features = ["arm-el2"] } x86 = "0.52" x86_64 = "0.14" raw-cpuid = "11.0" -# According to the requirements of x86_vcpu, -# we need to implement PhysFrameIf for it, so we directly import `x86_vcpu` as a dependency in the app. -# Ref: [x86_vcpu](https://github.com/arceos-hypervisor/x86_vcpu/) -x86_vcpu = { workspace = true } [target.'cfg(target_arch = "riscv64")'.dependencies] fdt = { version = "0.1.5" } arrayvec = { version = "0.7.2", default-features = false } -riscv_vcpu = {workspace = true} [target.'cfg(target_arch = "aarch64")'.dependencies] fdt = { version = "0.1.5" } arrayvec = { version = "0.7.2", default-features = false } [build-dependencies] -toml = { git = "https://github.com/arceos-hypervisor/toml.git", branch = "no_std" } \ No newline at end of file +toml = { git = "https://github.com/arceos-hypervisor/toml.git", branch = "no_std" } diff --git a/arceos-vmm/src/hal.rs b/arceos-vmm/src/hal.rs index 1639206b..8d8ca842 100644 --- a/arceos-vmm/src/hal.rs +++ b/arceos-vmm/src/hal.rs @@ -1,9 +1,11 @@ use std::os::arceos; +use page_table_multiarch::PagingHandler; + use arceos::modules::axhal; -use axvm::{AxVMHal, AxVMPerCpu}; -// Todo: should we know about HostPhysAddr and HostVirtAddr here??? use axaddrspace::{HostPhysAddr, HostVirtAddr}; +use axvcpu::AxVCpuHal; +use axvm::{AxVMHal, AxVMPerCpu}; /// Implementation for `AxVMHal` trait. pub struct AxVMHalImpl; @@ -20,8 +22,41 @@ impl AxVMHal for AxVMHalImpl { } } +pub struct AxVCpuHalImpl; + +impl AxVCpuHal for AxVCpuHalImpl { + fn alloc_frame() -> Option { + ::PagingHandler::alloc_frame() + } + + fn dealloc_frame(paddr: HostPhysAddr) { + ::PagingHandler::dealloc_frame(paddr) + } + + #[inline] + fn phys_to_virt(paddr: HostPhysAddr) -> HostVirtAddr { + ::PagingHandler::phys_to_virt(paddr) + } + + fn virt_to_phys(vaddr: axaddrspace::HostVirtAddr) -> axaddrspace::HostPhysAddr { + std::os::arceos::modules::axhal::mem::virt_to_phys(vaddr) + } + + #[cfg(target_arch = "aarch64")] + fn irq_fetch() -> usize { + axhal::irq::fetch_irq() + } + + #[cfg(target_arch = "aarch64")] + fn irq_hanlder() { + let irq_num = axhal::irq::fetch_irq(); + debug!("IRQ handler {irq_num}"); + axhal::irq::handler_irq(irq_num); + } +} + #[percpu::def_percpu] -static mut AXVM_PER_CPU: AxVMPerCpu = AxVMPerCpu::new_uninit(); +static mut AXVM_PER_CPU: AxVMPerCpu = AxVMPerCpu::::new_uninit(); /// Init hardware virtualization support in each core. pub(crate) fn enable_virtualization() { @@ -55,65 +90,12 @@ pub(crate) fn enable_virtualization() { info!("Hardware virtualization support enabled on core {}", cpu_id); let _ = CORES.fetch_add(1, Ordering::Release); - - thread::yield_now(); }); } - thread::yield_now(); - // Wait for all cores to enable virtualization. while CORES.load(Ordering::Acquire) != config::SMP { - core::hint::spin_loop(); - } -} - -/// This design might seem strange, -/// but the underlying reason is that the vCPU implementations for ARM and RISC-V architectures -/// **DO NOT** require dependency on OS-related resource management interfaces. -/// -/// However, the vCPU implementation for the x86_64 architecture relies on OS-provided physical memory management interfaces to allocate memory for VMX-related control regions. -/// To avoid unnecessary Rust generic type applications, we decided to introduce `crate_interface` in the [`x86_vcpu`](https://github.com/arceos-hypervisor/x86_vcpu) crate -/// and use it to call OS-related resource allocation interfaces to implement `PhysFrameIf`. -#[cfg(target_arch = "x86_64")] -mod hal_x86 { - use axaddrspace::{HostPhysAddr, HostVirtAddr}; - use page_table_multiarch::PagingHandler; - - use axvm::AxVMHal; - - use crate::hal::AxVMHalImpl; - - /// Implementation for `PhysFrameIf` trait provided by [x86_vcpu](https://github.com/arceos-hypervisor/x86_vcpu) crate. - struct PhysFrameIfImpl; - - #[crate_interface::impl_interface] - impl x86_vcpu::PhysFrameIf for PhysFrameIfImpl { - fn alloc_frame() -> Option { - ::PagingHandler::alloc_frame() - } - - fn dealloc_frame(paddr: HostPhysAddr) { - ::PagingHandler::dealloc_frame(paddr) - } - - #[inline] - fn phys_to_virt(paddr: HostPhysAddr) -> HostVirtAddr { - ::PagingHandler::phys_to_virt(paddr) - } - } -} - -#[cfg(target_arch = "riscv64")] -mod hal_riscv64 { - /// Implementation for `HalIf` trait provided by [riscv_vcpu](https://github.com/arceos-hypervisor/riscv_vcpu) crate. - struct HalIfImpl; - - #[crate_interface::impl_interface] - impl riscv_vcpu::HalIf for HalIfImpl { - #[doc = " Returns the physical address of the given virtual address."] - fn virt_to_phys(vaddr: axaddrspace::HostVirtAddr) -> axaddrspace::HostPhysAddr { - std::os::arceos::modules::axhal::mem::virt_to_phys(vaddr) - } + // Use `yield_now` instead of `core::hint::spin_loop` to avoid deadlock. + thread::yield_now(); } } diff --git a/arceos-vmm/src/task.rs b/arceos-vmm/src/task.rs index a6ef5f5f..6f9fc4b7 100644 --- a/arceos-vmm/src/task.rs +++ b/arceos-vmm/src/task.rs @@ -1,19 +1,17 @@ use std::os::arceos::modules::axtask::def_task_ext; -use axvm::{AxVCpuRef, AxVMRef}; - -use crate::hal::AxVMHalImpl; +use crate::vmm::{VCpuRef, VMRef}; /// Task extended data for the hypervisor. pub struct TaskExt { /// The VM. - pub vm: AxVMRef, + pub vm: VMRef, /// The virtual memory address space. - pub vcpu: AxVCpuRef, + pub vcpu: VCpuRef, } impl TaskExt { - pub const fn new(vm: AxVMRef, vcpu: AxVCpuRef) -> Self { + pub const fn new(vm: VMRef, vcpu: VCpuRef) -> Self { Self { vm, vcpu } } } diff --git a/arceos-vmm/src/vmm/mod.rs b/arceos-vmm/src/vmm/mod.rs index d8f8fa65..19f12d7c 100644 --- a/arceos-vmm/src/vmm/mod.rs +++ b/arceos-vmm/src/vmm/mod.rs @@ -8,11 +8,12 @@ use std::os::arceos::api::task::{self, AxWaitQueueHandle}; use core::sync::atomic::AtomicUsize; use core::sync::atomic::Ordering; -use crate::hal::AxVMHalImpl; -use axvm::{AxVM, AxVMRef}; +use crate::hal::{AxVCpuHalImpl, AxVMHalImpl}; -pub type VM = AxVM; -pub type VMRef = AxVMRef; +pub type VM = axvm::AxVM; +pub type VMRef = axvm::AxVMRef; + +pub type VCpuRef = axvm::AxVCpuRef; static VMM: AxWaitQueueHandle = AxWaitQueueHandle::new(); diff --git a/arceos-vmm/src/vmm/vcpus.rs b/arceos-vmm/src/vmm/vcpus.rs index ba7bc156..9a9a825a 100644 --- a/arceos-vmm/src/vmm/vcpus.rs +++ b/arceos-vmm/src/vmm/vcpus.rs @@ -7,13 +7,12 @@ use std::os::arceos::modules::axtask; use axaddrspace::GuestPhysAddr; use axtask::{AxTaskRef, TaskExtRef, TaskInner, WaitQueue}; use axvcpu::{AxVCpuExitReason, VCpuState}; -use axvm::AxVCpuRef; use api::sys::ax_terminate; use api::task::AxCpuMask; use crate::task::TaskExt; -use crate::vmm::VMRef; +use crate::vmm::{VCpuRef, VMRef}; const KERNEL_STACK_SIZE: usize = 0x40000; // 256 KiB @@ -204,7 +203,7 @@ pub fn setup_vm_primary_vcpu(vm: VMRef) { /// /// * The task associated with the vCPU is created with a kernel stack size of 256 KiB. /// * The task is scheduled on the scheduler of arceos after it is spawned. -fn alloc_vcpu_task(vm: VMRef, vcpu: AxVCpuRef) -> AxTaskRef { +fn alloc_vcpu_task(vm: VMRef, vcpu: VCpuRef) -> AxTaskRef { info!("Spawning task for VM[{}] Vcpu[{}]", vm.id(), vcpu.id()); let mut vcpu_task = TaskInner::new( vcpu_run,