From 49cc73a4ca7b513dbc848122fa46313a879688f4 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Fri, 17 Apr 2020 18:32:07 +0200 Subject: [PATCH] vm-virtio: pci: Make sure to return the correct list of BARs By adding the shared memory regions to the list of BARs, we make sure the DeviceManager will register it as a BAR on the PCI bus. Without this, when PCI BAR reprogramming happens, the PCI bus errors since it does not know about any BAR at the specified address. Signed-off-by: Sebastien Boeuf --- vm-virtio/src/transport/pci_device.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vm-virtio/src/transport/pci_device.rs b/vm-virtio/src/transport/pci_device.rs index 719f9f2bc..8f2a56155 100755 --- a/vm-virtio/src/transport/pci_device.rs +++ b/vm-virtio/src/transport/pci_device.rs @@ -757,6 +757,11 @@ impl PciDevice for VirtioPciDevice { PciDeviceError::IoRegistrationFailed(shm_list.addr.raw_value(), e) })? as u8; + let region_type = PciBarRegionType::Memory64BitRegion; + ranges.push((shm_list.addr, shm_list.len, region_type)); + self.bar_regions + .push((shm_list.addr, shm_list.len, region_type)); + for (idx, shm) in shm_list.region_list.iter().enumerate() { let shm_cap = VirtioPciCap64::new( PciCapabilityType::SharedMemoryConfig,