pub struct DmaMapperClient { /* private fields */ }Expand description
Client for registering DMA mappers with the region manager.
This is the public-facing handle for IOMMU consumers (VFIO, iommufd)
to register themselves. It exposes only add_dma_mapper, hiding the
rest of the region manager API.
Implementations§
Source§impl DmaMapperClient
impl DmaMapperClient
Sourcepub async fn add_dma_mapper(
&self,
target: Arc<dyn DmaTarget>,
needs_va: bool,
) -> Result<DmaMapperHandle>
pub async fn add_dma_mapper( &self, target: Arc<dyn DmaTarget>, needs_va: bool, ) -> Result<DmaMapperHandle>
Register a DMA target to receive sub-mapping events.
This may only be called in the same process as the region manager.
If needs_va is true, the region manager will maintain a VaMapper
and pass a host VA to DmaTarget::map_dma for each sub-mapping.
Use this for backends that program the IOMMU via host VAs (VFIO type1).
If needs_va is false, no VaMapper is created and host_va will
be None. Use this for backends that map from the fd directly (iommufd).
The replay loop maps all existing active sub-mappings into the new
consumer. On failure, already-mapped entries are not rolled back;
the caller must clean up by dropping the DmaTarget (e.g., closing
the VFIO container fd).
Returns a DmaMapperHandle that removes the mapper when dropped.
Trait Implementations§
Source§impl Clone for DmaMapperClient
impl Clone for DmaMapperClient
Source§fn clone(&self) -> DmaMapperClient
fn clone(&self) -> DmaMapperClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more