mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
vmm: Add memory hotplug support to VFIO PCI devices
Extend the update_memory() method from DeviceManager so that VFIO PCI devices can update their DMA mappings to the physical IOMMU, after a memory hotplug has been performed. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
cc67131ecc
commit
9e18177654
@ -270,6 +270,10 @@ pub enum DeviceManagerError {
|
||||
|
||||
/// Cannot find a memory range for virtio-mem memory
|
||||
VirtioMemRangeAllocation,
|
||||
|
||||
/// Failed updating guest memory for VFIO PCI device.
|
||||
#[cfg(feature = "pci_support")]
|
||||
UpdateMemoryForVfioPciDevice(VfioPciError),
|
||||
}
|
||||
pub type DeviceManagerResult<T> = result::Result<T, DeviceManagerError>;
|
||||
|
||||
@ -1886,6 +1890,22 @@ impl DeviceManager {
|
||||
.map_err(DeviceManagerError::UpdateMemoryForVirtioDevice)?;
|
||||
}
|
||||
|
||||
// Take care of updating the memory for VFIO PCI devices.
|
||||
#[cfg(feature = "pci_support")]
|
||||
{
|
||||
for (_, any_device) in self.pci_devices.iter() {
|
||||
if let Ok(vfio_pci_device) =
|
||||
Arc::clone(any_device).downcast::<Mutex<VfioPciDevice>>()
|
||||
{
|
||||
vfio_pci_device
|
||||
.lock()
|
||||
.unwrap()
|
||||
.update_memory(_new_region)
|
||||
.map_err(DeviceManagerError::UpdateMemoryForVfioPciDevice)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user