vmm: Always use a reference for InterruptManager

Since the InterruptManager is never stored into any structure, it should
be passed as a reference instead of being cloned.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-01-20 16:16:27 +01:00
committed by Samuel Ortiz
parent bb8cd9eb24
commit a20b383be8
+6 -6
View File
@@ -472,7 +472,7 @@ impl DeviceManager {
&memory_manager, &memory_manager,
&mut virt_iommu, &mut virt_iommu,
virtio_devices, virtio_devices,
interrupt_manager.clone(), &interrupt_manager,
&mut migratable_devices, &mut migratable_devices,
)?; )?;
} else if cfg!(feature = "mmio_support") { } else if cfg!(feature = "mmio_support") {
@@ -522,7 +522,7 @@ impl DeviceManager {
memory_manager: &Arc<Mutex<MemoryManager>>, memory_manager: &Arc<Mutex<MemoryManager>>,
virt_iommu: &mut Option<(u32, Vec<u32>)>, virt_iommu: &mut Option<(u32, Vec<u32>)>,
virtio_devices: Vec<(Arc<Mutex<dyn vm_virtio::VirtioDevice>>, bool)>, virtio_devices: Vec<(Arc<Mutex<dyn vm_virtio::VirtioDevice>>, bool)>,
interrupt_manager: Arc<dyn InterruptManager>, interrupt_manager: &Arc<dyn InterruptManager>,
migratable_devices: &mut Vec<Arc<Mutex<dyn Migratable>>>, migratable_devices: &mut Vec<Arc<Mutex<dyn Migratable>>>,
) -> DeviceManagerResult<()> { ) -> DeviceManagerResult<()> {
#[cfg(feature = "pci_support")] #[cfg(feature = "pci_support")]
@@ -558,7 +558,7 @@ impl DeviceManager {
&mut pci_bus, &mut pci_bus,
mapping, mapping,
migratable_devices, migratable_devices,
&interrupt_manager, interrupt_manager,
)?; )?;
if let Some(dev_id) = virtio_iommu_attach_dev { if let Some(dev_id) = virtio_iommu_attach_dev {
@@ -572,7 +572,7 @@ impl DeviceManager {
&mut pci_bus, &mut pci_bus,
memory_manager, memory_manager,
&mut iommu_device, &mut iommu_device,
&interrupt_manager, interrupt_manager,
)?; )?;
iommu_attached_devices.append(&mut vfio_iommu_device_ids); iommu_attached_devices.append(&mut vfio_iommu_device_ids);
@@ -596,7 +596,7 @@ impl DeviceManager {
&mut pci_bus, &mut pci_bus,
&None, &None,
migratable_devices, migratable_devices,
&interrupt_manager, interrupt_manager,
)?; )?;
*virt_iommu = Some((iommu_id, iommu_attached_devices)); *virt_iommu = Some((iommu_id, iommu_attached_devices));
@@ -1379,7 +1379,7 @@ impl DeviceManager {
} }
let mut vfio_pci_device = let mut vfio_pci_device =
VfioPciDevice::new(vm_info.vm_fd, vfio_device, &interrupt_manager) VfioPciDevice::new(vm_info.vm_fd, vfio_device, interrupt_manager)
.map_err(DeviceManagerError::VfioPciCreate)?; .map_err(DeviceManagerError::VfioPciCreate)?;
let bars = vfio_pci_device let bars = vfio_pci_device