virtio_drivers/device/common.rs
1//! Common part shared across all the devices.
2
3use bitflags::bitflags;
4
5bitflags! {
6 /// Common device-independent VirtIO device features.
7 #[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
8 pub struct Feature: u64 {
9 /// Legacy: The device must issue a used buffer notification when it runs out of available
10 /// descriptors, even if notifications are suppressed.
11 const NOTIFY_ON_EMPTY = 1 << 24;
12
13 /// Legacy: The device accepts arbitrary descriptor layouts.
14 const ANY_LAYOUT = 1 << 27;
15
16 /// The device can use descriptors with the indirect flag set.
17 const RING_INDIRECT_DESC = 1 << 28;
18
19 /// The `used_event` and `avail_event` fields can be used.
20 const RING_EVENT_IDX = 1 << 29;
21
22 /// Legacy: Used by QEMU's implemenation for experimental early versions of VirtIO which
23 /// didn't perform correct feature notification.
24 const UNUSED = 1 << 30;
25
26 /// Supports VirtIO version 1 or higher, rather than the legacy version.
27 const VERSION_1 = 1 << 32;
28
29 /// The device can be used on a platform where device access to memory is limited or
30 /// translated.
31 const ACCESS_PLATFORM = 1 << 33;
32
33 /// Use packed virtqueue layout.
34 const RING_PACKED = 1 << 34;
35
36 /// The device uses buffers in the same order that they were made available.
37 const IN_ORDER = 1 << 35;
38
39 /// Memory access by the driver and device are ordered in a way described by the platform.
40 const ORDER_PLATFORM = 1 << 36;
41
42 /// The device supports Single Root I/O Virtualisation.
43 const SR_IOV = 1 << 37;
44
45 /// The driver passes extra data in its device notifications.
46 const NOTIFICATION_DATA = 1 << 38;
47 }
48}