Struct VfioPciDevice

Source
pub struct VfioPciDevice { /* private fields */ }
Expand description

Provides control over a PCI device using VFIO.

Implementations§

Source§

impl VfioPciDevice

Source

pub fn open<P: AsRef<Path>>(sysfs_path: P) -> Result<VfioPciDevice>

Creates a new VfioContainer containing only the group that contains the given vfio-pci device, then calls VfioPciDevice::open_in_container with the same path and the created container.

Note that this only works if no other VfioContainer already contains the device’s group, and so you must use VfioPciDevice::open_in_container if you want to drive several devices from the same VFIO group.

Source

pub fn open_in_container<P: AsRef<Path>>( sysfs_path: P, container: Arc<VfioContainer>, ) -> Result<VfioPciDevice>

Opens a vfio-pci device and adds it to the given container.

sysfs_path must correspond to the device’s sysfs directory, e.g., /sys/bus/pci/devices/0000:00:01.0. container must contain the group to which the device belongs.

Returns a VfioPciDevice corresponding to the opened device.

Source

pub fn container(&self) -> &Arc<VfioContainer>

Returns a reference to the container to which the device’s group belongs.

Trait Implementations§

Source§

impl Debug for VfioPciDevice

Source§

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

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

impl PciDevice for VfioPciDevice

Source§

fn config(&self) -> PciConfig<'_>

Returns a thing that lets you access the PCI configuration space. Read more
Source§

fn bar(&self, index: usize) -> Option<OwningPciRegion>

Returns a region that corresponds to the Base Address Register (BAR) with the given index, or None if there is no such BAR or it is unused by the device. Read more
Source§

fn rom(&self) -> Option<OwningPciRegion>

Returns a region that is the PCI Expansion ROM, or None if the device doesn’t have one. Read more
Source§

fn iommu(&self) -> PciIommu<'_>

Returns a thing that lets you manage IOMMU mappings for DMA. Read more
Source§

fn interrupts(&self) -> PciInterrupts<'_>

Returns a thing that lets you manage interrupts. Read more
Source§

fn reset(&self) -> Result<()>

Reset this function, and only it. Read more

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.