设备管理

pub struct DeviceManager {
    // Manage address space related to devices
    address_manager: Arc,

    // Console abstraction
    console: Arc,

    // Interrupt controller
    #[cfg(target_arch = "x86_64")]
    interrupt_controller: Option>>,
    #[cfg(target_arch = "aarch64")]
    interrupt_controller: Option>>,

    // Things to be added to the commandline (i.e. for virtio-mmio)
    cmdline_additions: Vec,

    // ACPI GED notification device
    #[cfg(feature = "acpi")]
    ged_notification_device: Option>>,

    // VM configuration
    config: Arc>,

    // Memory Manager
    memory_manager: Arc>,

    // 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>>,

    // The path to the VMM for self spawning
    vmm_path: PathBuf,

    // Backends that have been spawned
    vhost_user_backends: Vec,

    // Counter to keep track of the consumed device IDs.
    device_id_cnt: Wrapping,

    // Keep a reference to the PCI bus
    #[cfg(feature = "pci_support")]
    pci_bus: Option>>,

    #[cfg_attr(target_arch = "aarch64", allow(dead_code))]
    // MSI Interrupt Manager
    msi_interrupt_manager: Arc>,

    // VFIO KVM device
    #[cfg(feature = "pci_support")]
    kvm_device_fd: Option>,

    // Paravirtualized IOMMU
    #[cfg(feature = "pci_support")]
    iommu_device: Option>>,

    // 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,

    // Hashmap of PCI b/d/f to their corresponding Arc>.
    #[cfg(feature = "pci_support")]
    pci_devices: HashMap>,

    // Tree of devices, representing the dependencies between devices.
    // Useful for introspection, snapshot and restore.
    device_tree: Arc>,

    // 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>,
}

你可能感兴趣的:(设备管理)