mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
pci: Pass DeviceRelocation to PciBus
In order to trigger the PCI BAR reprogramming from PciConfigIo and PciConfigMmmio, we need the PciBus to have a hold onto the trait implementation of DeviceRelocation. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
e93467a96c
commit
04a449d3f3
@ -5,7 +5,7 @@
|
||||
use crate::configuration::{
|
||||
PciBarRegionType, PciBridgeSubclass, PciClassCode, PciConfiguration, PciHeaderType,
|
||||
};
|
||||
use crate::device::{Error as PciDeviceError, PciDevice};
|
||||
use crate::device::{DeviceRelocation, Error as PciDeviceError, PciDevice};
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
use devices::BusDevice;
|
||||
use std;
|
||||
@ -75,15 +75,19 @@ pub struct PciBus {
|
||||
/// Devices attached to this bus.
|
||||
/// Device 0 is host bridge.
|
||||
devices: Vec<Arc<Mutex<dyn PciDevice>>>,
|
||||
_device_reloc: Arc<dyn DeviceRelocation>,
|
||||
}
|
||||
|
||||
impl PciBus {
|
||||
pub fn new(pci_root: PciRoot) -> Self {
|
||||
pub fn new(pci_root: PciRoot, device_reloc: Arc<dyn DeviceRelocation>) -> Self {
|
||||
let mut devices: Vec<Arc<Mutex<dyn PciDevice>>> = Vec::new();
|
||||
|
||||
devices.push(Arc::new(Mutex::new(pci_root)));
|
||||
|
||||
PciBus { devices }
|
||||
PciBus {
|
||||
devices,
|
||||
_device_reloc: device_reloc,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn register_mapping(
|
||||
|
@ -537,7 +537,7 @@ impl DeviceManager {
|
||||
#[cfg(feature = "pci_support")]
|
||||
{
|
||||
let pci_root = PciRoot::new(None);
|
||||
let mut pci_bus = PciBus::new(pci_root);
|
||||
let mut pci_bus = PciBus::new(pci_root, address_manager.clone());
|
||||
|
||||
let (mut iommu_device, iommu_mapping) = if vm_info.vm_cfg.iommu {
|
||||
let (device, mapping) =
|
||||
|
Loading…
Reference in New Issue
Block a user