Skip to main content

sys_vmm_map_iommu

Function sys_vmm_map_iommu 

Source
pub fn sys_vmm_map_iommu(
    vmm_handle: u64,
    req_ptr: u64,
) -> Result<u64, SyscallError>
Expand description

SYS_VMM_MAP_IOMMU (572): programs the device translation domain of a world.

arg1 = VMM capability handle (write permission required), arg2 = pointer to a VmmIommuMap. Exactly one of iommu_flags::MAP / iommu_flags::UNMAP must be set; REQUIRE_2M additionally enforces 2 MiB alignment on both the IOVA range and the backing host memory.

MAP: every IOVA page of the request is resolved through the world’s guest memory; an address not backed by mapped guest RAM returns ENOENT and nothing is installed (all-or-nothing). The device is bound to the world domain. UNMAP: the range must have been installed with the same leaf size, otherwise ENOENT.

Never returns a host physical address: the translation is kernel-side only.

When the host VT-d backend is ready, the kernel also mirrors the mapping into the host shadow tables (best effort, after the world registry lock is released). Backend absence or a hardware programming failure is logged and does not change the syscall result: the software model is authoritative.