mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-21 20:15:21 +00:00
vmm: device_manager: Map MMIO regions to the guest correctly
To correctly map MMIO regions to the guest, we will need to wait for valid MMIO region information which is generated from 'PciDevice::allocate_bars()' (as a part of 'DeviceManager::add_pci_device()'). Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
25a38b25c4
commit
7fe399598d
@ -3354,12 +3354,6 @@ impl DeviceManager {
|
||||
)
|
||||
.map_err(DeviceManagerError::VfioUserCreate)?;
|
||||
|
||||
vfio_user_pci_device
|
||||
.map_mmio_regions(&self.address_manager.vm, || {
|
||||
self.memory_manager.lock().unwrap().allocate_memory_slot()
|
||||
})
|
||||
.map_err(DeviceManagerError::VfioUserMapRegion)?;
|
||||
|
||||
let memory = self.memory_manager.lock().unwrap().guest_memory();
|
||||
let vfio_user_mapping = Arc::new(VfioUserDmaMapping::new(client, Arc::new(memory)));
|
||||
for virtio_mem_device in self.virtio_mem_devices.iter() {
|
||||
@ -3391,6 +3385,16 @@ impl DeviceManager {
|
||||
resources,
|
||||
)?;
|
||||
|
||||
// Note it is required to call 'add_pci_device()' in advance to have the list of
|
||||
// mmio regions provisioned correctly
|
||||
vfio_user_pci_device
|
||||
.lock()
|
||||
.unwrap()
|
||||
.map_mmio_regions(&self.address_manager.vm, || {
|
||||
self.memory_manager.lock().unwrap().allocate_memory_slot()
|
||||
})
|
||||
.map_err(DeviceManagerError::VfioUserMapRegion)?;
|
||||
|
||||
let mut node = device_node!(vfio_user_name);
|
||||
|
||||
// Update the device tree with correct resource information.
|
||||
|
Loading…
x
Reference in New Issue
Block a user