pci, vmm: Add migratable support to VFIO devices

Based on recent changes to VfioPciDevice, the VFIO devices can now be
migrated.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2022-06-07 16:35:53 +02:00
parent f48b05eee6
commit c021dda267
2 changed files with 10 additions and 7 deletions

View File

@@ -2978,10 +2978,6 @@ impl DeviceManager {
device_cfg: &mut DeviceConfig,
) -> DeviceManagerResult<(PciBdf, String)> {
let vfio_name = if let Some(id) = &device_cfg.id {
if self.device_tree.lock().unwrap().contains_key(id) {
return Err(DeviceManagerError::DeviceIdAlreadyInUse);
}
id.clone()
} else {
let id = self.next_device_name(VFIO_DEVICE_NAME_PREFIX)?;
@@ -3090,6 +3086,7 @@ impl DeviceManager {
legacy_interrupt_group,
device_cfg.iommu,
pci_device_bdf,
self.restoring,
)
.map_err(DeviceManagerError::VfioPciCreate)?;
@@ -3111,7 +3108,7 @@ impl DeviceManager {
})
.map_err(DeviceManagerError::VfioMapRegion)?;
let mut node = device_node!(vfio_name);
let mut node = device_node!(vfio_name, vfio_pci_device);
// Update the device tree with correct resource information.
node.resources = new_resources;