美文网首页
设备管理

设备管理

作者: liyiscuu | 来源:发表于2020-06-20 11:03 被阅读0次
    pub struct DeviceManager {
        // Manage address space related to devices
        address_manager: Arc<AddressManager>,
    
        // Console abstraction
        console: Arc<Console>,
    
        // Interrupt controller
        #[cfg(target_arch = "x86_64")]
        interrupt_controller: Option<Arc<Mutex<ioapic::Ioapic>>>,
        #[cfg(target_arch = "aarch64")]
        interrupt_controller: Option<Arc<Mutex<gic::Gic>>>,
    
        // Things to be added to the commandline (i.e. for virtio-mmio)
        cmdline_additions: Vec<String>,
    
        // ACPI GED notification device
        #[cfg(feature = "acpi")]
        ged_notification_device: Option<Arc<Mutex<devices::AcpiGEDDevice>>>,
    
        // VM configuration
        config: Arc<Mutex<VmConfig>>,
    
        // Memory Manager
        memory_manager: Arc<Mutex<MemoryManager>>,
    
        // The virtio devices on the system
        virtio_devices: Vec<(VirtioDeviceArc, bool, String)>,
    
        // List of bus devices
        // Let the DeviceManager keep strong references to the BusDevice devices.
        // This allows the IO and MMIO buses to be provided with Weak references,
        // which prevents cyclic dependencies.
        bus_devices: Vec<Arc<Mutex<dyn BusDevice>>>,
    
        // The path to the VMM for self spawning
        vmm_path: PathBuf,
    
        // Backends that have been spawned
        vhost_user_backends: Vec<ActivatedBackend>,
    
        // Counter to keep track of the consumed device IDs.
        device_id_cnt: Wrapping<usize>,
    
        // Keep a reference to the PCI bus
        #[cfg(feature = "pci_support")]
        pci_bus: Option<Arc<Mutex<PciBus>>>,
    
        #[cfg_attr(target_arch = "aarch64", allow(dead_code))]
        // MSI Interrupt Manager
        msi_interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
    
        // VFIO KVM device
        #[cfg(feature = "pci_support")]
        kvm_device_fd: Option<Arc<DeviceFd>>,
    
        // Paravirtualized IOMMU
        #[cfg(feature = "pci_support")]
        iommu_device: Option<Arc<Mutex<vm_virtio::Iommu>>>,
    
        // Bitmap of PCI devices to hotplug.
        #[cfg(feature = "pci_support")]
        pci_devices_up: u32,
    
        // Bitmap of PCI devices to hotunplug.
        #[cfg(feature = "pci_support")]
        pci_devices_down: u32,
    
        // Hashmap of device's name to their corresponding PCI b/d/f.
        #[cfg(feature = "pci_support")]
        pci_id_list: HashMap<String, u32>,
    
        // Hashmap of PCI b/d/f to their corresponding Arc<Mutex<dyn PciDevice>>.
        #[cfg(feature = "pci_support")]
        pci_devices: HashMap<u32, Arc<dyn Any + Send + Sync>>,
    
        // Tree of devices, representing the dependencies between devices.
        // Useful for introspection, snapshot and restore.
        device_tree: Arc<Mutex<DeviceTree>>,
    
        // Exit event
        #[cfg(feature = "acpi")]
        exit_evt: EventFd,
    
        // Reset event
        #[cfg(target_arch = "x86_64")]
        reset_evt: EventFd,
    
        #[cfg(target_arch = "aarch64")]
        id_to_dev_info: HashMap<(DeviceType, String), MMIODeviceInfo>,
    }
    

    相关文章

      网友评论

          本文标题:设备管理

          本文链接:https://www.haomeiwen.com/subject/bkywxktx.html