msix: Add SystemAllocator to MsixConfig

The point here is to let MsixConfig take care of the GSI allocation,
which means the SystemAllocator must be passed from the vmm crate all
the way down to the pci crate.

Once this is done, the GSI allocation and irq_fd creation is performed
by MsixConfig directly.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-01-09 17:03:06 +01:00
committed by Samuel Ortiz
parent f77d2c2d16
commit 86c760a0d9
4 changed files with 26 additions and 12 deletions

View File

@@ -1465,12 +1465,17 @@ impl DeviceManager {
None
};
let mut virtio_pci_device =
VirtioPciDevice::new(memory.clone(), virtio_device, msix_num, iommu_mapping_cb)
.map_err(DeviceManagerError::VirtioDevice)?;
let mut allocator = address_manager.allocator.lock().unwrap();
let mut virtio_pci_device = VirtioPciDevice::new(
memory.clone(),
virtio_device,
msix_num,
iommu_mapping_cb,
&mut allocator,
)
.map_err(DeviceManagerError::VirtioDevice)?;
let bars = virtio_pci_device
.allocate_bars(&mut allocator)
.map_err(DeviceManagerError::AllocateBars)?;