pci, vmm: Add migratable support to vfio-user devices

Based on recent changes to VfioUserPciDevice, the vfio-user 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:37:21 +02:00
parent c021dda267
commit 7df7061610
2 changed files with 12 additions and 12 deletions

View File

@@ -358,9 +358,6 @@ pub enum DeviceManagerError {
/// Could not give the PCI device ID back.
PutPciDeviceId(pci::PciRootError),
/// Incorrect device ID as it is already used by another device.
DeviceIdAlreadyInUse,
/// No disk path was specified when one was expected
NoDiskPath,
@@ -3203,10 +3200,6 @@ impl DeviceManager {
device_cfg: &mut UserDeviceConfig,
) -> DeviceManagerResult<(PciBdf, String)> {
let vfio_user_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_USER_DEVICE_NAME_PREFIX)?;
@@ -3244,6 +3237,7 @@ impl DeviceManager {
self.msi_interrupt_manager.clone(),
legacy_interrupt_group,
pci_device_bdf,
self.restoring,
)
.map_err(DeviceManagerError::VfioUserCreate)?;
@@ -3288,7 +3282,7 @@ impl DeviceManager {
})
.map_err(DeviceManagerError::VfioUserMapRegion)?;
let mut node = device_node!(vfio_user_name);
let mut node = device_node!(vfio_user_name, vfio_user_pci_device);
// Update the device tree with correct resource information.
node.resources = new_resources;