pub trait Backend: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn is_ready(&self) -> bool;
fn activate(&self) -> Result<(), IommuError>;
fn invalidate_domain(&self, domain: DomainId);
// Provided methods
fn map(
&self,
_domain: DomainId,
_sbdf: Sbdf,
_iova: u64,
_phys: u64,
_len: u64,
_prot: DmaProt,
_kind: MappingKind,
) -> Result<(), IommuError> { ... }
fn unmap(
&self,
_domain: DomainId,
_sbdf: Sbdf,
_iova: u64,
_len: u64,
_kind: MappingKind,
) -> Result<(), IommuError> { ... }
fn interrupt_remapping(&self) -> bool { ... }
fn interrupt_remapping_active(&self) -> bool { ... }
fn allocate_msi(
&self,
_sbdf: Sbdf,
_vector: u8,
) -> Result<MsiAllocation, IommuError> { ... }
fn free_msi(&self, _cookie: u32) -> Result<(), IommuError> { ... }
}Expand description
A hardware translation backend.
Required Methods§
Sourcefn activate(&self) -> Result<(), IommuError>
fn activate(&self) -> Result<(), IommuError>
Program translation for every registered domain and enable it.
Sourcefn invalidate_domain(&self, domain: DomainId)
fn invalidate_domain(&self, domain: DomainId)
Flush cached translations for one domain.
Provided Methods§
Sourcefn map(
&self,
_domain: DomainId,
_sbdf: Sbdf,
_iova: u64,
_phys: u64,
_len: u64,
_prot: DmaProt,
_kind: MappingKind,
) -> Result<(), IommuError>
fn map( &self, _domain: DomainId, _sbdf: Sbdf, _iova: u64, _phys: u64, _len: u64, _prot: DmaProt, _kind: MappingKind, ) -> Result<(), IommuError>
Install one shadow mapping in the backend’s page tables.
Sourcefn unmap(
&self,
_domain: DomainId,
_sbdf: Sbdf,
_iova: u64,
_len: u64,
_kind: MappingKind,
) -> Result<(), IommuError>
fn unmap( &self, _domain: DomainId, _sbdf: Sbdf, _iova: u64, _len: u64, _kind: MappingKind, ) -> Result<(), IommuError>
Remove one shadow mapping from the backend’s page tables.
Sourcefn interrupt_remapping(&self) -> bool
fn interrupt_remapping(&self) -> bool
True when interrupt remapping is advertised.
Sourcefn interrupt_remapping_active(&self) -> bool
fn interrupt_remapping_active(&self) -> bool
True when interrupt remapping is actually programmed and usable.
Sourcefn allocate_msi(
&self,
_sbdf: Sbdf,
_vector: u8,
) -> Result<MsiAllocation, IommuError>
fn allocate_msi( &self, _sbdf: Sbdf, _vector: u8, ) -> Result<MsiAllocation, IommuError>
Allocate an IRTE and return the MSI message to program.
Sourcefn free_msi(&self, _cookie: u32) -> Result<(), IommuError>
fn free_msi(&self, _cookie: u32) -> Result<(), IommuError>
Release an IRTE previously returned by Backend::allocate_msi.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".