Crate devices

Source
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 From between two structs whose each field implements From each 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 BackendDeviceType in usb/backend/device.rs for an example usage of it.
register
register_array
static_register
Macro helps to build a static register.
suspendable_tests
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.
suspendable_virtio_tests
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.
usb_trace
xhci_trace

StructsΒ§

BarRange
Pci Bar Range information
Bus
A device container for routing reads and writes over some address space.
BusAccessInfo
Information about how a device was accessed.
BusRange
Holds a base and length representing the address space occupied by a BusDevice.
ChildProcIntf
ChildProcIntf is the interface to the device child process.
CoIommuDev
CoIommuParameters
Holds the parameters for a coiommu device
Debugcon
FwCfgDevice
FwCfgParameters
GpeScope
I8042Device
A i8042 PS/2 controller that emulates just enough to shutdown the machine.
IntxParameter
Parameters for legacy INTx interrrupt.
IrqEdgeEvent
A structure suitable for implementing edge triggered interrupts in device backends.
IrqLevelEvent
A structure suitable for implementing level triggered interrupts in device backends.
NetResourceCarrier
A NetResourceCarrier is a ResourceCarrier specialization for virtio-net devices.
PciAddress
PCI Device Address, AKA Bus:Device.Function
PciBarConfiguration
PciBridge
PciBus
Pci Bus information
PciConfigIo
Emulates PCI configuration access mechanism #1 (I/O ports 0xcf8 and 0xcfc).
PciConfigMmio
Emulates PCI memory-mapped configuration access mechanism.
PciRoot
Emulates the PCI Root bridge.
PciVirtualConfigMmio
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)
PcieDownstreamPort
PcieHostPort
Pcie root port device has a corresponding host pcie root port.
PcieRootPort
PcieUpstreamPort
Pflash
PflashParameters
Pit
ProxyDevice
Wraps an inner BusDevice that is run inside a child process via fork.
PvPanicPciDevice
Serial
Emulates serial COM ports commonly seen on x86 I/O ports 0x3f8/0x2f8/0x3e8/0x2e8.
StubPciDevice
StubPciParameters
UnpinRequest
Request CoIOMMU to unpin a specific range.
VfioPciDevice
Implements the Vfio Pci device, then a pci device is added into vm
VfioPlatformDevice
VirtCpufreq
VirtCpufreqV2
Upstream linux compatible version of the virtual cpufreq interface
VtpmProxy
A proxy object that connects to the vtpmd on ChromeOS.

EnumsΒ§

BusError
BusType
CoIommuUnpinPolicy
Holds the coiommu unpin policy
CrosvmDeviceId
DeviceState
FwCfgError
FwCfgItemType
HotPlugKey
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
IommuDevType
PciAddressError
PCI address parsing and conversion errors.
PciClassCode
Classes of PCI nodes.
PciDeviceError
PciInterruptPin
PCI has four interrupt pins A->D.
PciRootCommand
PitError
PreferredIrq
ProxyError
Errors for proxy devices.
PvPanicCode
ResourceCarrier
A ResourceCarrier moves resources for PCI device across process boundary.
UnpinResponse

ConstantsΒ§

FW_CFG_BASE_PORT
FW_CFG_MAX_FILE_SLOTS
FW_CFG_WIDTH

TraitsΒ§

BusDevice
Trait for devices that respond to reads or writes in an arbitrary address space.
BusDeviceObj
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.
BusDeviceSync
BusResumeDevice
HotPlugBus
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
PciMmioMapper
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 πŸ”’

Type AliasesΒ§

PciBarIndex