vmm: Support device passthrough with vfio cdev and iommufd

When `--platform iommufd=on` is set, use the vfio cdev interface backed
by iommufd instead of the legacy vfio container/group interface for
device passthrough.

The cdev path opens '/dev/iommu' via IommuFd, allocates an IOAS, and
binds VFIO devices through VfioIommufd. The legacy container/group path
remains the default and is used when iommufd is not enabled.

Add iommufd-ioctls as a workspace dependency and enable the "vfio_cdev"
feature on vfio-ioctls for KVM builds.

Fixes: #6892

Signed-off-by: Bo Chen <bchen@crusoe.ai>
This commit is contained in:
Bo Chen
2026-04-09 04:50:54 +00:00
parent 13972a0edf
commit fe5f991c37
4 changed files with 62 additions and 3 deletions
+3
View File
@@ -17,8 +17,10 @@ ivshmem = ["devices/ivshmem"]
kvm = [
"arch/kvm",
"hypervisor/kvm",
"iommufd-ioctls",
"pci/kvm",
"vfio-ioctls/kvm",
"vfio-ioctls/vfio_cdev",
"virtio-devices/kvm",
"vm-device/kvm",
]
@@ -55,6 +57,7 @@ hex = { version = "0.4.3", optional = true }
hypervisor = { path = "../hypervisor" }
igvm = { workspace = true, optional = true }
igvm_defs = { workspace = true, optional = true }
iommufd-ioctls = { workspace = true, optional = true }
landlock = "0.4.4"
libc = { workspace = true }
linux-loader = { workspace = true, features = ["bzimage", "elf", "pe"] }