Iommu

Trait Iommu 

Source
pub trait Iommu:
    Debug
    + Send
    + Sync {
    type IotlbGuard<'a>: Deref<Target = Iotlb> + 'a
       where Self: 'a;

    // Required method
    fn translate(
        &self,
        iova: GuestAddress,
        length: usize,
        access: Permissions,
    ) -> Result<IotlbIterator<Self::IotlbGuard<'_>>, Error>;
}
Available on crate feature iommu only.
Expand description

An IOMMU, allowing translation of I/O virtual addresses (IOVAs).

Generally, Iommu implementaions consist of an Iotlb, which is supposed to be consulted first for lookup requests. All misses and access failures then should be resolved by looking up the affected ranges in the actual IOMMU (which has all current mappings) and putting the results back into the IOTLB. A subsequent lookup in the IOTLB should result in a full translation, which can then be returned.

Required Associated Types§

Source

type IotlbGuard<'a>: Deref<Target = Iotlb> + 'a where Self: 'a

Deref type associated with the type that internally wraps the Iotlb.

For example, the Iommu may keep the Iotlb wrapped in an RwLock, making this type RwLockReadGuard<'a, Iotlb>.

We need this specific type instead of a plain reference so that IotlbIterator can actually own the reference and prolong its lifetime.

Required Methods§

Source

fn translate( &self, iova: GuestAddress, length: usize, access: Permissions, ) -> Result<IotlbIterator<Self::IotlbGuard<'_>>, Error>

Translate the given range for the given access into the underlying address space.

Any translation request is supposed to be fully served by an internal Iotlb instance. Any misses or access failures should result in a lookup in the full IOMMU structures, filling the IOTLB with the results, and then repeating the lookup in there.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§