Enum ResourceConstraint

Source
pub enum ResourceConstraint {
    PioAddress {
        range: Option<(u16, u16)>,
        align: u16,
        size: u16,
    },
    MmioAddress {
        range: Option<(u64, u64)>,
        align: u64,
        size: u64,
    },
    MemAddress {
        range: Option<(u64, u64)>,
        align: u64,
        size: u64,
    },
    LegacyIrq {
        irq: Option<u32>,
    },
    PciMsiIrq {
        size: u32,
    },
    PciMsixIrq {
        size: u32,
    },
    GenericIrq {
        size: u32,
    },
    KvmMemSlot {
        slot: Option<u32>,
        size: u32,
    },
}
Expand description

Enumeration describing a device’s resource allocation requirements and constraints.

Variants§

§

PioAddress

Constraint for an IO Port address range.

Fields

§range: Option<(u16, u16)>

Allocating resource within the range [min, max] if specified.

§align: u16

Alignment for the allocated address.

§size: u16

Size for the allocated address range.

§

MmioAddress

Constraint for a Memory Mapped IO address range.

Fields

§range: Option<(u64, u64)>

Allocating resource within the range [min, max] if specified.

§align: u64

Alignment for the allocated address.

§size: u64

Size for the allocated address range.

§

MemAddress

Constraint for a Guest Mem address range.

Fields

§range: Option<(u64, u64)>

Allocating resource within the range [min, max] if specified.

§align: u64

Alignment for the allocated address.

§size: u64

Size for the allocated address range.

§

LegacyIrq

Constraint for a legacy IRQ.

Fields

§irq: Option<u32>

Reserving the pre-allocated IRQ if it’s specified.

§

PciMsiIrq

Constraint for PCI MSI IRQs.

Fields

§size: u32

Number of Irqs to allocate.

§

PciMsixIrq

Constraint for PCI MSIx IRQs.

Fields

§size: u32

Number of Irqs to allocate.

§

GenericIrq

Constraint for generic IRQs.

Fields

§size: u32

Number of Irqs to allocate.

§

KvmMemSlot

Constraint for KVM mem_slot indexes to map memory into the guest.

Fields

§slot: Option<u32>

Allocating kvm memory slots starting from the index slot if specified.

§size: u32

Number of slots to allocate.

Implementations§

Source§

impl ResourceConstraint

Source

pub fn new_pio(size: u16) -> Self

Create a new PIO address constraint object with default configuration.

Source

pub fn pio_with_constraints( size: u16, range: Option<(u16, u16)>, align: u16, ) -> Self

Create a new PIO address constraint object.

Source

pub fn new_mmio(size: u64) -> Self

Create a new MMIO address constraint object with default configuration.

Source

pub fn mmio_with_constraints( size: u64, range: Option<(u64, u64)>, align: u64, ) -> Self

Create a new MMIO address constraint object.

Source

pub fn new_mem(size: u64) -> Self

Create a new Mem address constraint object with default configuration.

Source

pub fn mem_with_constraints( size: u64, range: Option<(u64, u64)>, align: u64, ) -> Self

Create a new Mem address constraint object.

Source

pub fn new_legacy_irq(irq: Option<u32>) -> Self

Create a new legacy IRQ constraint object.

Allocating the pre-allocated legacy Irq irq if specified.

Source

pub fn new_pci_msi_irq(size: u32) -> Self

Create a new PCI MSI IRQ constraint object.

Source

pub fn new_pci_msix_irq(size: u32) -> Self

Create a new PCI MSIX IRQ constraint object.

Source

pub fn new_generic_irq(size: u32) -> Self

Create a new Generic IRQ constraint object.

Source

pub fn new_kvm_mem_slot(size: u32, slot: Option<u32>) -> Self

Create a new KVM memory slot constraint object.

Allocating kvm memory slots starting from the index slot if specified.

Trait Implementations§

Source§

impl Clone for ResourceConstraint

Source§

fn clone(&self) -> ResourceConstraint

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ResourceConstraint

Source§

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

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

impl PartialEq for ResourceConstraint

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ResourceConstraint

Source§

impl Eq for ResourceConstraint

Source§

impl StructuralPartialEq for ResourceConstraint

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> 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<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.

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.

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.