diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 0a4a8fed6..0a2d1157c 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -336,6 +336,7 @@ impl Vcpu { pub struct CpuManager { boot_vcpus: u8, + max_vcpus: u8, io_bus: Weak, mmio_bus: Arc, ioapic: Option>>, @@ -388,6 +389,7 @@ impl BusDevice for CpuManager { impl CpuManager { pub fn new( boot_vcpus: u8, + max_vcpus: u8, device_manager: &DeviceManager, guest_memory: Arc>, fd: Arc, @@ -396,6 +398,7 @@ impl CpuManager { ) -> Result>> { let cpu_manager = Arc::new(Mutex::new(CpuManager { boot_vcpus, + max_vcpus, io_bus: Arc::downgrade(&device_manager.io_bus().clone()), mmio_bus: device_manager.mmio_bus().clone(), ioapic: device_manager.ioapic().clone(), @@ -568,4 +571,12 @@ impl CpuManager { } Ok(()) } + + pub fn boot_vcpus(&self) -> u8 { + self.boot_vcpus + } + + pub fn max_vcpus(&self) -> u8 { + self.max_vcpus + } } diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index bc8fac7a9..b734fd291 100755 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -451,8 +451,10 @@ impl Vm { let on_tty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0; let boot_vcpus = config.cpus.cpu_count; + let max_vcpus = config.cpus.cpu_count; let cpu_manager = cpu::CpuManager::new( boot_vcpus, + max_vcpus, &device_manager, guest_memory.clone(), fd,