pub struct PciIommu<'a> { /* private fields */ }
Expand description
Represents an IOMMU that controls DMA done by some PCI function, device, or group of devices.
You’ll probably need std::sync::atomic::fence
or use types like
AtomicU32
somewhere to synchronize accesses properly with the
device.
Implementations§
Source§impl PciIommu<'_>
impl PciIommu<'_>
Sourcepub fn alignment(&self) -> usize
pub fn alignment(&self) -> usize
Both iova
and process address
must be aligned to this value.
This is always a power of 2, and never less than the system’s page size.
Sourcepub fn valid_iova_ranges(&self) -> &[Range<u64>]
pub fn valid_iova_ranges(&self) -> &[Range<u64>]
IOVA ranges given to PciIommu::map
must be contained in one of the ranges that this
method returns.
Sourcepub fn max_num_mappings(&self) -> u32
pub fn max_num_mappings(&self) -> u32
The maximum number of mappings that may be in effect simultaneously.
Sourcepub unsafe fn map(
&self,
iova: u64,
length: usize,
address: *const u8,
device_permissions: Permissions,
) -> Result<()>
pub unsafe fn map( &self, iova: u64, length: usize, address: *const u8, device_permissions: Permissions, ) -> Result<()>
Add the given mapping to the IOMMU.
iova
is the start address of the region in the device’s address space.size
is the length of the region.address
is a pointer (in the current process’ address space) to the start of the region to be mapped.
TODO: Alignment constraints?
§Safety
Must make sense.
Auto Trait Implementations§
impl<'a> Freeze for PciIommu<'a>
impl<'a> !RefUnwindSafe for PciIommu<'a>
impl<'a> !Send for PciIommu<'a>
impl<'a> !Sync for PciIommu<'a>
impl<'a> Unpin for PciIommu<'a>
impl<'a> !UnwindSafe for PciIommu<'a>
Blanket Implementations§
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