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Β§
- ac_
adapter - acpi
- bat
- bus π
- Handles routing to devices in an address space.
- cmos
- debugcon π
- fw_cfg π
- fw_cfg device implementing QEMUβs Firmware Configuration interface https://www.qemu.org/docs/master/specs/fw_cfg.html
- i8042 π
- irq_
event π - irqchip
- 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 π
- pl030
- platform π
- Implements platform devices and busses.
- pmc_
virt - proxy π
- Runs hardware devices in child processes.
- register_
space π - serial π
- serial_
device - suspendable π
- Trait to suspend virtual hardware.
- sys π
- tsc
- Handles operations using platform Time Stamp Counter (TSC).
- usb
- utils π
- vfio
- virtcpufreq π
- virtcpufreq_
v2 π - virtio
- Implements virtio devices, queues, and transport mechanisms.
- vmwdt
- 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 π - vTPM Proxy backend using the vtpmd on ChromeOS to virtualize TPM commands.
MacrosΒ§
- impl_
from_ for_ interconvertible_ structs - Implements
Frombetween two structs whose each field implementsFromeach other. - impl_
try_ from_ le32_ for_ enumn - Implements TryFrom<data_model::Le32> for an enum that implements
enumn::N. - multi_
dispatch - Allows dispatching a function call to all its enum value implementations.
See
BackendDeviceTypein usb/backend/device.rs for an example usage of it. - register
- register_
array - static_
register - Macro helps to build a static register.
- suspendable_
tests devis the device.modfunis 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.- suspendable_
virtio_ tests nameis the name of the test grouping. Can be anything unique within the same crate.devis 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.- usb_
trace - xhci_
trace
StructsΒ§
- BarRange
- Pci Bar Range information
- Bus
- A device container for routing reads and writes over some address space.
- BusAccess
Info - Information about how a device was accessed.
- BusRange
- Holds a base and length representing the address space occupied by a
BusDevice. - Child
Proc Intf - ChildProcIntf is the interface to the device child process.
- CoIommu
Dev - CoIommu
Parameters - Holds the parameters for a coiommu device
- Debugcon
- FwCfg
Device - FwCfg
Parameters - GpeScope
- I8042
Device - A i8042 PS/2 controller that emulates just enough to shutdown the machine.
- Intx
Parameter - Parameters for legacy INTx interrrupt.
- IrqEdge
Event - A structure suitable for implementing edge triggered interrupts in device backends.
- IrqLevel
Event - A structure suitable for implementing level triggered interrupts in device backends.
- NetResource
Carrier - A NetResourceCarrier is a ResourceCarrier specialization for virtio-net devices.
- PciAddress
- PCI Device Address, AKA Bus:Device.Function
- PciBar
Configuration - PciBridge
- PciBus
- Pci Bus information
- PciConfig
Io - Emulates PCI configuration access mechanism #1 (I/O ports 0xcf8 and 0xcfc).
- PciConfig
Mmio - Emulates PCI memory-mapped configuration access mechanism.
- PciRoot
- Emulates the PCI Root bridge.
- PciVirtual
Config Mmio - 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
Downstream Port - Pcie
Host Port - Pcie root port device has a corresponding host pcie root port.
- Pcie
Root Port - Pcie
Upstream Port - Pflash
- Pflash
Parameters - Pit
- Proxy
Device - Wraps an inner
BusDevicethat is run inside a child process via fork. - PvPanic
PciDevice - Serial
- Emulates serial COM ports commonly seen on x86 I/O ports 0x3f8/0x2f8/0x3e8/0x2e8.
- Stub
PciDevice - Stub
PciParameters - Unpin
Request - Request CoIOMMU to unpin a specific range.
- Vfio
PciDevice - Implements the Vfio Pci device, then a pci device is added into vm
- Vfio
Platform Device - Virt
Cpufreq - Virt
Cpufreq V2 - Upstream linux compatible version of the virtual cpufreq interface
- Vtpm
Proxy - A proxy object that connects to the vtpmd on ChromeOS.
EnumsΒ§
- BusError
- BusType
- CoIommu
Unpin Policy - Holds the coiommu unpin policy
- Crosvm
Device Id - Device
State - FwCfg
Error - FwCfg
Item Type - HotPlug
Key - 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
- Iommu
DevType - PciAddress
Error - PCI address parsing and conversion errors.
- PciClass
Code - Classes of PCI nodes.
- PciDevice
Error - PciInterrupt
Pin - PCI has four interrupt pins A->D.
- PciRoot
Command - PitError
- Preferred
Irq - Proxy
Error - Errors for proxy devices.
- PvPanic
Code - Resource
Carrier - A ResourceCarrier moves resources for PCI device across process boundary.
- Unpin
Response
ConstantsΒ§
TraitsΒ§
- BusDevice
- Trait for devices that respond to reads or writes in an arbitrary address space.
- BusDevice
Obj - 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.
- BusDevice
Sync - BusResume
Device - HotPlug
Bus - Trait for devices that notify hotplug event into guest
- HotPluggable
- Additional requirements for a PciDevice to support hotplug. A hotplug device can be configured without access to the SystemAllocator.
- PciDevice
- PciMmio
Mapper - Suspendable
- This trait provides the functions required for a device to implement to successfully suspend/resume in crosvm.
FunctionsΒ§
- create_
devices_ worker_ thread - handle_
command_ πtube - restore_
devices π - sleep_
buses π - snapshot_
handler π - wake_
buses π