mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-02 09:55:21 +00:00
vmm: Always return PCI B/D/F from add_virtio_pci_device
Previously this was only returned if the device had an IOMMU mapping and whether the device should be added to the virtio-iommu. This was already captured earlier as part of creating the device so use that information instead. Always returning the B/D/F is helpful as it facilitates virtio PCI device hotplug. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
462082c52f
commit
fb185fa839
@ -715,10 +715,10 @@ impl DeviceManager {
|
|||||||
&None
|
&None
|
||||||
};
|
};
|
||||||
|
|
||||||
let virtio_iommu_attach_dev =
|
let dev_id =
|
||||||
self.add_virtio_pci_device(device, &mut pci_bus, mapping, &interrupt_manager)?;
|
self.add_virtio_pci_device(device, &mut pci_bus, mapping, &interrupt_manager)?;
|
||||||
|
|
||||||
if let Some(dev_id) = virtio_iommu_attach_dev {
|
if iommu_attached {
|
||||||
iommu_attached_devices.push(dev_id);
|
iommu_attached_devices.push(dev_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1631,7 +1631,7 @@ impl DeviceManager {
|
|||||||
pci: &mut PciBus,
|
pci: &mut PciBus,
|
||||||
iommu_mapping: &Option<Arc<IommuMapping>>,
|
iommu_mapping: &Option<Arc<IommuMapping>>,
|
||||||
interrupt_manager: &Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
|
interrupt_manager: &Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
|
||||||
) -> DeviceManagerResult<Option<u32>> {
|
) -> DeviceManagerResult<u32> {
|
||||||
// Allows support for one MSI-X vector per queue. It also adds 1
|
// Allows support for one MSI-X vector per queue. It also adds 1
|
||||||
// as we need to take into account the dedicated vector to notify
|
// as we need to take into account the dedicated vector to notify
|
||||||
// about a virtio config change.
|
// about a virtio config change.
|
||||||
@ -1710,13 +1710,7 @@ impl DeviceManager {
|
|||||||
self.migratable_devices
|
self.migratable_devices
|
||||||
.push(Arc::clone(&virtio_pci_device) as Arc<Mutex<dyn Migratable>>);
|
.push(Arc::clone(&virtio_pci_device) as Arc<Mutex<dyn Migratable>>);
|
||||||
|
|
||||||
let ret = if iommu_mapping.is_some() {
|
Ok(pci_device_bdf)
|
||||||
Some(pci_device_bdf)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(ret)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "mmio_support")]
|
#[cfg(feature = "mmio_support")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user