pub struct VfioContainer { /* private fields */ }
Expand description
A VFIO container representing an IOMMU context that may contain zero or more VFIO groups.
Implementations§
Source§impl VfioContainer
impl VfioContainer
Sourcepub fn new(groups: &[u32]) -> Result<VfioContainer>
pub fn new(groups: &[u32]) -> Result<VfioContainer>
Creates a new, empty VfioContainer
.
This fails if not all devices in all given groups have been bound to vfio-pci (the VFIO docs say “it’s also sufficient to only unbind the device from host drivers if a VFIO driver is unavailable”).
This fails if any of the groups is already open elsewhere, for instance if another
VfioContainer
containing one of the groups already currently exists.
Sourcepub fn groups(&self) -> &[u32]
pub fn groups(&self) -> &[u32]
The group numbers of the groups this container contains.
In ascending order, without duplicates.
Sourcepub fn iommu(&self) -> PciIommu<'_>
pub fn iommu(&self) -> PciIommu<'_>
Returns a thing that lets you manage IOMMU mappings for DMA for all devices in all groups that belong to this container.
Sourcepub fn reset(&self) -> Result<()>
pub fn reset(&self) -> Result<()>
Tries to reset all the PCI functions in all the VFIO groups that self
refers to.
This requires that the user has “ownership” over all the affected functions / permissions to do it.
TODO: Reset granularity might not match container granularity. Will probably need to expose reset topology properly eventually.
TODO: Should probably advertise whether this granularity of reset is supported, so the user doesn’t have to try resetting to find out.