Crate devices

source ·
Expand description

Emulates virtual and hardware devices.

Re-exports

Modules

Macros

  • Implements From between two structs whose each field implements From 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.
  • Implements the Vfio Pci device, then a pci device is added into vm
  • A proxy object that connects to the vtpmd on ChromeOS.

Enums

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.

Functions

Type Definitions