Struct devices::vfio::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
impl VfioContainer
pub fn new() -> Result<Self, VfioError>
pub fn new_from_container(container: File) -> Result<Self, VfioError>
fn is_group_set(&self, group_id: u32) -> bool
fn check_extension(&self, val: IommuType) -> bool
fn set_iommu(&mut self, val: IommuType) -> i32
fn set_iommu_checked(&mut self, val: IommuType) -> Result<(), VfioError>
sourcepub unsafe fn vfio_dma_map(
&self,
iova: u64,
size: u64,
user_addr: u64,
write_en: bool
) -> Result<(), VfioError>
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.
sourceunsafe fn vfio_iommu_type1_dma_map(
&self,
iova: u64,
size: u64,
user_addr: u64,
write_en: bool
) -> Result<(), VfioError>
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.
pub fn vfio_dma_unmap(&self, iova: u64, size: u64) -> Result<(), VfioError>
fn vfio_iommu_type1_dma_unmap( &self, iova: u64, size: u64 ) -> Result<(), VfioError>
pub fn vfio_get_iommu_page_size_mask(&self) -> Result<u64, VfioError>
fn vfio_iommu_type1_get_iommu_page_size_mask(&self) -> Result<u64, VfioError>
pub fn vfio_iommu_iova_get_iova_ranges( &self ) -> Result<Vec<AddressRange>, VfioError>
fn vfio_iommu_type1_get_iova_ranges( &self ) -> Result<Vec<AddressRange>, VfioError>
fn set_iommu_from(&mut self, iommu_dev: IommuDevType) -> Result<(), VfioError>
fn get_group_with_vm( &mut self, id: u32, vm: &impl Vm, iommu_dev: IommuDevType ) -> Result<Arc<Mutex<VfioGroup>>, VfioError>
fn get_group(&mut self, id: u32) -> Result<Arc<Mutex<VfioGroup>>, VfioError>
fn remove_group(&mut self, id: u32, reduce: bool)
pub fn clone_as_raw_descriptor(&self) -> Result<RawDescriptor, VfioError>
pub fn group_ids(&self) -> Vec<&u32>
Trait Implementations§
source§impl AsRawDescriptor for VfioContainer
impl AsRawDescriptor for VfioContainer
source§fn as_raw_descriptor(&self) -> RawDescriptor
fn as_raw_descriptor(&self) -> RawDescriptor
Returns the underlying raw descriptor. Read more
Auto Trait Implementations§
impl RefUnwindSafe for VfioContainer
impl Send for VfioContainer
impl Sync for VfioContainer
impl Unpin for VfioContainer
impl UnwindSafe for VfioContainer
Blanket Implementations§
source§impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.