pub struct VfioPciDevice { /* private fields */ }
Expand description
Provides control over a PCI device using VFIO.
Implementations§
Source§impl VfioPciDevice
impl VfioPciDevice
Sourcepub fn open<P: AsRef<Path>>(sysfs_path: P) -> Result<VfioPciDevice>
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.
Sourcepub fn open_in_container<P: AsRef<Path>>(
sysfs_path: P,
container: Arc<VfioContainer>,
) -> Result<VfioPciDevice>
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.
Sourcepub fn container(&self) -> &Arc<VfioContainer>
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
impl Debug for VfioPciDevice
Source§impl PciDevice for VfioPciDevice
impl PciDevice for VfioPciDevice
Source§fn config(&self) -> PciConfig<'_>
fn config(&self) -> PciConfig<'_>
Source§fn bar(&self, index: usize) -> Option<OwningPciRegion>
fn bar(&self, index: usize) -> Option<OwningPciRegion>
None
if there is no such BAR or it is unused by the device. Read moreSource§fn rom(&self) -> Option<OwningPciRegion>
fn rom(&self) -> Option<OwningPciRegion>
None
if the device doesn’t have one. Read more