mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-02 01:45:21 +00:00
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 <sebastien.boeuf@intel.com>
This commit is contained in:
parent
9e53efa3ca
commit
00873e5f84
@ -93,12 +93,11 @@ use vm_device::interrupt::{
|
|||||||
};
|
};
|
||||||
use vm_device::{Bus, BusDevice, Resource};
|
use vm_device::{Bus, BusDevice, Resource};
|
||||||
use vm_memory::guest_memory::FileOffset;
|
use vm_memory::guest_memory::FileOffset;
|
||||||
#[cfg(feature = "cmos")]
|
|
||||||
use vm_memory::GuestMemory;
|
|
||||||
use vm_memory::{
|
use vm_memory::{
|
||||||
Address, GuestAddress, GuestAddressSpace, GuestMemoryRegion, GuestRegionMmap, GuestUsize,
|
Address, GuestAddress, GuestMemoryRegion, GuestRegionMmap, GuestUsize, MmapRegion,
|
||||||
MmapRegion,
|
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "cmos")]
|
||||||
|
use vm_memory::{GuestAddressSpace, GuestMemory};
|
||||||
use vm_migration::{
|
use vm_migration::{
|
||||||
Migratable, MigratableError, Pausable, Snapshot, SnapshotDataSection, Snapshottable,
|
Migratable, MigratableError, Pausable, Snapshot, SnapshotDataSection, Snapshottable,
|
||||||
Transportable,
|
Transportable,
|
||||||
@ -3096,12 +3095,11 @@ impl DeviceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_memory(&self, new_region: &Arc<GuestRegionMmap>) -> DeviceManagerResult<()> {
|
pub fn update_memory(&self, new_region: &Arc<GuestRegionMmap>) -> DeviceManagerResult<()> {
|
||||||
let memory = self.memory_manager.lock().unwrap().guest_memory();
|
|
||||||
for (virtio_device, _, _) in self.virtio_devices.iter() {
|
for (virtio_device, _, _) in self.virtio_devices.iter() {
|
||||||
virtio_device
|
virtio_device
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.update_memory(&memory.memory())
|
.add_memory_region(new_region)
|
||||||
.map_err(DeviceManagerError::UpdateMemoryForVirtioDevice)?;
|
.map_err(DeviceManagerError::UpdateMemoryForVirtioDevice)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user