mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vfio: Update memory slot index to support multiple VFIO devices
In order to correctly support multiple VFIO devices, we need to increment the memory slot index every time it is being used to set some user memory region through KVM. That's why the mem_slot parameter is made mutable. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
b9f677c46c
commit
d92d797896
@@ -969,6 +969,7 @@ impl DeviceManager {
|
||||
buses: &mut BusInfo,
|
||||
mem_slots: u32,
|
||||
) -> DeviceManagerResult<()> {
|
||||
let mut mem_slot = mem_slots;
|
||||
if let Some(device_list_cfg) = &vm_cfg.devices {
|
||||
// Create the KVM VFIO device
|
||||
let device_fd = DeviceManager::create_kvm_device(vm_fd)?;
|
||||
@@ -986,8 +987,8 @@ impl DeviceManager {
|
||||
.allocate_bars(allocator)
|
||||
.map_err(DeviceManagerError::AllocateBars)?;
|
||||
|
||||
vfio_pci_device
|
||||
.map_mmio_regions(vm_fd, mem_slots)
|
||||
mem_slot = vfio_pci_device
|
||||
.map_mmio_regions(vm_fd, mem_slot)
|
||||
.map_err(DeviceManagerError::VfioMapRegion)?;
|
||||
|
||||
let vfio_pci_device = Arc::new(Mutex::new(vfio_pci_device));
|
||||
|
||||
Reference in New Issue
Block a user