ResourceConstraint

Enum ResourceConstraint 

Source
pub enum ResourceConstraint {
    PioAddress {
        range: Option<(u16, u16)>,
        align: u16,
        size: u16,
    },
    MmioAddress {
        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 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.

§

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

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