<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZCustomVirtioDevice",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZCustomVirtioDevice"
  },
  "title" : "VZCustomVirtioDevice"
}
-->

# VZCustomVirtioDevice

An interface that represents a custom Virtio device that you provide the implementation for.

```
class VZCustomVirtioDevice
```

## Overview

A Virtio device is a virtual emulated device the framework exposes to the guest OS following the Virtio standard. For more
information about the Virtio standard, see the [Virtio specification](https://docs.oasis-open.org/virtio/virtio/v1.3/csd01/virtio-v1.3-csd01.html).

A `VZCustomVirtioDevice` allows you to define, configure, and provide your own implementation for a device that uses the Virtio protocol.

To define a `VZCustomVirtioDevice` create and configure a `VZCustomVirtioDeviceConfiguration` object.

Once configured, the framework creates a `VZCustomVirtioDevice` object and returns it through the invocation of the delegate’s [`customVirtioConfiguration(_:didCreateDevice:)`](/documentation/Virtualization/VZCustomVirtioDeviceConfigurationDelegate/customVirtioConfiguration(_:didCreateDevice:)) method. Implement a class that conforms to the [`VZCustomVirtioDeviceDelegate`](/documentation/Virtualization/VZCustomVirtioDeviceDelegate) protocol to provide an implementation for the device.

The Virtualization framework performs all operations on the [`VZCustomVirtioDevice`](/documentation/Virtualization/VZCustomVirtioDevice) and [`VZCustomVirtioDeviceDelegate`](/documentation/Virtualization/VZCustomVirtioDeviceDelegate) through a serial queue that you can configure through the [`deviceQueue`](/documentation/Virtualization/VZCustomVirtioDevice/deviceQueue) property. If the queue isn’t set, the framework performs all operations on the queue in the VM’s [`VZVirtualMachine`](/documentation/Virtualization/VZVirtualMachine) [`queue`](/documentation/Virtualization/VZVirtualMachine/queue) property by default.

## Topics

### Instance Properties

[`var delegate: (any VZCustomVirtioDeviceDelegate)?`](/documentation/Virtualization/VZCustomVirtioDevice/delegate)

The device’s delegate.

[`var deviceQueue: dispatch_queue_t`](/documentation/Virtualization/VZCustomVirtioDevice/deviceQueue)

The dispatch queue this device uses.

[`var negotiatedFeatures: VZNegotiatedVirtioFeatureSet?`](/documentation/Virtualization/VZCustomVirtioDevice/negotiatedFeatures)

The set of features that the driver and the device have successfully negotiated, or `nil` if no feature negotiation has taken place.

[`var sharedMemoryRegions: [VZVirtioSharedMemoryRegion]`](/documentation/Virtualization/VZCustomVirtioDevice/sharedMemoryRegions)

An array of shared memory regions that this device exposes to the guest.

### Instance Methods

[`func guestMemoryMapping(atPhysicalAddress: UInt64, length: Int) -> VZGuestMemoryMapping?`](/documentation/Virtualization/VZCustomVirtioDevice/guestMemoryMapping(atPhysicalAddress:length:))

Returns guest memory mapping referred to by physicalAddress and length.

[`func queue(at: UInt16) -> VZVirtioQueue?`](/documentation/Virtualization/VZCustomVirtioDevice/queue(at:))

Returns Virtio queue at the specified index that belongs to this device.

[`func requestReset()`](/documentation/Virtualization/VZCustomVirtioDevice/requestReset())

A request to reset the device.

[`func update(VZVirtioDeviceSpecificConfiguration, completionHandler: ((any Error)?) -> Void)`](/documentation/Virtualization/VZCustomVirtioDevice/update(_:completionHandler:))

Updates the device’s device-specific configuration.

## See Also

[`class VZCustomVirtioDeviceConfiguration`](/documentation/Virtualization/VZCustomVirtioDeviceConfiguration)

An object that defines a custom Virtio Device configuration.

[`protocol VZCustomVirtioDeviceConfigurationDelegate`](/documentation/Virtualization/VZCustomVirtioDeviceConfigurationDelegate)

A class that conforms to the custom Virtio device configuration delegate protocol that can provide methods
for tracking the state of a custom Virtio device configuration object.

[`protocol VZCustomVirtioDeviceDelegate`](/documentation/Virtualization/VZCustomVirtioDeviceDelegate)

A delegate protocol that defines the methods you implement to respond to the life cycle events of a custom Virtio device.

[`class VZVirtioQueue`](/documentation/Virtualization/VZVirtioQueue)

A Virtio queue.

[`class VZVirtioSharedMemoryRegion`](/documentation/Virtualization/VZVirtioSharedMemoryRegion)

A class that represents a Virtio shared memory region for a custom Virtio device in a virtual machine.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)