Skip to main content

VirtioFeatureBits

Struct VirtioFeatureBits 

Source
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: u128

Implementations§

Source§

impl VirtioFeatureBits

Source

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.

Source

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.

Source

pub fn supports_indirect_descriptors(&self) -> bool

Indirect descriptors are supported.

[VirtioMemoryRangeFlags::is_indirect] may be set to true iff this feature is negotiated.

Source

pub fn uses_virtqueue_notification_index(&self) -> bool

Use selective virtqueue notifications.

Source

pub fn unused_qemu_experimental(&self) -> bool

Workaround for bug in early QEMU implementations.

This driver does not attempt to negotiate this feature.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn suspend_enabled(&self) -> bool

Enables the device’s suspend functionality.

If this feature is enabled DeviceStatus::suspended may be set.

Source

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.

Source

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.

Source

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.

Source

pub fn set_uses_virtqueue_notification_index(&mut self, value: bool)

Use selective virtqueue notifications.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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
where u128: BitRange<T>,

Source§

fn bit_range(&self, msb: usize, lsb: usize) -> T

Get a range of bits.
Source§

impl<T> BitRangeMut<T> for VirtioFeatureBits
where u128: BitRangeMut<T>,

Source§

fn set_bit_range(&mut self, msb: usize, lsb: usize, value: T)

Set a range of bits.
Source§

impl Clone for VirtioFeatureBits

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for VirtioFeatureBits

Source§

impl Debug for VirtioFeatureBits

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VirtioFeatureBits

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for VirtioFeatureBits

Source§

impl PartialEq for VirtioFeatureBits

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for VirtioFeatureBits

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Bit for T
where T: BitRange<u8>,

Source§

fn bit(&self, bit: usize) -> bool

Get a single bit.
Source§

impl<T> BitMut for T
where T: BitRangeMut<u8>,

Source§

fn set_bit(&mut self, bit: usize, value: bool)

Set a single bit.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> InstanceFromServiceTransport<T> for T

§

fn from_service_transport(handle: T) -> T

Converts the given service transport handle of type T to [Self]
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<E> RunsTransport<Mpsc> for E

§

impl<E> RunsTransport<Mpsc> for E
where E: RunsTransport<Mpsc>,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.