pci: vfio: Use MemorySlotAllocator for allocating memory slots

Adapt the existing code to replace the closure with the new of the new
MemorySlotAllocator.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
Rob Bradford
2024-11-21 15:39:55 +00:00
parent e3bd5e9b35
commit 81f8a27ef6
3 changed files with 12 additions and 12 deletions

View File

@@ -3432,7 +3432,7 @@ impl DeviceManager {
legacy_interrupt_group,
device_cfg.iommu,
pci_device_bdf,
Arc::new(move || memory_manager.lock().unwrap().allocate_memory_slot()),
memory_manager.lock().unwrap().memory_slot_allocator(),
vm_migration::snapshot_from_id(self.snapshot.as_ref(), vfio_name.as_str()),
device_cfg.x_nv_gpudirect_clique,
)
@@ -3596,7 +3596,7 @@ impl DeviceManager {
self.msi_interrupt_manager.clone(),
legacy_interrupt_group,
pci_device_bdf,
Arc::new(move || memory_manager.lock().unwrap().allocate_memory_slot()),
memory_manager.lock().unwrap().memory_slot_allocator(),
vm_migration::snapshot_from_id(self.snapshot.as_ref(), vfio_user_name.as_str()),
)
.map_err(DeviceManagerError::VfioUserCreate)?;