From c886d71d2926fb892a6cb88d07dca020b154b93b Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 5 Oct 2021 15:00:23 +0100 Subject: [PATCH] vmm: Add MMIO & PIO config devices for all PCI segments Signed-off-by: Rob Bradford --- vmm/src/device_manager.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 733259b61..3af27a341 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -1188,14 +1188,16 @@ impl DeviceManager { } } - #[cfg(target_arch = "x86_64")] - self.bus_devices.push( - Arc::clone(self.pci_segments[0].pci_config_io.as_ref().unwrap()) - as Arc>, - ); + for segment in &self.pci_segments { + #[cfg(target_arch = "x86_64")] + if let Some(pci_config_io) = segment.pci_config_io.as_ref() { + self.bus_devices + .push(Arc::clone(pci_config_io) as Arc>); + } - self.bus_devices - .push(Arc::clone(&self.pci_segments[0].pci_config_mmio) as Arc>); + self.bus_devices + .push(Arc::clone(&segment.pci_config_mmio) as Arc>); + } Ok(()) }