From 00873e5f841d7a49b38ca5ed91fab4fcc3fe3586 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Fri, 5 Mar 2021 14:44:54 +0100 Subject: [PATCH] vmm: device_manager: Update virtio devices memory with a single region Relies on the preliminary work allowing virtio devices to be updated with a single memory at a time instead of updating the entire memory at once. Signed-off-by: Sebastien Boeuf --- vmm/src/device_manager.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 841349663..5121e2b00 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -93,12 +93,11 @@ use vm_device::interrupt::{ }; use vm_device::{Bus, BusDevice, Resource}; use vm_memory::guest_memory::FileOffset; -#[cfg(feature = "cmos")] -use vm_memory::GuestMemory; use vm_memory::{ - Address, GuestAddress, GuestAddressSpace, GuestMemoryRegion, GuestRegionMmap, GuestUsize, - MmapRegion, + Address, GuestAddress, GuestMemoryRegion, GuestRegionMmap, GuestUsize, MmapRegion, }; +#[cfg(feature = "cmos")] +use vm_memory::{GuestAddressSpace, GuestMemory}; use vm_migration::{ Migratable, MigratableError, Pausable, Snapshot, SnapshotDataSection, Snapshottable, Transportable, @@ -3096,12 +3095,11 @@ impl DeviceManager { } pub fn update_memory(&self, new_region: &Arc) -> DeviceManagerResult<()> { - let memory = self.memory_manager.lock().unwrap().guest_memory(); for (virtio_device, _, _) in self.virtio_devices.iter() { virtio_device .lock() .unwrap() - .update_memory(&memory.memory()) + .add_memory_region(new_region) .map_err(DeviceManagerError::UpdateMemoryForVirtioDevice)?; }