mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Store PciBus from DeviceManager
Helps with future refactoring of VFIO device creation. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
3f396d87ef
commit
02adc4061a
@@ -429,6 +429,10 @@ pub struct DeviceManager {
|
|||||||
|
|
||||||
// Backends that have been spawned
|
// Backends that have been spawned
|
||||||
vhost_user_backends: Vec<ActivatedBackend>,
|
vhost_user_backends: Vec<ActivatedBackend>,
|
||||||
|
|
||||||
|
// Keep a reference to the PCI bus
|
||||||
|
#[cfg(feature = "pci_support")]
|
||||||
|
pci_bus: Option<Arc<Mutex<PciBus>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DeviceManager {
|
impl DeviceManager {
|
||||||
@@ -515,6 +519,8 @@ impl DeviceManager {
|
|||||||
virtio_devices: Vec::new(),
|
virtio_devices: Vec::new(),
|
||||||
vmm_path,
|
vmm_path,
|
||||||
vhost_user_backends: Vec::new(),
|
vhost_user_backends: Vec::new(),
|
||||||
|
#[cfg(feature = "pci_support")]
|
||||||
|
pci_bus: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
device_manager
|
device_manager
|
||||||
@@ -625,12 +631,12 @@ impl DeviceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let pci_bus = Arc::new(Mutex::new(pci_bus));
|
let pci_bus = Arc::new(Mutex::new(pci_bus));
|
||||||
let pci_config_io = Arc::new(Mutex::new(PciConfigIo::new(pci_bus.clone())));
|
let pci_config_io = Arc::new(Mutex::new(PciConfigIo::new(Arc::clone(&pci_bus))));
|
||||||
self.address_manager
|
self.address_manager
|
||||||
.io_bus
|
.io_bus
|
||||||
.insert(pci_config_io, 0xcf8, 0x8)
|
.insert(pci_config_io, 0xcf8, 0x8)
|
||||||
.map_err(DeviceManagerError::BusError)?;
|
.map_err(DeviceManagerError::BusError)?;
|
||||||
let pci_config_mmio = Arc::new(Mutex::new(PciConfigMmio::new(pci_bus)));
|
let pci_config_mmio = Arc::new(Mutex::new(PciConfigMmio::new(Arc::clone(&pci_bus))));
|
||||||
self.address_manager
|
self.address_manager
|
||||||
.mmio_bus
|
.mmio_bus
|
||||||
.insert(
|
.insert(
|
||||||
@@ -639,6 +645,8 @@ impl DeviceManager {
|
|||||||
arch::layout::PCI_MMCONFIG_SIZE,
|
arch::layout::PCI_MMCONFIG_SIZE,
|
||||||
)
|
)
|
||||||
.map_err(DeviceManagerError::BusError)?;
|
.map_err(DeviceManagerError::BusError)?;
|
||||||
|
|
||||||
|
self.pci_bus = Some(pci_bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user