Skip to main content

Backend

Trait Backend 

Source
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§

Source

fn name(&self) -> &'static str

Stable backend name ("vt-d", "amd-vi", "none").

Source

fn is_ready(&self) -> bool

True only when the backend has been validated end to end.

Source

fn activate(&self) -> Result<(), IommuError>

Program translation for every registered domain and enable it.

Source

fn invalidate_domain(&self, domain: DomainId)

Flush cached translations for one domain.

Provided Methods§

Source

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.

Source

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.

Source

fn interrupt_remapping(&self) -> bool

True when interrupt remapping is advertised.

Source

fn interrupt_remapping_active(&self) -> bool

True when interrupt remapping is actually programmed and usable.

Source

fn allocate_msi( &self, _sbdf: Sbdf, _vector: u8, ) -> Result<MsiAllocation, IommuError>

Allocate an IRTE and return the MSI message to program.

Source

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".

Implementors§