diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index d3d2f8040..6bd41ddb5 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -15,7 +15,6 @@ use crate::config::ConsoleOutputMode; use crate::config::VmConfig; use crate::interrupt::{KvmInterruptManager, KvmRoutingEntry}; use crate::memory_manager::{Error as MemoryManagerError, MemoryManager}; -use crate::vm::VmInfo; #[cfg(feature = "acpi")] use acpi_tables::{aml, aml::Aml}; #[cfg(feature = "acpi")] @@ -398,7 +397,8 @@ pub struct DeviceManager { impl DeviceManager { pub fn new( - vm_info: &VmInfo, + vm_fd: Arc, + config: Arc>, allocator: Arc>, memory_manager: Arc>, _exit_evt: &EventFd, @@ -418,7 +418,7 @@ impl DeviceManager { allocator, io_bus: Arc::new(io_bus), mmio_bus: Arc::new(mmio_bus), - vm_fd: vm_info.vm_fd.clone(), + vm_fd: vm_fd.clone(), }); // Create a shared list of GSI that can be shared through all PCI @@ -441,7 +441,7 @@ impl DeviceManager { let ioapic_interrupt_manager: Arc = Arc::new(KvmInterruptManager::new( Arc::clone(&address_manager.allocator), - Arc::clone(&vm_info.vm_fd), + vm_fd.clone(), Arc::clone(&kvm_gsi_msi_routes), None, )); @@ -456,7 +456,7 @@ impl DeviceManager { // both interrupt managers are going to share the list correctly. let interrupt_manager: Arc = Arc::new(KvmInterruptManager::new( Arc::clone(&address_manager.allocator), - Arc::clone(&vm_info.vm_fd), + vm_fd, Arc::clone(&kvm_gsi_msi_routes), Some(ioapic.clone()), )); @@ -483,7 +483,7 @@ impl DeviceManager { cmdline_additions, #[cfg(feature = "acpi")] ged_notification_device: None, - config: vm_info.vm_cfg.clone(), + config, migratable_devices, memory_manager, }; diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index b83af0dae..440cb7586 100755 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -29,7 +29,6 @@ use crate::cpu; use crate::device_manager::{get_win_size, Console, DeviceManager, DeviceManagerError}; use crate::memory_manager::{get_host_cpu_phys_bits, Error as MemoryManagerError, MemoryManager}; use anyhow::anyhow; -use arc_swap::ArcSwap; use arch::layout; use devices::{ioapic, HotPlugNotificationFlags}; use kvm_bindings::{kvm_enable_cap, kvm_userspace_memory_region, KVM_CAP_SPLIT_IRQCHIP}; @@ -165,12 +164,6 @@ pub enum Error { } pub type Result = result::Result; -pub struct VmInfo<'a> { - pub memory: &'a Arc>, - pub vm_fd: &'a Arc, - pub vm_cfg: Arc>, -} - #[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)] pub enum VmState { Created, @@ -325,14 +318,10 @@ impl Vm { .map_err(Error::MemoryManager)?; let guest_memory = memory_manager.lock().unwrap().guest_memory(); - let vm_info = VmInfo { - memory: &guest_memory, - vm_fd: &fd, - vm_cfg: config.clone(), - }; let device_manager = DeviceManager::new( - &vm_info, + fd.clone(), + config.clone(), allocator, memory_manager.clone(), &exit_evt, @@ -348,7 +337,7 @@ impl Vm { boot_vcpus, max_vcpus, &device_manager, - guest_memory.clone(), + guest_memory, fd, cpuid, reset_evt,