Expand description
Emulates virtual and hardware devices.
Re-exports§
pub use self::acpi::ACPIPMFixedEvent;
pub use self::acpi::ACPIPMResource;
pub use self::bat::BatteryError;
pub use self::bat::GoldfishBattery;
pub use self::pl030::Pl030;
pub use self::pmc_virt::VirtualPmc;
pub use self::serial_device::Error as SerialError;
pub use self::serial_device::SerialDevice;
pub use self::serial_device::SerialHardware;
pub use self::serial_device::SerialParameters;
pub use self::serial_device::SerialType;
pub use self::virtio::VirtioMmioDevice;
pub use self::virtio::VirtioPciDevice;
pub use self::ac_adapter::AcAdapter;
pub use self::usb::backend::device_provider::DeviceProvider;
pub use self::usb::xhci::xhci_controller::XhciController;
pub use self::vfio::VfioContainer;
pub use self::vfio::VfioDevice;
pub use self::vfio::VfioDeviceType;
pub use self::virtio::vfio_wrapper;
pub use self::irqchip::*;
Modules§
- bus 🔒Handles routing to devices in an address space.
- debugcon 🔒
- fw_cfg 🔒fw_cfg device implementing QEMU’s Firmware Configuration interface https://www.qemu.org/docs/master/specs/fw_cfg.html
- i8042 🔒
- pci 🔒Implements pci devices and busses.
- pflash 🔒Programmable flash device that supports the minimum interface that OVMF requires. This is purpose-built to allow OVMF to store UEFI variables in the same way that it stores them on QEMU.
- pit 🔒
- platform 🔒Implements platform devices and busses.
- proxy 🔒Runs hardware devices in child processes.
- serial 🔒
- Trait to suspend virtual hardware.
- sys 🔒
- Handles operations using platform Time Stamp Counter (TSC).
- utils 🔒
- Implements virtio devices, queues, and transport mechanisms.
- vmwdt is a virtual watchdog memory mapped device which detects stalls on the vCPUs and resets the guest when no ‘pet’ events are received. https://docs.google.com/document/d/1DYmk2roxlwHZsOfcJi8xDMdWOHAmomvs2SDh7KPud3Y/edit?usp=sharing&resourcekey=0-oSNabc-t040a1q0K4cyI8Q
- vTPM Proxy backend using the vtpmd on ChromeOS to virtualize TPM commands.
Macros§
- Implements
From
between two structs whose each field implementsFrom
each other. - Implements TryFrom<data_model::Le32> for an enum that implements
enumn::N
. - Allows dispatching a function call to all its enum value implementations. See
BackendDeviceType
in usb/backend/device.rs for an example usage of it. - Macro helps to build a static register.
dev
is the device.modfun
is the function name of the function that would modify the device. The function call should modify the device so that a snapshot taken after the function call would be different from a snapshot taken before the function call.name
is the name of the test grouping. Can be anything unique within the same crate.dev
is a block that returns a created virtio device. ``num_queuesis the number of queues to be created.
modfun` is the function name of the function that would modify the device. The function call should modify the device so that a snapshot taken after the function call would be different from a snapshot taken before the function call.
Structs§
- Pci Bar Range information
- A device container for routing reads and writes over some address space.
- Information about how a device was accessed.
- Holds a base and length representing the address space occupied by a
BusDevice
. - ChildProcIntf is the interface to the device child process.
- Holds the parameters for a coiommu device
- A i8042 PS/2 controller that emulates just enough to shutdown the machine.
- Parameters for legacy INTx interrrupt.
- A structure suitable for implementing edge triggered interrupts in device backends.
- A structure suitable for implementing level triggered interrupts in device backends.
- A NetResourceCarrier is a ResourceCarrier specialization for virtio-net devices.
- PCI Device Address, AKA Bus:Device.Function
- Pci Bus information
- Emulates PCI configuration access mechanism #1 (I/O ports 0xcf8 and 0xcfc).
- Emulates PCI memory-mapped configuration access mechanism.
- Emulates the PCI Root bridge.
- Inspired by PCI configuration space, CrosVM provides 2048 dword virtual registers (8KiB in total) for each PCI device. The guest can use these registers to exchange device-specific information with crosvm. The first 4kB is trapped by crosvm and crosvm supplies these register’s emulation. The second 4KB is mapped into guest directly as shared memory, so when guest access this 4KB, vm exit doesn’t happen. All these virtual registers from all PCI devices locate in a contiguous memory region. The base address of this memory region is provided by an IntObj named VCFG in the ACPI DSDT. Bit 12 is used to select the first trapped page or the second directly mapped page The offset of each register is calculated in the same way as PCIe ECAM; i.e. offset = (bus << 21) | (device << 16) | (function << 13) | (page_select << 12) | (register_index << 2)
- Pcie root port device has a corresponding host pcie root port.
- Wraps an inner
BusDevice
that is run inside a child process via fork. - Emulates serial COM ports commonly seen on x86 I/O ports 0x3f8/0x2f8/0x3e8/0x2e8.
- Request CoIOMMU to unpin a specific range.
- Implements the Vfio Pci device, then a pci device is added into vm
- Upstream linux compatible version of the virtual cpufreq interface
- A proxy object that connects to the vtpmd on ChromeOS.
Enums§
- Holds the coiommu unpin policy
- The key to identify hotplug device from host view. like host sysfs path for vfio pci device, host disk file path for virtio block device
- PCI address parsing and conversion errors.
- Classes of PCI nodes.
- PCI has four interrupt pins A->D.
- Errors for proxy devices.
- A ResourceCarrier moves resources for PCI device across process boundary.
Constants§
Traits§
- Trait for devices that respond to reads or writes in an arbitrary address space.
- Trait for generic device abstraction, that is, all devices that reside on BusDevice and want to be converted back to its original type. Each new foo device must provide as_foo_device() + as_foo_device_mut() + into_foo_device(), default impl methods return None.
- Trait for devices that notify hotplug event into guest
- Additional requirements for a PciDevice to support hotplug. A hotplug device can be configured without access to the SystemAllocator.
- This trait provides the functions required for a device to implement to successfully suspend/resume in crosvm.