mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
vmm: Remove IO bus strong reference from Vm
The Vm structure was used to store a strong reference to the IO bus. This is not needed anymore since the AddressManager is logically the one holding this strong reference. This has been made possible by the introduction of Weak references on the Bus structure itself. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
2dbb376175
commit
09829c44b2
@ -474,7 +474,6 @@ impl DeviceManager {
|
||||
_exit_evt: &EventFd,
|
||||
reset_evt: &EventFd,
|
||||
vmm_path: PathBuf,
|
||||
io_bus: &Arc<devices::Bus>,
|
||||
) -> DeviceManagerResult<Arc<Mutex<Self>>> {
|
||||
let mut virtio_devices: Vec<(Arc<Mutex<dyn vm_virtio::VirtioDevice>>, bool)> = Vec::new();
|
||||
let migratable_devices: Vec<Arc<Mutex<dyn Migratable>>> = Vec::new();
|
||||
@ -486,7 +485,7 @@ impl DeviceManager {
|
||||
|
||||
let address_manager = Arc::new(AddressManager {
|
||||
allocator,
|
||||
io_bus: Arc::clone(io_bus),
|
||||
io_bus: Arc::new(devices::Bus::new()),
|
||||
mmio_bus: Arc::new(devices::Bus::new()),
|
||||
vm_fd: vm_fd.clone(),
|
||||
});
|
||||
|
@ -222,8 +222,6 @@ pub struct Vm {
|
||||
state: RwLock<VmState>,
|
||||
cpu_manager: Arc<Mutex<cpu::CpuManager>>,
|
||||
memory_manager: Arc<Mutex<MemoryManager>>,
|
||||
// Hold the strong reference onto the IO bus.
|
||||
_io_bus: Arc<devices::Bus>,
|
||||
}
|
||||
|
||||
impl Vm {
|
||||
@ -331,8 +329,6 @@ impl Vm {
|
||||
.ok_or(Error::CreateSystemAllocator)?,
|
||||
));
|
||||
|
||||
let io_bus = Arc::new(devices::Bus::new());
|
||||
|
||||
let memory_config = config.lock().unwrap().memory.clone();
|
||||
|
||||
let memory_manager = MemoryManager::new(
|
||||
@ -355,7 +351,6 @@ impl Vm {
|
||||
&exit_evt,
|
||||
&reset_evt,
|
||||
vmm_path,
|
||||
&io_bus,
|
||||
)
|
||||
.map_err(Error::DeviceManager)?;
|
||||
|
||||
@ -384,7 +379,6 @@ impl Vm {
|
||||
state: RwLock::new(VmState::Created),
|
||||
cpu_manager,
|
||||
memory_manager,
|
||||
_io_bus: io_bus,
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user