Edit

Share via


Device Virtualization

Overview

The Host Compute APIs allow applications to extend the Hyper-V platform with virtualization support for generic PCI devices. By leveraging these APIs, applications can create virtual machines and offer them virtual devices that are not natively supported by the Hyper-V platform, such as cameras or sensors. The host-side code that virtualizes the device is supplied by the application, and the application is in full control of the device behavior as observed from the guest.

The following section contains the definitions of the APIs for device virtualization in the HCS. The DLL exports a set of C-style Windows API functions, the functions return HRESULT error codes indicating the result of the function call.

Device Virtualization Operations

Function Description
HdvCreateDeviceInstance Creates a device instance in the current host.
HdvCreateGuestMemoryAperture Creates a guest RAM aperture in the address space of the calling process.
HdvCreateSectionBackedMmioRange Maps a section into device MMIO space, so that accesses to those addresses are backed by the section.
HdvDeliverGuestInterrupt Delivers a message signaled interrupt (MSI) to the guest partition.
HdvDestroySectionBackedMmioRange Unmaps a section previously mapped via HdvCreateSectionBackedMmioRange.
HdvDeviceType Discriminator for the Emulated device type.
HdvInitializeDeviceHost Initializes a device emulator host in the caller's process.
HdvInitializeDeviceHostForProxy Initializes the device emulator host in the caller's process and associates it with the specified proxy.
HdvPciBarSelector Discriminator for the BAR selection.
HdvPciDeviceGetDetails Queries the PCI description of the emulated device.
HdvPciDeviceInitialize Initializes the emulated device.
HdvPciDeviceInterface Device emulation callbacks for PCI devices.
HdvPciDeviceSetConfiguration Sets the configuration of the emulated device.
HdvPciDeviceStart Notifies the emulated device that the virtual processors of the VM are about to start.
HdvPciDeviceStop Notifies the emulated device that the virtual processors of the VM are about to stop.
HdvPciDeviceTeardown Tears down the emulated device.
HdvPciInterfaceVersion Discriminator for the PCI device version.
HdvPciPnpId PnP ID definition for a virtual device.
HdvPciReadConfigSpace Executes a read into the emulated device's PCI config space.
HdvPciReadInterceptedMemory Executes an intercepted MMIO read for the emulated device.
HdvPciWriteConfigSpace Executes a write into the emulated device's PCI config space.
HdvPciWriteInterceptedMemory Executes an intercepted MMIO write for the emulated device.
HdvProxyDeviceHost Register a device host from another process with the compute system.
HdvReadGuestMemory Reads guest primary memory (RAM) contents into a buffer.
HdvRegisterDoorbell Registers a guest address to trigger an event on writes. The value of the write will be discarded.
HdvTeardownDeviceHost Tears down the device emulator host in the caller's process.
HdvUnregisterDoorbell Unregisters a doorbell notification.
HdvWriteGuestMemory Writes the contents of a specified buffer to guest primary memory (RAM).