Expand description
Intel VT-d backend (x86_64).
Implements the legacy (non-scalable) translation path:
- DMAR/DRHD discovery and CAP/ECAP probing;
- shadow root/context/second-level tables (4 KiB, 2 MiB, 1 GiB leaves);
- queued invalidation (QI) with WAIT completion;
- interrupt-remapping table (IRTA/IRTE) and MSI doorbell allocation.
Context entries follow the legacy format observed in ESXi
(IOMMU-ANALYSE.md Β§3.4): TT = 00 (second-level translation), AGAW in
bits 6:4, domain id in the high qword bits 23:8. QI descriptor types and
the IR doorbell formula follow Β§3.6/Β§3.7 of the same document.
Activation remains gated by HARDWARE_ACTIVATION_ENABLED: the code is
complete but must be validated under QEMU intel-iommu before a boot path
may enable it. Until then is_ready() is false, SYS_IOMMU_ACTIVATE
returns 0 and MSI stays on the physical path.
Re-exportsΒ§
use alloc::collections::BTreeMap;πuse alloc::vec::Vec;πuse core::sync::atomic::AtomicBool;πuse core::sync::atomic::AtomicU16;πuse core::sync::atomic::Ordering;πuse super::super::iommu::Backend;πuse super::super::iommu::Discovery;πuse super::super::iommu::IommuError;πuse super::super::iommu::MsiAllocation;πuse crate::hardware::iommu::DmaProt;πuse crate::hardware::iommu::DomainId;πuse crate::hardware::iommu::MappingKind;πuse crate::hardware::iommu::Sbdf;πuse crate::memory;πuse crate::sync::SpinLock;π
StructsΒ§
- Domain
Shadow π - IrTable π
- Qi π
- Unit π
- VtdBackend π
- VtdState π
ConstantsΒ§
- CAP_CM π
- ECAP_IR π
- ECAP_PT π
- ECAP_QI π
- GCMD_
IRE π - GCMD_QI π
- GCMD_
SIRTP π - GCMD_
SRTP π - GCMD_TE π
- GSTS_
IRES π - GSTS_
QIES π - GSTS_
RTPS π - GSTS_
SIRTPS π - GSTS_
TES π - HARDWARE_
ACTIVATION_ ENABLED - Flip only after QEMU/hardware validation of the activation path.
- INTERRUPT_
REMAPPING_ ENABLED - Interrupt remapping is not enabled yet: MSI messages are still physical. Enabling IRE without programming every deviceβs IRTE would drop MSI.
- IRTE_
COUNT π - Number of 128-bit IRTEs (one 4 KiB page).
- QI_
CONTEXT π - QI descriptor types (ESXi
IOMMU-ANALYSE.mdΒ§3.6). - QI_
ENTRIES π - QI_
IOTLB π - QI_IRTE π
- QI_
SIZE_ πBYTES - QI_WAIT π
- SL_
ADDR_ πMASK - SL_
PRESENT π - Second-level page-table flags.
- SL_
SUPERPAGE π - SL_
WRITE π - VTD_CAP π
- VTD_
ECAP π - VTD_
GCMD π - VTD_
GSTS π - VTD_IQA π
- VTD_IQH π
- VTD_IQT π
- VTD_
IRTA π - VTD_
RTADDR π
StaticsΒ§
FunctionsΒ§
- alloc_
zeroed_ πtable - backend
- Backend handle, available only when a DMAR was found.
- clear_
leaf π - discovery
- Summary recorded by
init. - flush_
unit π - init
- Parse the DMAR, probe the units and build the shadow root table.
- install_
context_ πentry - Legacy context entry (ESXi
IOMMU-ANALYSE.mdΒ§3.4). - install_
leaf π - install_
passthrough_ πcontexts - Give every PCI function a pass-through context entry unless it already has a translated one.
- install_
root_ πentry - ir_
enable π - map_
mmio π - mmio_
read32 π - mmio_
read64 π - mmio_
write32 π - mmio_
write64 π - next_
table π - qi_
flush_ πir - qi_
setup π - table_
read π β - table_
write π β - wait_
bits π - wait_
gsts_ πclear - write_
irte π