Struct VfioContainer

Source
pub struct VfioContainer {
    container: File,
    groups: HashMap<u32, Arc<Mutex<VfioGroup>>>,
    iommu_type: Option<IommuType>,
}
Expand description

VfioContainer contain multi VfioGroup, and delegate an IOMMU domain table

Fields§

§container: File§groups: HashMap<u32, Arc<Mutex<VfioGroup>>>§iommu_type: Option<IommuType>

Implementations§

Source§

impl VfioContainer

Source

pub fn new() -> Result<Self, VfioError>

Source

pub fn new_from_container(container: File) -> Result<Self, VfioError>

Source

fn is_group_set(&self, group_id: u32) -> bool

Source

fn check_extension(&self, val: IommuType) -> bool

Source

fn set_iommu(&mut self, val: IommuType) -> i32

Source

fn set_iommu_checked(&mut self, val: IommuType) -> Result<(), VfioError>

Source

pub unsafe fn vfio_dma_map( &self, iova: u64, size: u64, user_addr: u64, write_en: bool, ) -> Result<(), VfioError>

§Safety

The caller is responsible for determining the safety of the VFIO_IOMMU_MAP_DMA ioctl.

Source

unsafe fn vfio_iommu_type1_dma_map( &self, iova: u64, size: u64, user_addr: u64, write_en: bool, ) -> Result<(), VfioError>

§Safety

The caller is responsible for determining the safety of the VFIO_IOMMU_MAP_DMA ioctl.

Source

pub fn vfio_dma_unmap(&self, iova: u64, size: u64) -> Result<(), VfioError>

Source

fn vfio_iommu_type1_dma_unmap( &self, iova: u64, size: u64, ) -> Result<(), VfioError>

Source

pub fn vfio_get_iommu_page_size_mask(&self) -> Result<u64, VfioError>

Source

fn vfio_iommu_type1_get_iommu_page_size_mask(&self) -> Result<u64, VfioError>

Source

pub fn vfio_iommu_iova_get_iova_ranges( &self, ) -> Result<Vec<AddressRange>, VfioError>

Source

fn vfio_iommu_type1_get_iova_ranges( &self, ) -> Result<Vec<AddressRange>, VfioError>

Source

fn set_iommu_from(&mut self, iommu_dev: IommuDevType) -> Result<(), VfioError>

Source

fn get_group_with_vm( &mut self, id: u32, vm: &dyn Vm, iommu_dev: IommuDevType, ) -> Result<Arc<Mutex<VfioGroup>>, VfioError>

Source

fn get_group(&mut self, id: u32) -> Result<Arc<Mutex<VfioGroup>>, VfioError>

Source

fn remove_group(&mut self, id: u32, reduce: bool)

Source

pub fn clone_as_raw_descriptor(&self) -> Result<RawDescriptor, VfioError>

Source

pub fn group_ids(&self) -> Vec<&u32>

Trait Implementations§

Source§

impl AsRawDescriptor for VfioContainer

Source§

fn as_raw_descriptor(&self) -> RawDescriptor

Returns the underlying raw descriptor. 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> AsRawDescriptors for T
where T: AsRawDescriptor,

Source§

fn as_raw_descriptors(&self) -> Vec<i32>

Returns the underlying raw descriptors. 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V