⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

PassthroughDevice

Struct PassthroughDevice 

Source
pub struct PassthroughDevice {
    pub device_type: PassthroughDeviceType,
    pub pci_config: PciConfigPassthrough,
    pub mmio_regions: Vec<MmioRegion>,
    pub msix_remaps: Vec<MsixRemap>,
    pub assigned: bool,
    pub owner_vm_id: u64,
}
Expand description

A passthrough device assigned to a guest VM

Fields§

§device_type: PassthroughDeviceType

Device type

§pci_config: PciConfigPassthrough

PCI configuration space

§mmio_regions: Vec<MmioRegion>

MMIO regions mapped into guest

§msix_remaps: Vec<MsixRemap>

MSI-X vector remappings

§assigned: bool

Whether the device is currently assigned to a guest

§owner_vm_id: u64

VM ID that owns this device

Implementations§

Source§

impl PassthroughDevice

Source

pub fn new( device_type: PassthroughDeviceType, vendor_id: u16, device_id: u16, bdf: u32, ) -> Self

Source

pub fn assign_to_vm(&mut self, vm_id: u64) -> Result<(), VmError>

Assign device to a VM

Source

pub fn unassign(&mut self)

Unassign device from VM (reset on guest exit)

Source

pub fn add_mmio_region(&mut self, host_phys: u64, guest_phys: u64, size: u64)

Add an MMIO region mapping

Source

pub fn add_msix_remap( &mut self, host_vector: u16, guest_vector: u16, target_vcpu: u8, )

Add an MSI-X remap entry

Source

pub fn remap_interrupt(&self, host_vector: u16) -> Option<(u16, u8)>

Look up guest vector for a host interrupt

Source

pub fn reset(&mut self)

Reset device to initial state

Source

pub fn is_assigned(&self) -> bool

Source

pub fn mmio_region_count(&self) -> usize

Source

pub fn msix_remap_count(&self) -> usize

Auto Trait Implementations§

§

impl Freeze for PassthroughDevice

§

impl RefUnwindSafe for PassthroughDevice

§

impl Send for PassthroughDevice

§

impl Sync for PassthroughDevice

§

impl Unpin for PassthroughDevice

§

impl UnwindSafe for PassthroughDevice

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.