pub struct VirtioFeatureBits(pub u128);Expand description
Configures virtio device operation.
Each bit represents an optional feature or an alternative mode for an aspect of the virtio device’s operation.
Tuple Fields§
§0: u128Implementations§
Source§impl VirtioFeatureBits
impl VirtioFeatureBits
Sourcepub fn notify_on_empty_queue(&self) -> bool
pub fn notify_on_empty_queue(&self) -> bool
The device notifies when a virtqueue has no submitted buffers.
If this feature is negotiated, the device issues a virtqueue notification when it has completed all the commands submitted on the virtqueue.
Sourcepub fn supports_flexible_memory_layout(&self) -> bool
pub fn supports_flexible_memory_layout(&self) -> bool
Remove virtio queue memory layout constraints in legacy mode.
The feature is only meaningful if [uses_virtio1_standard] is not
negotiated. Flexible memory layout is required by the virtio 1.0+
standard.
If this feature or [uses_virtio1_standard] is negotiated, the driver
does not need to support memory layout limitations in early virtio
device implementations.
If neither feature is negotiated, the driver must meet the constraints specified in the “Legacy Interface: Framing Requirements” sections of the relevant device type specification.
This driver only supports virtio 1.0+ devices, and does not attempt to negotiate this feature.
Sourcepub fn supports_indirect_descriptors(&self) -> bool
pub fn supports_indirect_descriptors(&self) -> bool
Indirect descriptors are supported.
[VirtioMemoryRangeFlags::is_indirect] may be set to true iff
this feature is negotiated.
Sourcepub fn uses_virtqueue_notification_index(&self) -> bool
pub fn uses_virtqueue_notification_index(&self) -> bool
Use selective virtqueue notifications.
Sourcepub fn unused_qemu_experimental(&self) -> bool
pub fn unused_qemu_experimental(&self) -> bool
Workaround for bug in early QEMU implementations.
This driver does not attempt to negotiate this feature.
Sourcepub fn uses_virtio1_standard(&self) -> bool
pub fn uses_virtio1_standard(&self) -> bool
Use the virtio 1.0+ standard.
Failing to negotiate this feature enables behaviors called “legacy” in the specification.
This driver only supports virtio 1.0+ devices, and fails to initialize if the device does not offer this feature.
Sourcepub fn has_limited_memory_access(&self) -> bool
pub fn has_limited_memory_access(&self) -> bool
Signals that the device’s memory accesses are limited or translated.
By default, the driver may assume that the virtio implementation can access any physical memory address provided by the driver. If this feature is negotiated, the device’s memory accesses may be gated by an IOMMU.
This driver does not currently support this feature.
Sourcepub fn uses_packed_virtqueues(&self) -> bool
pub fn uses_packed_virtqueues(&self) -> bool
Use packed virtqueues, as opposed to split virtqueues.
By default, virtqueues use split virtqueues. If this feature is negotiated, virtqueues use packed virtqueues.
This driver currently only supports split virtqueues, and does not attempt to negotiate this feature.
Sourcepub fn returns_buffers_in_submission_order(&self) -> bool
pub fn returns_buffers_in_submission_order(&self) -> bool
The device always returns virtqueue buffers in submission order.
By default, virtio devices are free to return submitted virtqueue buffers in any order. If this feature is negotiated, devices will follow submission order when returning the buffers. So, negotiating this feature can simplify the driver’s buffer management, at the cost of reducing performance optimization opportunities for the device.
Only some devices offer this feature. For example, the virtio-gpu implementation in QEMU and crosvm does not offer this feature.
Sourcepub fn assumes_hardware_memory_barriers(&self) -> bool
pub fn assumes_hardware_memory_barriers(&self) -> bool
Use the memory access ordering rules for device memory accesses.
By default, the virtio device must behave as if it accesses memory directly from one of the CPU cores, which entails access to coherent caches.
If this feature is negotiated, the virtio device may perform optimizations that assume the driver issues the memory access barriers needed for external hardware devices.
This driver always issues the memory barriers required by the platform, even if the feature is not negotiated.
Sourcepub fn supports_io_virtualization(&self) -> bool
pub fn supports_io_virtualization(&self) -> bool
Enables device support for PCI Single Root I/O Virtualization (SR-IOV).
If this feature is negotiated, the driver may use the PCI SR-IOV capability structure to enable virtual functions.
This driver does not use SR-IOV.
Sourcepub fn uses_extended_notification_data(&self) -> bool
pub fn uses_extended_notification_data(&self) -> bool
Enables extra data in the driver’s device notifications.
By default, the notifications issued by the driver only identify a target virtqueue. If this feature is negotiated, the notifications include more data.
This driver does not attempt to negotiate this feature. None of the virtio implementations targeted by this driver take advantage of this feature.
Sourcepub fn uses_custom_virtqueue_ids(&self) -> bool
pub fn uses_custom_virtqueue_ids(&self) -> bool
Enables custom virtqueue IDs in driver-issued notifications.
By default, the driver identifies virtqueues using their index. If this feature is negotiated, the notifications include a custom virtqueue ID provided by the device.
This driver does not attempt to negotiate this feature. The feature is not implemented in any of the virtio implementations targeted by this driver.
Sourcepub fn supports_queue_reset(&self) -> bool
pub fn supports_queue_reset(&self) -> bool
Enables virtqueue-level reset.
If this feature is not negotiated, the driver only has a device-level reset mechanism.
Sourcepub fn uses_admin_virtqueues(&self) -> bool
pub fn uses_admin_virtqueues(&self) -> bool
Enables driver usage of the device’s administration virtqueues.
If this feature is negotiated, the driver must configure the device’s administration virtqueues during device initialization.
This driver does not support administration virtqueues.
Sourcepub fn suspend_enabled(&self) -> bool
pub fn suspend_enabled(&self) -> bool
Enables the device’s suspend functionality.
If this feature is enabled DeviceStatus::suspended may be set.
Sourcepub fn set_notify_on_empty_queue(&mut self, value: bool)
pub fn set_notify_on_empty_queue(&mut self, value: bool)
The device notifies when a virtqueue has no submitted buffers.
If this feature is negotiated, the device issues a virtqueue notification when it has completed all the commands submitted on the virtqueue.
Sourcepub fn set_supports_flexible_memory_layout(&mut self, value: bool)
pub fn set_supports_flexible_memory_layout(&mut self, value: bool)
Remove virtio queue memory layout constraints in legacy mode.
The feature is only meaningful if [uses_virtio1_standard] is not
negotiated. Flexible memory layout is required by the virtio 1.0+
standard.
If this feature or [uses_virtio1_standard] is negotiated, the driver
does not need to support memory layout limitations in early virtio
device implementations.
If neither feature is negotiated, the driver must meet the constraints specified in the “Legacy Interface: Framing Requirements” sections of the relevant device type specification.
This driver only supports virtio 1.0+ devices, and does not attempt to negotiate this feature.
Sourcepub fn set_supports_indirect_descriptors(&mut self, value: bool)
pub fn set_supports_indirect_descriptors(&mut self, value: bool)
Indirect descriptors are supported.
[VirtioMemoryRangeFlags::is_indirect] may be set to true iff
this feature is negotiated.
Sourcepub fn set_uses_virtqueue_notification_index(&mut self, value: bool)
pub fn set_uses_virtqueue_notification_index(&mut self, value: bool)
Use selective virtqueue notifications.
Sourcepub fn set_unused_qemu_experimental(&mut self, value: bool)
pub fn set_unused_qemu_experimental(&mut self, value: bool)
Workaround for bug in early QEMU implementations.
This driver does not attempt to negotiate this feature.
Sourcepub fn set_uses_virtio1_standard(&mut self, value: bool)
pub fn set_uses_virtio1_standard(&mut self, value: bool)
Use the virtio 1.0+ standard.
Failing to negotiate this feature enables behaviors called “legacy” in the specification.
This driver only supports virtio 1.0+ devices, and fails to initialize if the device does not offer this feature.
Sourcepub fn set_has_limited_memory_access(&mut self, value: bool)
pub fn set_has_limited_memory_access(&mut self, value: bool)
Signals that the device’s memory accesses are limited or translated.
By default, the driver may assume that the virtio implementation can access any physical memory address provided by the driver. If this feature is negotiated, the device’s memory accesses may be gated by an IOMMU.
This driver does not currently support this feature.
Sourcepub fn set_uses_packed_virtqueues(&mut self, value: bool)
pub fn set_uses_packed_virtqueues(&mut self, value: bool)
Use packed virtqueues, as opposed to split virtqueues.
By default, virtqueues use split virtqueues. If this feature is negotiated, virtqueues use packed virtqueues.
This driver currently only supports split virtqueues, and does not attempt to negotiate this feature.
Sourcepub fn set_returns_buffers_in_submission_order(&mut self, value: bool)
pub fn set_returns_buffers_in_submission_order(&mut self, value: bool)
The device always returns virtqueue buffers in submission order.
By default, virtio devices are free to return submitted virtqueue buffers in any order. If this feature is negotiated, devices will follow submission order when returning the buffers. So, negotiating this feature can simplify the driver’s buffer management, at the cost of reducing performance optimization opportunities for the device.
Only some devices offer this feature. For example, the virtio-gpu implementation in QEMU and crosvm does not offer this feature.
Sourcepub fn set_assumes_hardware_memory_barriers(&mut self, value: bool)
pub fn set_assumes_hardware_memory_barriers(&mut self, value: bool)
Use the memory access ordering rules for device memory accesses.
By default, the virtio device must behave as if it accesses memory directly from one of the CPU cores, which entails access to coherent caches.
If this feature is negotiated, the virtio device may perform optimizations that assume the driver issues the memory access barriers needed for external hardware devices.
This driver always issues the memory barriers required by the platform, even if the feature is not negotiated.
Sourcepub fn set_supports_io_virtualization(&mut self, value: bool)
pub fn set_supports_io_virtualization(&mut self, value: bool)
Enables device support for PCI Single Root I/O Virtualization (SR-IOV).
If this feature is negotiated, the driver may use the PCI SR-IOV capability structure to enable virtual functions.
This driver does not use SR-IOV.
Sourcepub fn set_uses_extended_notification_data(&mut self, value: bool)
pub fn set_uses_extended_notification_data(&mut self, value: bool)
Enables extra data in the driver’s device notifications.
By default, the notifications issued by the driver only identify a target virtqueue. If this feature is negotiated, the notifications include more data.
This driver does not attempt to negotiate this feature. None of the virtio implementations targeted by this driver take advantage of this feature.
Sourcepub fn set_uses_custom_virtqueue_ids(&mut self, value: bool)
pub fn set_uses_custom_virtqueue_ids(&mut self, value: bool)
Enables custom virtqueue IDs in driver-issued notifications.
By default, the driver identifies virtqueues using their index. If this feature is negotiated, the notifications include a custom virtqueue ID provided by the device.
This driver does not attempt to negotiate this feature. The feature is not implemented in any of the virtio implementations targeted by this driver.
Sourcepub fn set_supports_queue_reset(&mut self, value: bool)
pub fn set_supports_queue_reset(&mut self, value: bool)
Enables virtqueue-level reset.
If this feature is not negotiated, the driver only has a device-level reset mechanism.
Sourcepub fn set_uses_admin_virtqueues(&mut self, value: bool)
pub fn set_uses_admin_virtqueues(&mut self, value: bool)
Enables driver usage of the device’s administration virtqueues.
If this feature is negotiated, the driver must configure the device’s administration virtqueues during device initialization.
This driver does not support administration virtqueues.
Sourcepub fn set_suspend_enabled(&mut self, value: bool)
pub fn set_suspend_enabled(&mut self, value: bool)
Enables the device’s suspend functionality.
If this feature is enabled DeviceStatus::suspended may be set.
Trait Implementations§
Source§impl<T> BitRange<T> for VirtioFeatureBits
impl<T> BitRange<T> for VirtioFeatureBits
Source§impl<T> BitRangeMut<T> for VirtioFeatureBitswhere
u128: BitRangeMut<T>,
impl<T> BitRangeMut<T> for VirtioFeatureBitswhere
u128: BitRangeMut<T>,
Source§fn set_bit_range(&mut self, msb: usize, lsb: usize, value: T)
fn set_bit_range(&mut self, msb: usize, lsb: usize, value: T)
Source§impl Clone for VirtioFeatureBits
impl Clone for VirtioFeatureBits
impl Copy for VirtioFeatureBits
Source§impl Debug for VirtioFeatureBits
impl Debug for VirtioFeatureBits
Source§impl Default for VirtioFeatureBits
impl Default for VirtioFeatureBits
impl Eq for VirtioFeatureBits
Source§impl PartialEq for VirtioFeatureBits
impl PartialEq for VirtioFeatureBits
impl StructuralPartialEq for VirtioFeatureBits
Auto Trait Implementations§
impl Freeze for VirtioFeatureBits
impl RefUnwindSafe for VirtioFeatureBits
impl Send for VirtioFeatureBits
impl Sync for VirtioFeatureBits
impl Unpin for VirtioFeatureBits
impl UnsafeUnpin for VirtioFeatureBits
impl UnwindSafe for VirtioFeatureBits
Blanket Implementations§
Source§impl<T> BitMut for Twhere
T: BitRangeMut<u8>,
impl<T> BitMut for Twhere
T: BitRangeMut<u8>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]